diff mbox series

[v8,4/5] x86/paravirt: Remove const mark from x86_hyper_xen_hvm variable

Message ID 1563251169-30740-1-git-send-email-zhenzhong.duan@oracle.com (mailing list archive)
State New, archived
Headers show
Series None | expand

Commit Message

Zhenzhong Duan July 16, 2019, 4:26 a.m. UTC
.. as "nopv" support needs it to be changeable at boot up stage.

Checkpatch reports warning, so move variable declarations from
hypervisor.c to hypervisor.h

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
---
 arch/x86/include/asm/hypervisor.h | 8 ++++++++
 arch/x86/kernel/cpu/hypervisor.c  | 8 --------
 arch/x86/xen/enlighten_hvm.c      | 2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

Comments

Jürgen Groß July 17, 2019, 4:58 a.m. UTC | #1
On 16.07.19 06:26, Zhenzhong Duan wrote:
> .. as "nopv" support needs it to be changeable at boot up stage.
> 
> Checkpatch reports warning, so move variable declarations from
> hypervisor.c to hypervisor.h
> 
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>

Reviewed-by: Juergen Gross <jgross@suse.com>

... and complete series applied to xen/tip.git for-linus-5.3a


Juergen
Joe Perches July 17, 2019, 6:46 a.m. UTC | #2
On Tue, 2019-07-16 at 12:26 +0800, Zhenzhong Duan wrote:
> .. as "nopv" support needs it to be changeable at boot up stage.
> 
> Checkpatch reports warning, so move variable declarations from
> hypervisor.c to hypervisor.h
[]
> diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c
[]
> @@ -259,7 +259,7 @@ static __init void xen_hvm_guest_late_init(void)
>  #endif
>  }
>  
> -const __initconst struct hypervisor_x86 x86_hyper_xen_hvm = {
> +struct hypervisor_x86 x86_hyper_xen_hvm __initdata = {

static?
Jürgen Groß July 17, 2019, 6:49 a.m. UTC | #3
On 17.07.19 08:46, Joe Perches wrote:
> On Tue, 2019-07-16 at 12:26 +0800, Zhenzhong Duan wrote:
>> .. as "nopv" support needs it to be changeable at boot up stage.
>>
>> Checkpatch reports warning, so move variable declarations from
>> hypervisor.c to hypervisor.h
> []
>> diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c
> []
>> @@ -259,7 +259,7 @@ static __init void xen_hvm_guest_late_init(void)
>>   #endif
>>   }
>>   
>> -const __initconst struct hypervisor_x86 x86_hyper_xen_hvm = {
>> +struct hypervisor_x86 x86_hyper_xen_hvm __initdata = {
> 
> static?

It is being referenced from arch/x86/kernel/cpu/hypervisor.c


Juergen
Joe Perches July 17, 2019, 5:22 p.m. UTC | #4
On Wed, 2019-07-17 at 08:49 +0200, Juergen Gross wrote:
> On 17.07.19 08:46, Joe Perches wrote:
> > On Tue, 2019-07-16 at 12:26 +0800, Zhenzhong Duan wrote:
> > > .. as "nopv" support needs it to be changeable at boot up stage.
> > > 
> > > Checkpatch reports warning, so move variable declarations from
> > > hypervisor.c to hypervisor.h
> > []
> > > diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c
> > []
> > > @@ -259,7 +259,7 @@ static __init void xen_hvm_guest_late_init(void)
> > >   #endif
> > >   }
> > >   
> > > -const __initconst struct hypervisor_x86 x86_hyper_xen_hvm = {
> > > +struct hypervisor_x86 x86_hyper_xen_hvm __initdata = {
> > 
> > static?
> 
> It is being referenced from arch/x86/kernel/cpu/hypervisor.c

But wasn't it also removed from the list of externs?

Rereading the .h file, no it wasn't.  I missed that.

Perhaps the extern list could be reordered to move this
x86_hyper_xen_hvm to be next to x86_hyper_type.

I also suggest that "extern bool nopv" might be a bit
non-specific and could use a longer identifier.
Jürgen Groß July 18, 2019, 3:48 a.m. UTC | #5
On 17.07.19 19:22, Joe Perches wrote:
> On Wed, 2019-07-17 at 08:49 +0200, Juergen Gross wrote:
>> On 17.07.19 08:46, Joe Perches wrote:
>>> On Tue, 2019-07-16 at 12:26 +0800, Zhenzhong Duan wrote:
>>>> .. as "nopv" support needs it to be changeable at boot up stage.
>>>>
>>>> Checkpatch reports warning, so move variable declarations from
>>>> hypervisor.c to hypervisor.h
>>> []
>>>> diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c
>>> []
>>>> @@ -259,7 +259,7 @@ static __init void xen_hvm_guest_late_init(void)
>>>>    #endif
>>>>    }
>>>>    
>>>> -const __initconst struct hypervisor_x86 x86_hyper_xen_hvm = {
>>>> +struct hypervisor_x86 x86_hyper_xen_hvm __initdata = {
>>>
>>> static?
>>
>> It is being referenced from arch/x86/kernel/cpu/hypervisor.c
> 
> But wasn't it also removed from the list of externs?
> 
> Rereading the .h file, no it wasn't.  I missed that.
> 
> Perhaps the extern list could be reordered to move this
> x86_hyper_xen_hvm to be next to x86_hyper_type.
> 
> I also suggest that "extern bool nopv" might be a bit
> non-specific and could use a longer identifier.

You are a little bit late. It has been this way since V5 of the series
posted on July 3rd.

I have pushed the series to my tree already and I'm about to send the
pull request.

Followup patches welcome. :-)


Juergen
diff mbox series

Patch

diff --git a/arch/x86/include/asm/hypervisor.h b/arch/x86/include/asm/hypervisor.h
index f7b4c53..e41cbf2 100644
--- a/arch/x86/include/asm/hypervisor.h
+++ b/arch/x86/include/asm/hypervisor.h
@@ -58,6 +58,14 @@  struct hypervisor_x86 {
 	bool ignore_nopv;
 };
 
+extern const struct hypervisor_x86 x86_hyper_vmware;
+extern const struct hypervisor_x86 x86_hyper_ms_hyperv;
+extern const struct hypervisor_x86 x86_hyper_xen_pv;
+extern const struct hypervisor_x86 x86_hyper_kvm;
+extern const struct hypervisor_x86 x86_hyper_jailhouse;
+extern const struct hypervisor_x86 x86_hyper_acrn;
+extern struct hypervisor_x86 x86_hyper_xen_hvm;
+
 extern bool nopv;
 extern enum x86_hypervisor_type x86_hyper_type;
 extern void init_hypervisor_platform(void);
diff --git a/arch/x86/kernel/cpu/hypervisor.c b/arch/x86/kernel/cpu/hypervisor.c
index 7eaad41..553bfbf 100644
--- a/arch/x86/kernel/cpu/hypervisor.c
+++ b/arch/x86/kernel/cpu/hypervisor.c
@@ -26,14 +26,6 @@ 
 #include <asm/processor.h>
 #include <asm/hypervisor.h>
 
-extern const struct hypervisor_x86 x86_hyper_vmware;
-extern const struct hypervisor_x86 x86_hyper_ms_hyperv;
-extern const struct hypervisor_x86 x86_hyper_xen_pv;
-extern const struct hypervisor_x86 x86_hyper_xen_hvm;
-extern const struct hypervisor_x86 x86_hyper_kvm;
-extern const struct hypervisor_x86 x86_hyper_jailhouse;
-extern const struct hypervisor_x86 x86_hyper_acrn;
-
 static const __initconst struct hypervisor_x86 * const hypervisors[] =
 {
 #ifdef CONFIG_XEN_PV
diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c
index 1756cf7..b671983 100644
--- a/arch/x86/xen/enlighten_hvm.c
+++ b/arch/x86/xen/enlighten_hvm.c
@@ -259,7 +259,7 @@  static __init void xen_hvm_guest_late_init(void)
 #endif
 }
 
-const __initconst struct hypervisor_x86 x86_hyper_xen_hvm = {
+struct hypervisor_x86 x86_hyper_xen_hvm __initdata = {
 	.name                   = "Xen HVM",
 	.detect                 = xen_platform_hvm,
 	.type			= X86_HYPER_XEN_HVM,