public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 0/2] x86: microcode patch loader cleanup and fix
@ 2008-08-01 10:46 Peter Oruba
  2008-08-01 10:46 ` [patch 1/2] [PATCH 1/2] x86: Microcode patch loader style corrections Peter Oruba
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Peter Oruba @ 2008-08-01 10:46 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, Tigran Aivazian; +Cc: H. Peter Anvin, LKML

This patch set cleans up vendor independent microcode loading module and corrects one misbehaviour
in AMD specific module.

Thanks,
Peter





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

* [patch 1/2] [PATCH 1/2] x86: Microcode patch loader style corrections
  2008-08-01 10:46 [patch 0/2] x86: microcode patch loader cleanup and fix Peter Oruba
@ 2008-08-01 10:46 ` Peter Oruba
  2008-08-14  2:03   ` Andrew Morton
  2008-08-01 10:46 ` [patch 2/2] [PATCH 2/2] x86: Fixed NULL function pointer dereference in AMD microcode patch loader Peter Oruba
  2008-08-15 15:19 ` [patch 0/2] x86: microcode patch loader cleanup and fix Ingo Molnar
  2 siblings, 1 reply; 7+ messages in thread
From: Peter Oruba @ 2008-08-01 10:46 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, Tigran Aivazian
  Cc: H. Peter Anvin, LKML, Peter Oruba

[-- Attachment #1: 0001-x86-Microcode-patch-loader-style-corrections.patch --]
[-- Type: text/plain, Size: 3066 bytes --]

Style corrections to main microcode module.

Signed-off-by: Peter Oruba <peter.oruba@amd.com>
---
 arch/x86/kernel/microcode.c |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/arch/x86/kernel/microcode.c b/arch/x86/kernel/microcode.c
index 28dba1a..39961bb 100644
--- a/arch/x86/kernel/microcode.c
+++ b/arch/x86/kernel/microcode.c
@@ -55,8 +55,8 @@
  *		in a single CPU package.
  *	1.10	28 Feb 2002 Asit K Mallick <asit.k.mallick@intel.com> and
  *		Tigran Aivazian <tigran@veritas.com>,
- *		Serialize updates as required on HT processors due to speculative
- *		nature of implementation.
+ *		Serialize updates as required on HT processors due to
+ *		speculative nature of implementation.
  *	1.11	22 Mar 2002 Tigran Aivazian <tigran@veritas.com>
  *		Fix the panic when writing zero-length microcode chunk.
  *	1.12	29 Sep 2003 Nitin Kamble <nitin.a.kamble@intel.com>,
@@ -71,7 +71,7 @@
  *		Thanks to Stuart Swales for pointing out this bug.
  */
 
-//#define DEBUG /* pr_debug */
+/*#define DEBUG pr_debug */
 #include <linux/capability.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -116,7 +116,7 @@ EXPORT_SYMBOL_GPL(user_buffer);
 unsigned int user_buffer_size;		/* it's size */
 EXPORT_SYMBOL_GPL(user_buffer_size);
 
-static int do_microcode_update (void)
+static int do_microcode_update(void)
 {
 	long cursor = 0;
 	int error = 0;
@@ -158,18 +158,20 @@ out:
 	return error;
 }
 
-static int microcode_open (struct inode *unused1, struct file *unused2)
+static int microcode_open(struct inode *unused1, struct file *unused2)
 {
 	cycle_kernel_lock();
 	return capable(CAP_SYS_RAWIO) ? 0 : -EPERM;
 }
 
-static ssize_t microcode_write (struct file *file, const char __user *buf, size_t len, loff_t *ppos)
+static ssize_t microcode_write(struct file *file, const char __user *buf,
+			       size_t len, loff_t *ppos)
 {
 	ssize_t ret;
 
 	if ((len >> PAGE_SHIFT) > num_physpages) {
-		printk(KERN_ERR "microcode: too much data (max %ld pages)\n", num_physpages);
+		printk(KERN_ERR "microcode: too much data (max %ld pages)\n",
+		       num_physpages);
 		return -EINVAL;
 	}
 
@@ -201,7 +203,7 @@ static struct miscdevice microcode_dev = {
 	.fops		= &microcode_fops,
 };
 
-static int __init microcode_dev_init (void)
+static int __init microcode_dev_init(void)
 {
 	int error;
 
@@ -216,7 +218,7 @@ static int __init microcode_dev_init (void)
 	return 0;
 }
 
-static void microcode_dev_exit (void)
+static void microcode_dev_exit(void)
 {
 	misc_deregister(&microcode_dev);
 }
@@ -224,7 +226,7 @@ static void microcode_dev_exit (void)
 MODULE_ALIAS_MISCDEV(MICROCODE_MINOR);
 #else
 #define microcode_dev_init() 0
-#define microcode_dev_exit() do { } while(0)
+#define microcode_dev_exit() do { } while (0)
 #endif
 
 /* fake device for request_firmware */
@@ -451,7 +453,7 @@ int microcode_init(void *opaque, struct module *module)
 }
 EXPORT_SYMBOL_GPL(microcode_init);
 
-void __exit microcode_exit (void)
+void __exit microcode_exit(void)
 {
 	microcode_dev_exit();
 
-- 
1.5.4.5





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

* [patch 2/2] [PATCH 2/2] x86: Fixed NULL function pointer dereference in AMD microcode patch loader.
  2008-08-01 10:46 [patch 0/2] x86: microcode patch loader cleanup and fix Peter Oruba
  2008-08-01 10:46 ` [patch 1/2] [PATCH 1/2] x86: Microcode patch loader style corrections Peter Oruba
@ 2008-08-01 10:46 ` Peter Oruba
  2008-08-14  2:05   ` Andrew Morton
  2008-08-15 15:19 ` [patch 0/2] x86: microcode patch loader cleanup and fix Ingo Molnar
  2 siblings, 1 reply; 7+ messages in thread
From: Peter Oruba @ 2008-08-01 10:46 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, Tigran Aivazian
  Cc: H. Peter Anvin, LKML, Peter Oruba

[-- Attachment #1: 0002-x86-Fixed-NULL-function-pointer-dereference-in-AMD.patch --]
[-- Type: text/plain, Size: 820 bytes --]

Dereference took place in code part responsible for manual installation
of microcode patches through /dev/cpu/microcode.

Signed-off-by: Peter Oruba <peter.oruba@amd.com>
---
 arch/x86/kernel/microcode.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/microcode.c b/arch/x86/kernel/microcode.c
index 39961bb..ad136ad 100644
--- a/arch/x86/kernel/microcode.c
+++ b/arch/x86/kernel/microcode.c
@@ -127,7 +127,8 @@ static int do_microcode_update(void)
 	old = current->cpus_allowed;
 
 	while ((cursor = microcode_ops->get_next_ucode(&new_mc, cursor)) > 0) {
-		error = microcode_ops->microcode_sanity_check(new_mc);
+		if (microcode_ops->microcode_sanity_check != NULL)
+			error = microcode_ops->microcode_sanity_check(new_mc);
 		if (error)
 			goto out;
 		/*
-- 
1.5.4.5





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

* Re: [patch 1/2] [PATCH 1/2] x86: Microcode patch loader style corrections
  2008-08-01 10:46 ` [patch 1/2] [PATCH 1/2] x86: Microcode patch loader style corrections Peter Oruba
@ 2008-08-14  2:03   ` Andrew Morton
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Morton @ 2008-08-14  2:03 UTC (permalink / raw)
  To: Peter Oruba
  Cc: Ingo Molnar, Thomas Gleixner, Tigran Aivazian, H. Peter Anvin,
	LKML

On Fri, 1 Aug 2008 12:46:45 +0200 Peter Oruba <peter.oruba@amd.com> wrote:

> Style corrections to main microcode module.

Needed a few fixups to apply against linux-next.

While we're there, let's spell "matching" correctly.

--- a/arch/x86/kernel/microcode.c~x86-microcode-patch-loader-style-corrections-fix
+++ a/arch/x86/kernel/microcode.c
@@ -264,7 +264,7 @@ static int microcode_sanity_check(void *
  * return 1 - found update
  * return < 0 - error
  */
-static int get_maching_microcode(void *mc, int cpu)
+static int get_matching_microcode(void *mc, int cpu)
 {
 	struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
 	microcode_header_t *mc_header = mc;
@@ -405,7 +405,7 @@ static int do_microcode_update(void)
 			if (!uci->valid)
 				continue;
 			set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
-			error = get_maching_microcode(new_mc, cpu);
+			error = get_matching_microcode(new_mc, cpu);
 			if (error < 0)
 				goto out;
 			if (error == 1)
@@ -549,7 +549,7 @@ static int cpu_request_microcode(int cpu
 		error = microcode_sanity_check(mc);
 		if (error)
 			break;
-		error = get_maching_microcode(mc, cpu);
+		error = get_matching_microcode(mc, cpu);
 		if (error < 0)
 			break;
 		/*
_


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

* Re: [patch 2/2] [PATCH 2/2] x86: Fixed NULL function pointer dereference in AMD microcode patch loader.
  2008-08-01 10:46 ` [patch 2/2] [PATCH 2/2] x86: Fixed NULL function pointer dereference in AMD microcode patch loader Peter Oruba
@ 2008-08-14  2:05   ` Andrew Morton
  2008-08-14 11:55     ` Peter Oruba
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2008-08-14  2:05 UTC (permalink / raw)
  To: Peter Oruba
  Cc: Ingo Molnar, Thomas Gleixner, Tigran Aivazian, H. Peter Anvin,
	LKML, stable

On Fri, 1 Aug 2008 12:46:46 +0200 Peter Oruba <peter.oruba@amd.com> wrote:

> Dereference took place in code part responsible for manual installation
> of microcode patches through /dev/cpu/microcode.
> 

That's a bit too terse.

> ---
>  arch/x86/kernel/microcode.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kernel/microcode.c b/arch/x86/kernel/microcode.c
> index 39961bb..ad136ad 100644
> --- a/arch/x86/kernel/microcode.c
> +++ b/arch/x86/kernel/microcode.c
> @@ -127,7 +127,8 @@ static int do_microcode_update(void)
>  	old = current->cpus_allowed;
>  
>  	while ((cursor = microcode_ops->get_next_ucode(&new_mc, cursor)) > 0) {
> -		error = microcode_ops->microcode_sanity_check(new_mc);
> +		if (microcode_ops->microcode_sanity_check != NULL)
> +			error = microcode_ops->microcode_sanity_check(new_mc);
>  		if (error)
>  			goto out;
>  		/*

The patch is no longer applicable to current sources.

If the bug is sufficiently serious to warrant fixing in 2.6.25.x and in
2.6.26.x then please prepare patches against those kernels, including
sufficient description to enable the -stable maintainers to understand
why they need to merge it.  Cc those patches to stable@kernel.org.

Thanks.


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

* Re: [patch 2/2] [PATCH 2/2] x86: Fixed NULL function pointer dereference in AMD microcode patch loader.
  2008-08-14  2:05   ` Andrew Morton
@ 2008-08-14 11:55     ` Peter Oruba
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Oruba @ 2008-08-14 11:55 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Ingo Molnar, Thomas Gleixner, Tigran Aivazian, H. Peter Anvin,
	LKML, stable

Andrew,

that patch is only relevant in combination with the AMD microcode patch loader.

Thanks,
Peter

Andrew Morton schrieb:
> On Fri, 1 Aug 2008 12:46:46 +0200 Peter Oruba <peter.oruba@amd.com> wrote:
> 
>> Dereference took place in code part responsible for manual installation
>> of microcode patches through /dev/cpu/microcode.
>>
> 
> That's a bit too terse.
> 
>> ---
>>  arch/x86/kernel/microcode.c |    3 ++-
>>  1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/x86/kernel/microcode.c b/arch/x86/kernel/microcode.c
>> index 39961bb..ad136ad 100644
>> --- a/arch/x86/kernel/microcode.c
>> +++ b/arch/x86/kernel/microcode.c
>> @@ -127,7 +127,8 @@ static int do_microcode_update(void)
>>  	old = current->cpus_allowed;
>>  
>>  	while ((cursor = microcode_ops->get_next_ucode(&new_mc, cursor)) > 0) {
>> -		error = microcode_ops->microcode_sanity_check(new_mc);
>> +		if (microcode_ops->microcode_sanity_check != NULL)
>> +			error = microcode_ops->microcode_sanity_check(new_mc);
>>  		if (error)
>>  			goto out;
>>  		/*
> 
> The patch is no longer applicable to current sources.
> 
> If the bug is sufficiently serious to warrant fixing in 2.6.25.x and in
> 2.6.26.x then please prepare patches against those kernels, including
> sufficient description to enable the -stable maintainers to understand
> why they need to merge it.  Cc those patches to stable@kernel.org.
> 
> Thanks.
> 
> 
> 

-- 
            |           AMD Saxony Limited Liability Company & Co. KG
  Operating |         Wilschdorfer Landstr. 101, 01109 Dresden, Germany
  System    |                  Register Court Dresden: HRA 4896
  Research  |              General Partner authorized to represent:
  Center    |             AMD Saxony LLC (Wilmington, Delaware, US)
            | General Manager of AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy


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

* Re: [patch 0/2] x86: microcode patch loader cleanup and fix
  2008-08-01 10:46 [patch 0/2] x86: microcode patch loader cleanup and fix Peter Oruba
  2008-08-01 10:46 ` [patch 1/2] [PATCH 1/2] x86: Microcode patch loader style corrections Peter Oruba
  2008-08-01 10:46 ` [patch 2/2] [PATCH 2/2] x86: Fixed NULL function pointer dereference in AMD microcode patch loader Peter Oruba
@ 2008-08-15 15:19 ` Ingo Molnar
  2 siblings, 0 replies; 7+ messages in thread
From: Ingo Molnar @ 2008-08-15 15:19 UTC (permalink / raw)
  To: Peter Oruba
  Cc: Thomas Gleixner, Tigran Aivazian, H. Peter Anvin, LKML,
	Andrew Morton


* Peter Oruba <peter.oruba@amd.com> wrote:

> This patch set cleans up vendor independent microcode loading module 
> and corrects one misbehaviour in AMD specific module.

applied to tip/x86/microcode - thanks Peter.

	Ingo

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

end of thread, other threads:[~2008-08-15 15:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-01 10:46 [patch 0/2] x86: microcode patch loader cleanup and fix Peter Oruba
2008-08-01 10:46 ` [patch 1/2] [PATCH 1/2] x86: Microcode patch loader style corrections Peter Oruba
2008-08-14  2:03   ` Andrew Morton
2008-08-01 10:46 ` [patch 2/2] [PATCH 2/2] x86: Fixed NULL function pointer dereference in AMD microcode patch loader Peter Oruba
2008-08-14  2:05   ` Andrew Morton
2008-08-14 11:55     ` Peter Oruba
2008-08-15 15:19 ` [patch 0/2] x86: microcode patch loader cleanup and fix Ingo Molnar

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