Bug 246271 - Bug Testing: Testing Mirroring
Bug Testing: Testing Mirroring
Status: CLOSED NOTABUG
Product: Bugzilla
Classification: Community
Component: Test (Show other bugs)
2.8
ppc64 Linux
low Severity urgent (vote)
: ---
: ---
Assigned To: PnT DevOps Devs
:
: 246278 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-06-29 14:30 EDT by IBM Mirproxy
Modified: 2013-06-23 22:48 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-08-08 15:00:16 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Test_patch (6.35 KB, patch)
2007-06-29 14:30 EDT, IBM Mirproxy
no flags Details | Diff
A_new_test (425.66 KB, application/octet-stream; charset=ISO-8859-1)
2007-06-29 14:50 EDT, IBM Mirproxy
no flags Details
kernel.org patch comming from rh, post mirror, post dup (6.35 KB, patch)
2007-06-29 15:37 EDT, IBM Bug Proxy
no flags Details | Diff
patch_from_kernel.org_-_post_mirror,_post_dup (6.35 KB, application/octet-stream; charset=ISO-8859-1)
2007-06-29 15:40 EDT, IBM Mirproxy
no flags Details
Test_patch_from_kernel.org (6.35 KB, application/octet-stream; charset=ISO-8859-1)
2007-06-29 15:41 EDT, IBM Mirproxy
no flags Details
just_something_to_see_if_the_other_one_wrongly_mirrored (57 bytes, application/octet-stream; charset=ISO-8859-1)
2007-06-29 17:26 EDT, IBM Mirproxy
no flags Details
something_not_worth_looking_at (7 bytes, application/octet-stream; charset=ISO-8859-1)
2007-06-29 17:26 EDT, IBM Mirproxy
no flags Details
Test_patch2 (6.55 KB, patch)
2007-07-11 10:16 EDT, Jeremy Scherer
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
IBM Linux Technology Center 29864 None None None Never

  None (edit)
Description IBM Mirproxy 2007-06-29 14:30:32 EDT
=Comment: #0=================================================
Antonio A. Rosales <rosalesa@us.ibm.com> - 2007-06-29 14:04 EDT
---Initial Test Plan---
1. Check initial mirror
2. check attachment mirroring
3. Check duplication mirroring
4. Check reverse mirroring.
=Comment: #1=================================================
Antonio A. Rosales <rosalesa@us.ibm.com> - 2007-06-29 14:05 EDT
Please mirror this critical bug.

=Comment: #2=================================================
Antonio A. Rosales <rosalesa@us.ibm.com> - 2007-06-29 14:13 EDT
========================================================================
Does this obscene patch from the community kernel get mirror correctly?
========================================================================

Link:
<a
href="http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=455c017ae3934797653549704c286e7bcc3a9397#patch2">http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=455c017ae3934797653549704c286e7bcc3a9397#patch2</a>

From: Rafael J. Wysocki <<a href="mailto:rjw@sisk.pl">rjw@sisk.pl</a>>
Date: Wed, 9 May 2007 09:35:11 +0000 (-0700)
Subject: microcode: use suspend-related CPU hotplug notifications
X-Git-Tag: v2.6.22-rc1~176
X-Git-Url:
<a
href="http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=455c017ae3934797653549704c286e7bcc3a9397">http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=455c017ae3934797653549704c286e7bcc3a9397</a>

microcode: use suspend-related CPU hotplug notifications

Make the microcode driver use the suspend-related CPU hotplug notifications
to handle the CPU hotplug events occuring during system-wide suspend and
resume transitions.  Remove the global variable suspend_cpu_hotplug
previously used for this purpose.

Signed-off-by: Rafael J. Wysocki <<a href="mailto:rjw@sisk.pl">rjw@sisk.pl</a>>
Cc: Gautham R Shenoy <<a href="mailto:ego@in.ibm.com">ego@in.ibm.com</a>>
Cc: Pavel Machek <<a href="mailto:pavel@ucw.cz">pavel@ucw.cz</a>>
Signed-off-by: Andrew Morton <<a href="mailto:akpm@linux-foundation.org">akpm@linux-foundation.org</a>>
Signed-off-by: Linus Torvalds <<a
href="mailto:torvalds@linux-foundation.org">torvalds@linux-foundation.org</a>>
---

diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c
index 7d934e4..83f825f 100644
--- a/arch/i386/kernel/microcode.c
+++ b/arch/i386/kernel/microcode.c
@@ -567,7 +567,7 @@ static int cpu_request_microcode(int cpu)
 	return error;
 }
 
-static int apply_microcode_on_cpu(int cpu)
+static int apply_microcode_check_cpu(int cpu)
 {
 	struct cpuinfo_x86 *c = cpu_data + cpu;
 	struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
@@ -575,8 +575,9 @@ static int apply_microcode_on_cpu(int cpu)
 	unsigned int val[2];
 	int err = 0;
 
+	/* Check if the microcode is available */
 	if (!uci->mc)
-		return -EINVAL;
+		return 0;
 
 	old = current->cpus_allowed;
 	set_cpus_allowed(current, cpumask_of_cpu(cpu));
@@ -614,7 +615,7 @@ static int apply_microcode_on_cpu(int cpu)
 	return err;
 }
 
-static void microcode_init_cpu(int cpu)
+static void microcode_init_cpu(int cpu, int resume)
 {
 	cpumask_t old;
 	struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
@@ -624,8 +625,7 @@ static void microcode_init_cpu(int cpu)
 	set_cpus_allowed(current, cpumask_of_cpu(cpu));
 	mutex_lock(&microcode_mutex);
 	collect_cpu_info(cpu);
-	if (uci->valid && system_state == SYSTEM_RUNNING &&
-	    !suspend_cpu_hotplug)
+	if (uci->valid && system_state == SYSTEM_RUNNING && !resume)
 		cpu_request_microcode(cpu);
 	mutex_unlock(&microcode_mutex);
 	set_cpus_allowed(current, old);
@@ -702,7 +702,7 @@ static struct attribute_group mc_attr_group = {
 	.name = "microcode",
 };
 
-static int mc_sysdev_add(struct sys_device *sys_dev)
+static int __mc_sysdev_add(struct sys_device *sys_dev, int resume)
 {
 	int err, cpu = sys_dev->id;
 	struct ucode_cpu_info *uci = ucode_cpu_info + cpu;
@@ -711,39 +711,31 @@ static int mc_sysdev_add(struct sys_device *sys_dev)
 		return 0;
 
 	pr_debug("Microcode:CPU %d added\n", cpu);
-	/* If suspend_cpu_hotplug is set, the system is resuming and we should
-	 * use the data from before the suspend.
-	 */
-	if (suspend_cpu_hotplug) {
-		err = apply_microcode_on_cpu(cpu);
-		if (err)
-			microcode_fini_cpu(cpu);
-	}
-	if (!uci->valid)
-		memset(uci, 0, sizeof(*uci));
+	memset(uci, 0, sizeof(*uci));
 
 	err = sysfs_create_group(&sys_dev->kobj, &mc_attr_group);
 	if (err)
 		return err;
 
-	if (!uci->valid)
-		microcode_init_cpu(cpu);
+	microcode_init_cpu(cpu, resume);
 
 	return 0;
 }
 
+static int mc_sysdev_add(struct sys_device *sys_dev)
+{
+	return __mc_sysdev_add(sys_dev, 0);
+}
+
 static int mc_sysdev_remove(struct sys_device *sys_dev)
 {
 	int cpu = sys_dev->id;
 
 	if (!cpu_online(cpu))
 		return 0;
+
 	pr_debug("Microcode:CPU %d removed\n", cpu);
-	/* If suspend_cpu_hotplug is set, the system is suspending and we should
-	 * keep the microcode in memory for the resume.
-	 */
-	if (!suspend_cpu_hotplug)
-		microcode_fini_cpu(cpu);
+	microcode_fini_cpu(cpu);
 	sysfs_remove_group(&sys_dev->kobj, &mc_attr_group);
 	return 0;
 }
@@ -774,16 +766,34 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long
action, void *hcpu)
 
 	sys_dev = get_cpu_sysdev(cpu);
 	switch (action) {
+	case CPU_UP_CANCELED_FROZEN:
+		/* The CPU refused to come up during a system resume */
+		microcode_fini_cpu(cpu);
+		break;
 	case CPU_ONLINE:
-	case CPU_ONLINE_FROZEN:
 	case CPU_DOWN_FAILED:
-	case CPU_DOWN_FAILED_FROZEN:
 		mc_sysdev_add(sys_dev);
 		break;
+	case CPU_ONLINE_FROZEN:
+		/* System-wide resume is in progress, try to apply microcode */
+		if (apply_microcode_check_cpu(cpu)) {
+			/* The application of microcode failed */
+			microcode_fini_cpu(cpu);
+			__mc_sysdev_add(sys_dev, 1);
+			break;
+		}
+	case CPU_DOWN_FAILED_FROZEN:
+		if (sysfs_create_group(&sys_dev->kobj, &mc_attr_group))
+			printk(KERN_ERR "Microcode: Failed to create the sysfs "
+				"group for CPU%d\n", cpu);
+		break;
 	case CPU_DOWN_PREPARE:
-	case CPU_DOWN_PREPARE_FROZEN:
 		mc_sysdev_remove(sys_dev);
 		break;
+	case CPU_DOWN_PREPARE_FROZEN:
+		/* Suspend is in progress, only remove the interface */
+		sysfs_remove_group(&sys_dev->kobj, &mc_attr_group);
+		break;
 	}
 	return NOTIFY_OK;
 }
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 369d289..208cf34 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -262,12 +262,6 @@ int __cpuinit cpu_up(unsigned int cpu)
 }
 
 #ifdef CONFIG_SUSPEND_SMP
-/* Needed to prevent the microcode driver from requesting firmware in its CPU
- * hotplug notifier during the suspend/resume.
- */
-int suspend_cpu_hotplug;
-EXPORT_SYMBOL(suspend_cpu_hotplug);
-
 static cpumask_t frozen_cpus;
 
 int disable_nonboot_cpus(void)
@@ -275,7 +269,6 @@ int disable_nonboot_cpus(void)
 	int cpu, first_cpu, error = 0;
 
 	mutex_lock(&cpu_add_remove_lock);
-	suspend_cpu_hotplug = 1;
 	first_cpu = first_cpu(cpu_online_map);
 	/* We take down all of the non-boot CPUs in one shot to avoid races
 	 * with the userspace trying to use the CPU hotplug at the same time
@@ -302,7 +295,6 @@ int disable_nonboot_cpus(void)
 	} else {
 		printk(KERN_ERR "Non-boot CPUs are not disabled\n");
 	}
-	suspend_cpu_hotplug = 0;
 	mutex_unlock(&cpu_add_remove_lock);
 	return error;
 }
@@ -317,7 +309,6 @@ void enable_nonboot_cpus(void)
 	if (cpus_empty(frozen_cpus))
 		goto out;
 
-	suspend_cpu_hotplug = 1;
 	printk("Enabling non-boot CPUs ...\n");
 	for_each_cpu_mask(cpu, frozen_cpus) {
 		error = _cpu_up(cpu, 1);
@@ -328,7 +319,6 @@ void enable_nonboot_cpus(void)
 		printk(KERN_WARNING "Error taking CPU%d up: %d\n", cpu, error);
 	}
 	cpus_clear(frozen_cpus);
-	suspend_cpu_hotplug = 0;
 out:
 	mutex_unlock(&cpu_add_remove_lock);
 }

=Comment: #3=================================================
Antonio A. Rosales <rosalesa@us.ibm.com> - 2007-06-29 14:16 EDT
<a href="attachment.cgi?id=22611" class="" title="Test patch">Created an attachment (id=22611)</a>
[<a href="attachment.cgi?id=22611&action=edit">edit</a>]
Test patch

Testing patch mirroring
Comment 1 IBM Mirproxy 2007-06-29 14:30:45 EDT
Created attachment 158243 [details]
Test_patch
Comment 2 IBM Mirproxy 2007-06-29 14:50:42 EDT
------- Comment From brenohl@br.ibm.com 2007-06-29 14:46 EDT-------
Created an attachment (id=22614)
A new test

this comment must be mirrored.
Comment 3 IBM Mirproxy 2007-06-29 14:50:49 EDT
Created attachment 158245 [details]
A_new_test
Comment 4 IBM Bug Proxy 2007-06-29 15:32:32 EDT
*** Bug 246278 has been marked as a duplicate of this bug. ***
Comment 5 IBM Bug Proxy 2007-06-29 15:37:16 EDT
Created attachment 158250 [details]
kernel.org patch comming from rh, post mirror, post dup

This patch should go to ltc 29864 and 29866.
Comment 6 IBM Bug Proxy 2007-06-29 15:38:27 EDT
Where will this comment go.
from RH 24627 post dup
Comment 7 IBM Mirproxy 2007-06-29 15:40:53 EDT
Antonio A. Rosales <rosalesa@us.ibm.com> - 2007-06-29 15:21 EDT
***Clone Comments***
***End Clone Comments***
Antonio A. Rosales <rosalesa@us.ibm.com> - 2007-06-29 15:21 EDT
<a href="attachment.cgi?id=22619" class="" title="Test patch from kernel.org">Created an attachment
(id=22619)</a> [<a href="attachment.cgi?id=22619&action=edit">edit</a>]
Test patch from kernel.org

Type=patch.
Patch created before mirroring.
Created an attachment (id=158249)
Test_patch_from_kernel.org

*** This bug has been marked as a duplicate of 246271 ***

------- Comment From rosalesa@us.ibm.com 2007-06-29 15:36 EDT-------
Created an attachment (id=22620)
patch from kernel.org - post mirror, post dup

Where will this patch end up? Hopefully in RH 246271, and will it be intact?

------- Comment From rosalesa@us.ibm.com 2007-06-29 15:39 EDT-------
Where will this comment go?
from LTC 29866
Comment 8 IBM Mirproxy 2007-06-29 15:40:58 EDT
Created attachment 158251 [details]
patch_from_kernel.org_-_post_mirror,_post_dup
Comment 9 IBM Mirproxy 2007-06-29 15:41:01 EDT
Created attachment 158252 [details]
Test_patch_from_kernel.org
Comment 10 IBM Mirproxy 2007-06-29 15:46:52 EDT
------- Comment From rosalesa@us.ibm.com 2007-06-29 15:40 EDT-------
from LtC bug 29864
Comment 11 IBM Mirproxy 2007-06-29 17:26:20 EDT
Created attachment 22621


Created an attachment (id=22622)
Test_patch_from_kernel.org

Created an attachment (id=22623)
test.patch

------- Comment From mranweil@us.ibm.com 2007-06-29 17:22 EDT-------
Created an attachment (id=22629)
just something to see if the other one wrongly mirrored

random text
Comment 12 IBM Mirproxy 2007-06-29 17:26:25 EDT
Created attachment 158267 [details]
just_something_to_see_if_the_other_one_wrongly_mirrored
Comment 13 IBM Mirproxy 2007-06-29 17:26:28 EDT
Created attachment 158268 [details]
something_not_worth_looking_at
Comment 14 Jeremy Scherer 2007-07-10 12:28:25 EDT
where will this comment go?
Comment 15 Jeremy Scherer 2007-07-11 10:16:13 EDT
Created attachment 158951 [details]
Test_patch2

Checking to see what auto-detect does without me clicking "patch"
Comment 16 David Lawrence 2007-08-08 15:00:16 EDT
Closing as NOTABUG. Please reopen if you feel this was in error.

Dave

Note You need to log in before you can comment on or make changes to this bug.