public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] CPU hotplug,x86 Microcode: Don't request microcode from userspace unnecessarily
@ 2011-10-08 20:47 Srivatsa S. Bhat
  2011-10-09 11:27 ` Borislav Petkov
  0 siblings, 1 reply; 8+ messages in thread
From: Srivatsa S. Bhat @ 2011-10-08 20:47 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: tigran@aivazian.fsnet.co.uk, tglx@linutronix.de, mingo@elte.hu,
	mingo, hpa@zytor.com, x86@kernel.org, andreas.herrmann3,
	amd64-microcode, Rafael J. Wysocki, Tejun Heo,
	Linux PM mailing list, linux-kernel

Requesting the microcode from userspace *every time* when onlining CPUs
(during a CPU hotplug operation) is unnecessary.

So, this patch ensures that once the kernel gets the microcode after booting,
it is not freed nor invalidated when a CPU goes offline, so that it can be
reused when that CPU comes back online, without requesting userspace for it
again. As a result, the CPU hotplug operations become faster as well.

Tested-by: Borislav Petkov <bp@amd64.org>
Acked-by: Borislav Petkov <bp@amd64.org>
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
---

 arch/x86/kernel/microcode_core.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
index f924280..3fd0189 100644
--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -483,7 +483,13 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
 		sysfs_remove_group(&sys_dev->kobj, &mc_attr_group);
 		pr_debug("CPU%d removed\n", cpu);
 		break;
-	case CPU_DEAD:
+
+	/* When a CPU goes offline, don't free up or invalidate the copy of
+	 * the microcode in kernel memory, so that we can reuse it when the
+	 * CPU comes back online without unnecessarily requesting the userspace
+	 * for it again.
+	 */
+
 	case CPU_UP_CANCELED_FROZEN:
 		/* The CPU refused to come up during a system resume */
 		microcode_fini_cpu(cpu);



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] CPU hotplug,x86 Microcode: Don't request microcode from userspace unnecessarily
  2011-10-08 20:47 [PATCH] CPU hotplug,x86 Microcode: Don't request microcode from userspace unnecessarily Srivatsa S. Bhat
@ 2011-10-09 11:27 ` Borislav Petkov
  2011-10-09 19:38   ` Srivatsa S. Bhat
  0 siblings, 1 reply; 8+ messages in thread
From: Borislav Petkov @ 2011-10-09 11:27 UTC (permalink / raw)
  To: Srivatsa S. Bhat, Ingo Molnar
  Cc: Borislav Petkov, tigran@aivazian.fsnet.co.uk, tglx@linutronix.de,
	mingo@redhat.com, hpa@zytor.com, x86@kernel.org,
	Herrmann3, Andreas, amd64-microcode@amd64.org, Rafael J. Wysocki,
	Tejun Heo, Linux PM mailing list, linux-kernel

On Sat, Oct 08, 2011 at 04:47:53PM -0400, Srivatsa S. Bhat wrote:
> Requesting the microcode from userspace *every time* when onlining CPUs
> (during a CPU hotplug operation) is unnecessary.
> 
> So, this patch ensures that once the kernel gets the microcode after booting,
> it is not freed nor invalidated when a CPU goes offline, so that it can be
> reused when that CPU comes back online, without requesting userspace for it
> again. As a result, the CPU hotplug operations become faster as well.
> 
> Tested-by: Borislav Petkov <bp@amd64.org>
> Acked-by: Borislav Petkov <bp@amd64.org>
> Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>

Good, thanks. Just a minor nitpick below.

> ---
> 
>  arch/x86/kernel/microcode_core.c |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
> index f924280..3fd0189 100644
> --- a/arch/x86/kernel/microcode_core.c
> +++ b/arch/x86/kernel/microcode_core.c
> @@ -483,7 +483,13 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
>  		sysfs_remove_group(&sys_dev->kobj, &mc_attr_group);
>  		pr_debug("CPU%d removed\n", cpu);
>  		break;
> -	case CPU_DEAD:
> +
> +	/* When a CPU goes offline, don't free up or invalidate the copy of
> +	 * the microcode in kernel memory, so that we can reuse it when the
> +	 * CPU comes back online without unnecessarily requesting the userspace
> +	 * for it again.
> +	 */
> +

Kernel comment style is in this format:

/*
 * Blabla
 * blublu
 */

@Ingo, can you please adjust it in-flight when applying?

Thanks.

-- 
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
GM: Alberto Bozzo
Reg: Dornach, Landkreis Muenchen
HRB Nr. 43632 WEEE Registernr: 129 19551


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] CPU hotplug,x86 Microcode: Don't request microcode from userspace unnecessarily
  2011-10-09 11:27 ` Borislav Petkov
@ 2011-10-09 19:38   ` Srivatsa S. Bhat
  2011-10-09 19:42     ` [PATCH RESEND] " Srivatsa S. Bhat
  0 siblings, 1 reply; 8+ messages in thread
From: Srivatsa S. Bhat @ 2011-10-09 19:38 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Ingo Molnar, Borislav Petkov, tigran@aivazian.fsnet.co.uk,
	tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com,
	x86@kernel.org, Herrmann3, Andreas, amd64-microcode@amd64.org,
	Rafael J. Wysocki, Tejun Heo, Linux PM mailing list, linux-kernel

On 10/09/2011 04:57 PM, Borislav Petkov wrote:
> On Sat, Oct 08, 2011 at 04:47:53PM -0400, Srivatsa S. Bhat wrote:
>> Requesting the microcode from userspace *every time* when onlining CPUs
>> (during a CPU hotplug operation) is unnecessary.
>>
>> So, this patch ensures that once the kernel gets the microcode after booting,
>> it is not freed nor invalidated when a CPU goes offline, so that it can be
>> reused when that CPU comes back online, without requesting userspace for it
>> again. As a result, the CPU hotplug operations become faster as well.
>>
>> Tested-by: Borislav Petkov <bp@amd64.org>
>> Acked-by: Borislav Petkov <bp@amd64.org>
>> Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
> 
> Good, thanks. Just a minor nitpick below.
> 
>> ---
>>
>>  arch/x86/kernel/microcode_core.c |    8 +++++++-
>>  1 files changed, 7 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
>> index f924280..3fd0189 100644
>> --- a/arch/x86/kernel/microcode_core.c
>> +++ b/arch/x86/kernel/microcode_core.c
>> @@ -483,7 +483,13 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
>>  		sysfs_remove_group(&sys_dev->kobj, &mc_attr_group);
>>  		pr_debug("CPU%d removed\n", cpu);
>>  		break;
>> -	case CPU_DEAD:
>> +
>> +	/* When a CPU goes offline, don't free up or invalidate the copy of
>> +	 * the microcode in kernel memory, so that we can reuse it when the
>> +	 * CPU comes back online without unnecessarily requesting the userspace
>> +	 * for it again.
>> +	 */
>> +
> 
> Kernel comment style is in this format:
> 
> /*
>  * Blabla
>  * blublu
>  */
> 
Oh, ok.. Thank you for pointing it out.

> @Ingo, can you please adjust it in-flight when applying?

I'll post the patch with the correct comment style, if that would make
things easier.
-- 
Regards,
Srivatsa S. Bhat  <srivatsa.bhat@linux.vnet.ibm.com>
Linux Technology Center,
IBM India Systems and Technology Lab

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH RESEND] CPU hotplug,x86 Microcode: Don't request microcode from userspace unnecessarily
  2011-10-09 19:38   ` Srivatsa S. Bhat
@ 2011-10-09 19:42     ` Srivatsa S. Bhat
  2011-10-10 20:58       ` Rafael J. Wysocki
  2011-10-11  8:41       ` Andreas Herrmann
  0 siblings, 2 replies; 8+ messages in thread
From: Srivatsa S. Bhat @ 2011-10-09 19:42 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Borislav Petkov, Borislav Petkov, tigran@aivazian.fsnet.co.uk,
	tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com,
	x86@kernel.org, Herrmann3, Andreas, amd64-microcode@amd64.org,
	Rafael J. Wysocki, Tejun Heo, Linux PM mailing list, linux-kernel

Requesting the microcode from userspace *every time* when onlining CPUs
(during a CPU hotplug operation) is unnecessary.

So, this patch ensures that once the kernel gets the microcode after booting,
it is not freed nor invalidated when a CPU goes offline, so that it can be
reused when that CPU comes back online, without requesting userspace for it
again. As a result, the CPU hotplug operations become faster as well.

Tested-by: Borislav Petkov <bp@amd64.org>
Acked-by: Borislav Petkov <bp@amd64.org>

Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
---

 arch/x86/kernel/microcode_core.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
index f924280..33c8a67 100644
--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -483,7 +483,14 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
 		sysfs_remove_group(&sys_dev->kobj, &mc_attr_group);
 		pr_debug("CPU%d removed\n", cpu);
 		break;
-	case CPU_DEAD:
+
+	/*
+	 * When a CPU goes offline, don't free up or invalidate the copy of
+	 * the microcode in kernel memory, so that we can reuse it when the
+	 * CPU comes back online without unnecessarily requesting the userspace
+	 * for it again.
+	 */
+
 	case CPU_UP_CANCELED_FROZEN:
 		/* The CPU refused to come up during a system resume */
 		microcode_fini_cpu(cpu);



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH RESEND] CPU hotplug,x86 Microcode: Don't request microcode from userspace unnecessarily
  2011-10-09 19:42     ` [PATCH RESEND] " Srivatsa S. Bhat
@ 2011-10-10 20:58       ` Rafael J. Wysocki
  2011-10-10 21:13         ` Borislav Petkov
  2011-10-11  8:41       ` Andreas Herrmann
  1 sibling, 1 reply; 8+ messages in thread
From: Rafael J. Wysocki @ 2011-10-10 20:58 UTC (permalink / raw)
  To: Srivatsa S. Bhat
  Cc: Ingo Molnar, Borislav Petkov, Borislav Petkov,
	tigran@aivazian.fsnet.co.uk, tglx@linutronix.de, mingo@redhat.com,
	hpa@zytor.com, x86@kernel.org, Herrmann3, Andreas,
	amd64-microcode@amd64.org, Tejun Heo, Linux PM mailing list,
	linux-kernel

On Sunday, October 09, 2011, Srivatsa S. Bhat wrote:
> Requesting the microcode from userspace *every time* when onlining CPUs
> (during a CPU hotplug operation) is unnecessary.
> 
> So, this patch ensures that once the kernel gets the microcode after booting,
> it is not freed nor invalidated when a CPU goes offline, so that it can be
> reused when that CPU comes back online, without requesting userspace for it
> again. As a result, the CPU hotplug operations become faster as well.
> 
> Tested-by: Borislav Petkov <bp@amd64.org>
> Acked-by: Borislav Petkov <bp@amd64.org>
> 
> Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>

Fine by me.  I wonder who should take this?

Rafael


> ---
> 
>  arch/x86/kernel/microcode_core.c |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
> index f924280..33c8a67 100644
> --- a/arch/x86/kernel/microcode_core.c
> +++ b/arch/x86/kernel/microcode_core.c
> @@ -483,7 +483,14 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
>  		sysfs_remove_group(&sys_dev->kobj, &mc_attr_group);
>  		pr_debug("CPU%d removed\n", cpu);
>  		break;
> -	case CPU_DEAD:
> +
> +	/*
> +	 * When a CPU goes offline, don't free up or invalidate the copy of
> +	 * the microcode in kernel memory, so that we can reuse it when the
> +	 * CPU comes back online without unnecessarily requesting the userspace
> +	 * for it again.
> +	 */
> +
>  	case CPU_UP_CANCELED_FROZEN:
>  		/* The CPU refused to come up during a system resume */
>  		microcode_fini_cpu(cpu);
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RESEND] CPU hotplug,x86 Microcode: Don't request microcode from userspace unnecessarily
  2011-10-10 20:58       ` Rafael J. Wysocki
@ 2011-10-10 21:13         ` Borislav Petkov
  2011-10-10 21:18           ` Rafael J. Wysocki
  0 siblings, 1 reply; 8+ messages in thread
From: Borislav Petkov @ 2011-10-10 21:13 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Srivatsa S. Bhat, Ingo Molnar, Borislav Petkov,
	tigran@aivazian.fsnet.co.uk, tglx@linutronix.de, mingo@redhat.com,
	hpa@zytor.com, x86@kernel.org, Herrmann3, Andreas,
	amd64-microcode@amd64.org, Tejun Heo, Linux PM mailing list,
	linux-kernel

On Mon, Oct 10, 2011 at 04:58:02PM -0400, Rafael J. Wysocki wrote:
> On Sunday, October 09, 2011, Srivatsa S. Bhat wrote:
> > Requesting the microcode from userspace *every time* when onlining CPUs
> > (during a CPU hotplug operation) is unnecessary.
> > 
> > So, this patch ensures that once the kernel gets the microcode after booting,
> > it is not freed nor invalidated when a CPU goes offline, so that it can be
> > reused when that CPU comes back online, without requesting userspace for it
> > again. As a result, the CPU hotplug operations become faster as well.
> > 
> > Tested-by: Borislav Petkov <bp@amd64.org>
> > Acked-by: Borislav Petkov <bp@amd64.org>
> > 
> > Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
> 
> Fine by me.  I wonder who should take this?

Ingo, most probably. ucode stuff goes in through -tip.

-- 
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
GM: Alberto Bozzo
Reg: Dornach, Landkreis Muenchen
HRB Nr. 43632 WEEE Registernr: 129 19551

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RESEND] CPU hotplug,x86 Microcode: Don't request microcode from userspace unnecessarily
  2011-10-10 21:13         ` Borislav Petkov
@ 2011-10-10 21:18           ` Rafael J. Wysocki
  0 siblings, 0 replies; 8+ messages in thread
From: Rafael J. Wysocki @ 2011-10-10 21:18 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Srivatsa S. Bhat, Ingo Molnar, tigran@aivazian.fsnet.co.uk,
	tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com,
	x86@kernel.org, Herrmann3, Andreas, amd64-microcode@amd64.org,
	Tejun Heo, Linux PM mailing list, linux-kernel

On Monday, October 10, 2011, Borislav Petkov wrote:
> On Mon, Oct 10, 2011 at 04:58:02PM -0400, Rafael J. Wysocki wrote:
> > On Sunday, October 09, 2011, Srivatsa S. Bhat wrote:
> > > Requesting the microcode from userspace *every time* when onlining CPUs
> > > (during a CPU hotplug operation) is unnecessary.
> > > 
> > > So, this patch ensures that once the kernel gets the microcode after booting,
> > > it is not freed nor invalidated when a CPU goes offline, so that it can be
> > > reused when that CPU comes back online, without requesting userspace for it
> > > again. As a result, the CPU hotplug operations become faster as well.
> > > 
> > > Tested-by: Borislav Petkov <bp@amd64.org>
> > > Acked-by: Borislav Petkov <bp@amd64.org>
> > > 
> > > Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
> > 
> > Fine by me.  I wonder who should take this?
> 
> Ingo, most probably. ucode stuff goes in through -tip.

OK, so

Acked-by: Rafael J. Wysocki <rjw@sisk.pl>

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH RESEND] CPU hotplug,x86 Microcode: Don't request microcode from userspace unnecessarily
  2011-10-09 19:42     ` [PATCH RESEND] " Srivatsa S. Bhat
  2011-10-10 20:58       ` Rafael J. Wysocki
@ 2011-10-11  8:41       ` Andreas Herrmann
  1 sibling, 0 replies; 8+ messages in thread
From: Andreas Herrmann @ 2011-10-11  8:41 UTC (permalink / raw)
  To: Srivatsa S. Bhat
  Cc: Ingo Molnar, Petkov, Borislav, Borislav Petkov,
	tigran@aivazian.fsnet.co.uk, tglx@linutronix.de, mingo@redhat.com,
	hpa@zytor.com, x86@kernel.org, amd64-microcode@amd64.org,
	Rafael J. Wysocki, Tejun Heo, Linux PM mailing list, linux-kernel

On Sun, Oct 09, 2011 at 03:42:00PM -0400, Srivatsa S. Bhat wrote:
> Requesting the microcode from userspace *every time* when onlining CPUs
> (during a CPU hotplug operation) is unnecessary.
> 
> So, this patch ensures that once the kernel gets the microcode after booting,
> it is not freed nor invalidated when a CPU goes offline, so that it can be
> reused when that CPU comes back online, without requesting userspace for it
> again. As a result, the CPU hotplug operations become faster as well.
> 
> Tested-by: Borislav Petkov <bp@amd64.org>
> Acked-by: Borislav Petkov <bp@amd64.org>
> 
> Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>

Acked-by: Andreas Herrmann <andreas.herrmann3@amd.com>


Thanks,

Andreas

>  arch/x86/kernel/microcode_core.c |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
> index f924280..33c8a67 100644
> --- a/arch/x86/kernel/microcode_core.c
> +++ b/arch/x86/kernel/microcode_core.c
> @@ -483,7 +483,14 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
>  		sysfs_remove_group(&sys_dev->kobj, &mc_attr_group);
>  		pr_debug("CPU%d removed\n", cpu);
>  		break;
> -	case CPU_DEAD:
> +
> +	/*
> +	 * When a CPU goes offline, don't free up or invalidate the copy of
> +	 * the microcode in kernel memory, so that we can reuse it when the
> +	 * CPU comes back online without unnecessarily requesting the userspace
> +	 * for it again.
> +	 */
> +
>  	case CPU_UP_CANCELED_FROZEN:
>  		/* The CPU refused to come up during a system resume */
>  		microcode_fini_cpu(cpu);
> 
> 
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-10-11  8:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-08 20:47 [PATCH] CPU hotplug,x86 Microcode: Don't request microcode from userspace unnecessarily Srivatsa S. Bhat
2011-10-09 11:27 ` Borislav Petkov
2011-10-09 19:38   ` Srivatsa S. Bhat
2011-10-09 19:42     ` [PATCH RESEND] " Srivatsa S. Bhat
2011-10-10 20:58       ` Rafael J. Wysocki
2011-10-10 21:13         ` Borislav Petkov
2011-10-10 21:18           ` Rafael J. Wysocki
2011-10-11  8:41       ` Andreas Herrmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox