From: Boris Ostrovsky <boris.ostrovsky@oracle.com> To: Juergen Gross <jgross@suse.com>, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, x86@kernel.org Cc: hpa@zytor.com, tglx@linutronix.de, mingo@redhat.com Subject: Re: [PATCH 2/2] x86/xen: use capabilities instead of fake cpuid values Date: Fri, 17 Feb 2017 09:30:57 -0500 [thread overview] Message-ID: <a4a8d0e9-8987-172d-2aec-2a1c1c07065e@oracle.com> (raw) In-Reply-To: <1f923425-47f5-5e6d-5bca-e4c98d54ced5@suse.com> On 02/17/2017 09:19 AM, Juergen Gross wrote: > On 17/02/17 15:05, Boris Ostrovsky wrote: >> >> >> On 02/17/2017 02:36 AM, Juergen Gross wrote: >>> When running as pv domain xen_cpuid() is being used instead of >>> native_cpuid(). In xen_cpuid() the aperf/mperf feature is indicated >>> as not being present by special casing the related cpuid leaf. >>> >>> Instead of delivering fake cpuid values clear the cpu capability bit >>> for aperf/mperf instead. >>> >>> Signed-off-by: Juergen Gross <jgross@suse.com> >>> --- >>> arch/x86/xen/enlighten.c | 11 +++-------- >>> 1 file changed, 3 insertions(+), 8 deletions(-) >>> >>> diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c >>> index 83399ce..0eebb75 100644 >>> --- a/arch/x86/xen/enlighten.c >>> +++ b/arch/x86/xen/enlighten.c >>> @@ -301,9 +301,6 @@ xen_running_on_version_or_later(unsigned int >>> major, unsigned int minor) >>> return false; >>> } >>> >>> -#define CPUID_THERM_POWER_LEAF 6 >>> -#define APERFMPERF_PRESENT 0 >>> - >>> static __read_mostly unsigned int cpuid_leaf1_edx_mask = ~0; >>> static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0; >>> >>> @@ -337,11 +334,6 @@ static void xen_cpuid(unsigned int *ax, unsigned >>> int *bx, >>> *dx = cpuid_leaf5_edx_val; >>> return; >>> >>> - case CPUID_THERM_POWER_LEAF: >>> - /* Disabling APERFMPERF for kernel usage */ >>> - maskecx = ~(1 << APERFMPERF_PRESENT); >>> - break; >>> - >> >> >> But now APERF/MPERF will be reported as supported by CPUID, won't it? > > Yes. But this shouldn't be a problem as the kernel is always testing > X86_FEATURE_APERFMPERF for testing the support. But X86_FEATURE_APERFMPERF cap is set based on CPUID query. -boris > >>> case 0xb: >>> /* Suppress extended topology stuff */ >>> maskebx = 0; >>> @@ -462,6 +454,9 @@ static void __init xen_init_cpuid_mask(void) >>> if (xen_check_mwait()) >>> cpuid_leaf1_ecx_set_mask = (1 << (X86_FEATURE_MWAIT % 32)); >>> >>> + /* Disable APERFMPERF feature. */ >>> + setup_clear_cpu_cap(X86_FEATURE_APERFMPERF); >>> + >>> /* Disable DCA feature. */ >>> setup_clear_cpu_cap(X86_FEATURE_DCA); >> >> >> I think both of those can go to xen_set_cpu_features(). > > Okay. I'll move them. > > I think we can convert some of the remaining cpuid bit modifications to > cpu capabilities as well. > > > Juergen >
WARNING: multiple messages have this Message-ID (diff)
From: Boris Ostrovsky <boris.ostrovsky@oracle.com> To: Juergen Gross <jgross@suse.com>, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, x86@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com Subject: Re: [PATCH 2/2] x86/xen: use capabilities instead of fake cpuid values Date: Fri, 17 Feb 2017 09:30:57 -0500 [thread overview] Message-ID: <a4a8d0e9-8987-172d-2aec-2a1c1c07065e@oracle.com> (raw) In-Reply-To: <1f923425-47f5-5e6d-5bca-e4c98d54ced5@suse.com> On 02/17/2017 09:19 AM, Juergen Gross wrote: > On 17/02/17 15:05, Boris Ostrovsky wrote: >> >> >> On 02/17/2017 02:36 AM, Juergen Gross wrote: >>> When running as pv domain xen_cpuid() is being used instead of >>> native_cpuid(). In xen_cpuid() the aperf/mperf feature is indicated >>> as not being present by special casing the related cpuid leaf. >>> >>> Instead of delivering fake cpuid values clear the cpu capability bit >>> for aperf/mperf instead. >>> >>> Signed-off-by: Juergen Gross <jgross@suse.com> >>> --- >>> arch/x86/xen/enlighten.c | 11 +++-------- >>> 1 file changed, 3 insertions(+), 8 deletions(-) >>> >>> diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c >>> index 83399ce..0eebb75 100644 >>> --- a/arch/x86/xen/enlighten.c >>> +++ b/arch/x86/xen/enlighten.c >>> @@ -301,9 +301,6 @@ xen_running_on_version_or_later(unsigned int >>> major, unsigned int minor) >>> return false; >>> } >>> >>> -#define CPUID_THERM_POWER_LEAF 6 >>> -#define APERFMPERF_PRESENT 0 >>> - >>> static __read_mostly unsigned int cpuid_leaf1_edx_mask = ~0; >>> static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0; >>> >>> @@ -337,11 +334,6 @@ static void xen_cpuid(unsigned int *ax, unsigned >>> int *bx, >>> *dx = cpuid_leaf5_edx_val; >>> return; >>> >>> - case CPUID_THERM_POWER_LEAF: >>> - /* Disabling APERFMPERF for kernel usage */ >>> - maskecx = ~(1 << APERFMPERF_PRESENT); >>> - break; >>> - >> >> >> But now APERF/MPERF will be reported as supported by CPUID, won't it? > > Yes. But this shouldn't be a problem as the kernel is always testing > X86_FEATURE_APERFMPERF for testing the support. But X86_FEATURE_APERFMPERF cap is set based on CPUID query. -boris > >>> case 0xb: >>> /* Suppress extended topology stuff */ >>> maskebx = 0; >>> @@ -462,6 +454,9 @@ static void __init xen_init_cpuid_mask(void) >>> if (xen_check_mwait()) >>> cpuid_leaf1_ecx_set_mask = (1 << (X86_FEATURE_MWAIT % 32)); >>> >>> + /* Disable APERFMPERF feature. */ >>> + setup_clear_cpu_cap(X86_FEATURE_APERFMPERF); >>> + >>> /* Disable DCA feature. */ >>> setup_clear_cpu_cap(X86_FEATURE_DCA); >> >> >> I think both of those can go to xen_set_cpu_features(). > > Okay. I'll move them. > > I think we can convert some of the remaining cpuid bit modifications to > cpu capabilities as well. > > > Juergen > _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-02-17 14:32 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-02-17 7:36 [PATCH 0/2] x86/xen: cpuid() cleanup Juergen Gross 2017-02-17 7:36 ` Juergen Gross 2017-02-17 7:36 ` [PATCH 1/2] x86/xen: don't indicate DCA support in pv domains Juergen Gross 2017-02-17 7:36 ` Juergen Gross 2017-02-17 7:36 ` [PATCH 2/2] x86/xen: use capabilities instead of fake cpuid values Juergen Gross 2017-02-17 14:05 ` Boris Ostrovsky 2017-02-17 14:19 ` Juergen Gross 2017-02-17 14:19 ` Juergen Gross 2017-02-17 14:30 ` Boris Ostrovsky [this message] 2017-02-17 14:30 ` Boris Ostrovsky 2017-02-17 14:43 ` Juergen Gross 2017-02-17 14:43 ` Juergen Gross 2017-02-17 14:05 ` Boris Ostrovsky 2017-02-17 7:36 ` Juergen Gross
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=a4a8d0e9-8987-172d-2aec-2a1c1c07065e@oracle.com \ --to=boris.ostrovsky@oracle.com \ --cc=hpa@zytor.com \ --cc=jgross@suse.com \ --cc=linux-kernel@vger.kernel.org \ --cc=mingo@redhat.com \ --cc=tglx@linutronix.de \ --cc=x86@kernel.org \ --cc=xen-devel@lists.xenproject.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.