[PATCH] x86/xen: only unlock when USE_SPLIT_PTE_PTLOCKS is true

2020-09-28 Thread Jason Yan
When USE_SPLIT_PTE_PTLOCKS is false, xen_pte_lock() actually do nothing
but returns NULL. So xen_pte_unlock() should not actually unlock.
Otherwise a NULL pointer dereference will be triggered.

Fixes: 74260714c56d ("xen: lock pte pages while pinning/unpinning")
Signed-off-by: Jason Yan 
---
 arch/x86/xen/mmu_pv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c
index eda78144c000..c70cbdf5c0fa 100644
--- a/arch/x86/xen/mmu_pv.c
+++ b/arch/x86/xen/mmu_pv.c
@@ -656,8 +656,10 @@ static spinlock_t *xen_pte_lock(struct page *page, struct 
mm_struct *mm)
 
 static void xen_pte_unlock(void *v)
 {
+#if USE_SPLIT_PTE_PTLOCKS
spinlock_t *ptl = v;
spin_unlock(ptl);
+#endif
 }
 
 static void xen_do_pin(unsigned level, unsigned long pfn)
-- 
2.25.4




[PATCH] xen/pci: make xen_msi_init() static

2020-04-17 Thread Jason Yan
Fix the following sparse warning:

arch/x86/pci/xen.c:426:13: warning: symbol 'xen_msi_init' was not
declared. Should it be static?

Reported-by: Hulk Robot 
Signed-off-by: Jason Yan 
---
 arch/x86/pci/xen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index 91220cc25854..0d06f12ccd74 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -423,7 +423,7 @@ int __init pci_xen_init(void)
 }
 
 #ifdef CONFIG_PCI_MSI
-void __init xen_msi_init(void)
+static void __init xen_msi_init(void)
 {
if (!disable_apic) {
/*
-- 
2.21.1




[PATCH] arm/xen: make _xen_start_info static

2020-04-15 Thread Jason Yan
Fix the following sparse warning:

arch/arm64/xen/../../arm/xen/enlighten.c:39:19: warning: symbol
'_xen_start_info' was not declared. Should it be static?

Reported-by: Hulk Robot 
Signed-off-by: Jason Yan 
---
 arch/arm/xen/enlighten.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
index dd6804a64f1a..fd4e1ce1daf9 100644
--- a/arch/arm/xen/enlighten.c
+++ b/arch/arm/xen/enlighten.c
@@ -36,7 +36,7 @@
 
 #include 
 
-struct start_info _xen_start_info;
+static struct start_info _xen_start_info;
 struct start_info *xen_start_info = &_xen_start_info;
 EXPORT_SYMBOL(xen_start_info);
 
-- 
2.21.1




[PATCH] x86/xen: make xen_pvmmu_arch_setup() static

2020-04-07 Thread Jason Yan
Fix the following sparse warning:

arch/x86/xen/setup.c:998:12: warning: symbol 'xen_pvmmu_arch_setup' was not
declared. Should it be static?

Reported-by: Hulk Robot 
Signed-off-by: Jason Yan 
---
 arch/x86/xen/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 33b0e20df7fc..1a2d8a50dac4 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -985,7 +985,7 @@ void xen_enable_syscall(void)
 #endif /* CONFIG_X86_64 */
 }
 
-void __init xen_pvmmu_arch_setup(void)
+static void __init xen_pvmmu_arch_setup(void)
 {
HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments);
HYPERVISOR_vm_assist(VMASST_CMD_enable, 
VMASST_TYPE_writable_pagetables);
-- 
2.17.2