From: "Jan Beulich" Subject: [PATCH] x86: quiesce cpuidle code Date: Fri, 11 Nov 2011 11:12:31 +0000 Message-ID: <4EBD112F0200007800060664@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part97B8690F.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part97B8690F.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline So far these messages got pointlessly (as the code in other places assumes symmetric configuration) emitted once per CPU. Hide the debug one behind opt_cpu_info, and issue the info one just once (if the code gets adjusted to support assymtric configurations, this would need to be revisited, but ideally without producing per-CPU messages again). Signed-off-by: Jan Beulich --- a/xen/arch/x86/acpi/cpu_idle.c +++ b/xen/arch/x86/acpi/cpu_idle.c @@ -664,6 +664,8 @@ static int acpi_processor_ffh_cstate_pro unsigned int edx_part; unsigned int cstate_type; /* C-state type and not ACPI C-state type = */ unsigned int num_cstate_subtype; + int ret =3D 0; + static unsigned long printed; =20 if ( c->cpuid_level < CPUID_MWAIT_LEAF ) { @@ -672,8 +674,9 @@ static int acpi_processor_ffh_cstate_pro } =20 cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx); - printk(XENLOG_DEBUG "cpuid.MWAIT[.eax=3D%x, .ebx=3D%x, .ecx=3D%x, = .edx=3D%x]\n", - eax, ebx, ecx, edx); + if ( opt_cpu_info ) + printk(XENLOG_DEBUG "cpuid.MWAIT[eax=3D%x ebx=3D%x ecx=3D%x = edx=3D%x]\n", + eax, ebx, ecx, edx); =20 /* Check whether this particular cx_type (in CST) is supported or not = */ cstate_type =3D (cx->reg.address >> MWAIT_SUBSTATE_SIZE) + 1; @@ -681,15 +684,16 @@ static int acpi_processor_ffh_cstate_pro num_cstate_subtype =3D edx_part & MWAIT_SUBSTATE_MASK; =20 if ( num_cstate_subtype < (cx->reg.address & MWAIT_SUBSTATE_MASK) ) - return -EFAULT; - + ret =3D -ERANGE; /* mwait ecx extensions INTERRUPT_BREAK should be supported for C2/C3 = */ - if ( !(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) || - !(ecx & CPUID5_ECX_INTERRUPT_BREAK) ) - return -EFAULT; - - printk(XENLOG_INFO "Monitor-Mwait will be used to enter C-%d = state\n", cx->type); - return 0; + else if ( !(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) || + !(ecx & CPUID5_ECX_INTERRUPT_BREAK) ) + ret =3D -ENODEV; + else if ( opt_cpu_info || cx->type >=3D BITS_PER_LONG || + !test_and_set_bit(cx->type, &printed) ) + printk(XENLOG_INFO "Monitor-Mwait will be used to enter C%d = state\n", + cx->type); + return ret; } =20 /* --=__Part97B8690F.0__= Content-Type: text/plain; name="x86-cpuidle-silent.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-cpuidle-silent.patch" x86: quiesce cpuidle code=0A=0ASo far these messages got pointlessly (as = the code in other places=0Aassumes symmetric configuration) emitted once = per CPU. Hide the debug=0Aone behind opt_cpu_info, and issue the info one = just once (if the code=0Agets adjusted to support assymtric configurations,= this would need to=0Abe revisited, but ideally without producing per-CPU = messages again).=0A=0ASigned-off-by: Jan Beulich =0A=0A-= -- a/xen/arch/x86/acpi/cpu_idle.c=0A+++ b/xen/arch/x86/acpi/cpu_idle.c=0A@@= -664,6 +664,8 @@ static int acpi_processor_ffh_cstate_pro=0A unsigned = int edx_part;=0A unsigned int cstate_type; /* C-state type and not = ACPI C-state type */=0A unsigned int num_cstate_subtype;=0A+ int = ret =3D 0;=0A+ static unsigned long printed;=0A =0A if ( c->cpuid_le= vel < CPUID_MWAIT_LEAF )=0A {=0A@@ -672,8 +674,9 @@ static int = acpi_processor_ffh_cstate_pro=0A }=0A =0A cpuid(CPUID_MWAIT_LEAF, = &eax, &ebx, &ecx, &edx);=0A- printk(XENLOG_DEBUG "cpuid.MWAIT[.eax=3D%x,= .ebx=3D%x, .ecx=3D%x, .edx=3D%x]\n",=0A- eax, ebx, ecx, = edx);=0A+ if ( opt_cpu_info )=0A+ printk(XENLOG_DEBUG "cpuid.MWAI= T[eax=3D%x ebx=3D%x ecx=3D%x edx=3D%x]\n",=0A+ eax, ebx, = ecx, edx);=0A =0A /* Check whether this particular cx_type (in CST) is = supported or not */=0A cstate_type =3D (cx->reg.address >> MWAIT_SUBSTA= TE_SIZE) + 1;=0A@@ -681,15 +684,16 @@ static int acpi_processor_ffh_cstate_= pro=0A num_cstate_subtype =3D edx_part & MWAIT_SUBSTATE_MASK;=0A =0A = if ( num_cstate_subtype < (cx->reg.address & MWAIT_SUBSTATE_MASK) )=0A- = return -EFAULT;=0A-=0A+ ret =3D -ERANGE;=0A /* mwait ecx = extensions INTERRUPT_BREAK should be supported for C2/C3 */=0A- if ( = !(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) ||=0A- !(ecx & CPUID5_ECX_= INTERRUPT_BREAK) )=0A- return -EFAULT;=0A-=0A- printk(XENLOG_INFO= "Monitor-Mwait will be used to enter C-%d state\n", cx->type);=0A- = return 0;=0A+ else if ( !(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) ||=0A+ = !(ecx & CPUID5_ECX_INTERRUPT_BREAK) )=0A+ ret =3D = -ENODEV;=0A+ else if ( opt_cpu_info || cx->type >=3D BITS_PER_LONG = ||=0A+ !test_and_set_bit(cx->type, &printed) )=0A+ = printk(XENLOG_INFO "Monitor-Mwait will be used to enter C%d state\n",=0A+ = cx->type);=0A+ return ret;=0A }=0A =0A /*=0A --=__Part97B8690F.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__Part97B8690F.0__=--