Skip to contentSkip to conversation

Fix CONFIG_PARAVIRT for 2.6.19-rc5-mm1

PATCH In review Rusty Russell 4 participants 11 messages Nov 9, 2006 – Nov 11, 2006 virtio core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix CONFIG_PARAVIRT for 2.6.19-rc5-mm1

OK, at least two patches got dropped on the way from the mm tree to Andi's tree: the desc.h cleanup, and the processor.h rearrangement. Merging into Andi's tree without these patches must have been a nightmare 8(

Andi then tried to fix it with x86_64-mm-paravirt-compile.patch but then it didn't boot so he disabled it in x86_64-mm-paravirt-broken.patch

This patch undoes those two patches and rearranges processor.h correctly so the kernel compiles and boots with CONFIG_PARAVIRT. Andi's "paravirt-compile" patch also cleans up the spinlock header, which is good but should probably be patched separately.

arch/i386/Kconfig +0 -2
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/dontdiff --minimal linux-2.6.19-rc5-mm1/arch/i386/Kconfig working-2.6.19-rc5-mm1-paravirt/arch/i386/Kconfig
@@ -204,8 +204,6 @@ endchoice
 config PARAVIRT
 	bool "Paravirtualization support (EXPERIMENTAL)"
 	depends on EXPERIMENTAL
-	# doesn't compile right now
-	depends on BROKEN
 	help
 	  Paravirtualization is a way of running multiple instances of
 	  Linux on the same machine, under a hypervisor.  This option
include/asm-i386/desc.h +21 -20

62 lines not on this page · raw message

include/asm-i386/paravirt.h +6 -10
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/dontdiff --minimal linux-2.6.19-rc5-mm1/include/asm-i386/paravirt.h working-2.6.19-rc5-mm1-paravirt/include/asm-i386/paravirt.h
@@ -449,20 +449,16 @@ static inline unsigned long __raw_local_
 	return f;
 }
 
-#define CLI_STRING paravirt_alt("pushl %%ecx; pushl %%edx;"		\
-		     "call *paravirt_ops+%c[irq_disable];"		\
-		     "popl %%edx; popl %%ecx",				\
+#define CLI_STRING paravirt_alt("pushl %ecx; pushl %edx;"		\
+		     "call *paravirt_ops+PARAVIRT_irq_disable;"		\
+		     "popl %edx; popl %ecx",				\
 		     PARAVIRT_IRQ_DISABLE, CLBR_EAX)
 
-#define STI_STRING paravirt_alt("pushl %%ecx; pushl %%edx;"		\
-		     "call *paravirt_ops+%c[irq_enable];"		\
-		     "popl %%edx; popl %%ecx",				\
+#define STI_STRING paravirt_alt("pushl %ecx; pushl %edx;"		\
+		     "call *paravirt_ops+PARAVIRT_irq_enable;"		\
+		     "popl %edx; popl %ecx",				\
 		     PARAVIRT_IRQ_ENABLE, CLBR_EAX)
 #define CLI_STI_CLOBBERS , "%eax"
-#define CLI_STI_INPUT_ARGS \
-	,								\
-	[irq_disable] "i" (offsetof(struct paravirt_ops, irq_disable)),	\
-	[irq_enable] "i" (offsetof(struct paravirt_ops, irq_enable))
 
 #else  /* __ASSEMBLY__ */
 
include/asm-i386/processor.h +99 -103

232 lines not on this page · raw message

include/asm-i386/spinlock.h +6 -8
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/dontdiff --minimal linux-2.6.19-rc5-mm1/include/asm-i386/spinlock.h working-2.6.19-rc5-mm1-paravirt/include/asm-i386/spinlock.h
@@ -13,7 +13,6 @@
 #define CLI_STRING	"cli"
 #define STI_STRING	"sti"
 #define CLI_STI_CLOBBERS
-#define CLI_STI_INPUT_ARGS
 #endif /* CONFIG_PARAVIRT */
 
 /*
@@ -59,27 +58,26 @@ static inline void __raw_spin_lock_flags
 {
 	asm volatile(
 		"\n1:\t"
-		LOCK_PREFIX " ; decb %[slock]\n\t"
+		LOCK_PREFIX " ; decb %0\n\t"
 		"jns 5f\n"
 		"2:\t"
-		"testl $0x200, %[flags]\n\t"
+		"testl $0x200, %1\n\t"
 		"jz 4f\n\t"
 		STI_STRING "\n"
 		"3:\t"
 		"rep;nop\n\t"
-		"cmpb $0, %[slock]\n\t"
+		"cmpb $0, %0\n\t"
 		"jle 3b\n\t"
 		CLI_STRING "\n\t"
 		"jmp 1b\n"
 		"4:\t"
 		"rep;nop\n\t"
-		"cmpb $0, %[slock]\n\t"
+		"cmpb $0, %0\n\t"
 		"jg 1b\n\t"
 		"jmp 4b\n"
 		"5:\n\t"
-		: [slock] "+m" (lock->slock)
-		: [flags] "r" (flags)
-	 	  CLI_STI_INPUT_ARGS
+		: "+m" (lock->slock)
+		: "r" (flags)
 		: "memory" CLI_STI_CLOBBERS);
 }
 #endif
#1 lore raw
Quoted 5 lines · On Thu, 09 Nov 2006 12:01:42 +1100 Rusty Russell <[email protected]> wrote:

OK, at least two patches got dropped on the way from the mm tree to Andi's tree: the desc.h cleanup, and the processor.h rearrangement. Merging into Andi's tree without these patches must have been a nightmare 8(

Quoted 7 lines

Andi then tried to fix it with x86_64-mm-paravirt-compile.patch but then it didn't boot so he disabled it in x86_64-mm-paravirt-broken.patch

This patch undoes those two patches and rearranges processor.h correctly so the kernel compiles and boots with CONFIG_PARAVIRT. Andi's "paravirt-compile" patch also cleans up the spinlock header, which is good but should probably be patched separately.

Fun. Andi, I have a mountain of fixes against your tree. Whatever you do, don't change anything! I'll get it all sent over later today.

#4 lore raw
In reply to Rusty Russell
Quoted 2 lines · Rusty Russell

OK, at least two patches got dropped on the way from the mm tree to Andi's tree: the desc.h cleanup, and the processor.h rearrangement.

Can you please resend the patchkit with these patches included?

(and any further changes folded in into the respective patches)

Thanks,
-Andi

#2 lore raw
In reply to Andrew Morton
Quoted 11 lines · Andrew Morton
Quoted 8 lines · On Thu, 09 Nov 2006 12:01:42 +1100 Rusty Russell <[email protected]> wrote:

OK, at least two patches got dropped on the way from the mm tree to Andi's tree: the desc.h cleanup, and the processor.h rearrangement. Merging into Andi's tree without these patches must have been a nightmare 8(

Andi then tried to fix it with x86_64-mm-paravirt-compile.patch but then it didn't boot so he disabled it in x86_64-mm-paravirt-broken.patch

Quoted 7 lines
Quoted 4 lines

This patch undoes those two patches and rearranges processor.h correctly so the kernel compiles and boots with CONFIG_PARAVIRT. Andi's "paravirt-compile" patch also cleans up the spinlock header, which is good but should probably be patched separately.

Fun. Andi, I have a mountain of fixes against your tree. Whatever you do, don't change anything! I'll get it all sent over later today.

I think for the paravirt ops stuff it would be best to respin it -- e.g. let Rusty submit a new clean patchkit. That's much better than trying to add lots of fixup patches.

I'll go through the other patches.

-Andi

#5 lore raw
In reply to Andi Kleen
Quoted 8 lines · On Thu, 9 Nov 2006 08:12:37 +0100 Andi Kleen <[email protected]> wrote:
Quoted 2 lines · Rusty Russell

OK, at least two patches got dropped on the way from the mm tree to Andi's tree: the desc.h cleanup, and the processor.h rearrangement.

Can you please resend the patchkit with these patches included?

(and any further changes folded in into the respective patches)

argh.

I'll do it.

I wish you didn't rename patches.

#3 lore raw
In reply to Andi Kleen
Quoted 17 lines · On 9 Nov 2006 08:31:58 +0100 Andi Kleen <[email protected]> wrote:
Quoted 16 lines · Andrew Morton
Quoted 12 lines · On Thu, 09 Nov 2006 12:01:42 +1100 Rusty Russell <[email protected]> wrote:

OK, at least two patches got dropped on the way from the mm tree to Andi's tree: the desc.h cleanup, and the processor.h rearrangement. Merging into Andi's tree without these patches must have been a nightmare 8(

Andi then tried to fix it with x86_64-mm-paravirt-compile.patch but then it didn't boot so he disabled it in x86_64-mm-paravirt-broken.patch

This patch undoes those two patches and rearranges processor.h correctly so the kernel compiles and boots with CONFIG_PARAVIRT. Andi's "paravirt-compile" patch also cleans up the spinlock header, which is good but should probably be patched separately.

Quoted 6 lines
Quoted 2 lines

Fun. Andi, I have a mountain of fixes against your tree. Whatever you do, don't change anything! I'll get it all sent over later today.

I think for the paravirt ops stuff it would be best to respin it -- e.g. let Rusty submit a new clean patchkit. That's much better than trying to add lots of fixup patches.

That's what I'm doing.

Quoted 1 line

I'll go through the other patches.

OK. Please drop all the paravirt patches, publish a new tree then let us know when it's there.

#6 lore raw
In reply to Andrew Morton
Quoted 8 lines · On Wed, 8 Nov 2006 23:39:04 -0800 Andrew Morton <[email protected]> wrote:
Quoted 4 lines

Can you please resend the patchkit with these patches included?

(and any further changes folded in into the respective patches)

argh.

I'll do it.

OK, all done.

I kept prep-for-paravirt-be-careful-about-touching-bios.patch (below) separate, because it's dependent on x86_64-mm-i386-create-e820.c-to-handle-standard-io-mem-resources.patch. It could be folded into one of the other patches I guess.

So I have:

paravirt-i386-header-and-stubs-for-paravirtualisation.patch paravirt-i386-patch-inline-replacements-for.patch paravirt-i386-more-generic-paravirtualization.patch paravirt-i386-allow-selected-bug-checks-to-be.patch paravirt-i386-allow-disabling-legacy-power.patch paravirt-i386-add-apic-accessors-to-paravirt-ops.patch paravirt-i386-add-mmu-virtualization-to.patch prep-for-paravirt-be-careful-about-touching-bios.patch

From: Rusty Russell <[email protected]>

BIOS ROM areas may not be mapped into the guest address space, so be careful when touching those addresses to make sure they appear to be mapped.

[[email protected]: fix unused var warning]
Cc Jeremy Fitzhardinge <[email protected]>
Cc Andi Kleen <[email protected]>

---

 arch/i386/kernel/e820.c |    9 ++++++++-
 arch/i386/pci/pcbios.c  |   11 +++++++++--
 2 files changed, 17 insertions(+), 3 deletions(-)
arch/i386/kernel/e820.c renamed from arch/i386/kernel/e820.c~prep-for-paravirt-be-careful-about-touching-bios +8 -1
diff -puN arch/i386/kernel/e820.c~prep-for-paravirt-be-careful-about-touching-bios arch/i386/kernel/e820.c
@@ -155,7 +155,14 @@ static struct resource standard_io_resou
 	.flags	= IORESOURCE_BUSY | IORESOURCE_IO
 } };
 
-#define romsignature(x) (*(unsigned short *)(x) == 0xaa55)
+static int romsignature(const unsigned char *x)
+{
+	unsigned short sig;
+	int ret = 0;
+	if (__get_user(sig, (const unsigned short *)x) == 0)
+		ret = (sig == 0xaa55);
+	return ret;
+}
 
 static int __init romchecksum(unsigned char *rom, unsigned long length)
 {
arch/i386/pci/pcbios.c renamed from arch/i386/pci/pcbios.c~prep-for-paravirt-be-careful-about-touching-bios +9 -2
diff -puN arch/i386/pci/pcbios.c~prep-for-paravirt-be-careful-about-touching-bios arch/i386/pci/pcbios.c
@@ -5,6 +5,7 @@
 #include <linux/pci.h>
 #include <linux/init.h>
 #include <linux/module.h>
+#include <asm/uaccess.h>
 #include "pci.h"
 #include "pci-functions.h"
 
@@ -314,6 +315,10 @@ static struct pci_raw_ops * __devinit pc
 	for (check = (union bios32 *) __va(0xe0000);
 	     check <= (union bios32 *) __va(0xffff0);
 	     ++check) {
+		long sig;
+		if (__get_user(sig, &check->fields.signature))
+			continue;
+
 		if (check->fields.signature != BIOS32_SIGNATURE)
 			continue;
 		length = check->fields.length * 16;
@@ -331,11 +336,13 @@ static struct pci_raw_ops * __devinit pc
 		}
 		DBG("PCI: BIOS32 Service Directory structure at 0x%p\n", check);
 		if (check->fields.entry >= 0x100000) {
-			printk("PCI: BIOS32 entry (0x%p) in high memory, cannot use.\n", check);
+			printk("PCI: BIOS32 entry (0x%p) in high memory, "
+					"cannot use.\n", check);
 			return NULL;
 		} else {
 			unsigned long bios32_entry = check->fields.entry;
-			DBG("PCI: BIOS32 Service Directory entry at 0x%lx\n", bios32_entry);
+			DBG("PCI: BIOS32 Service Directory entry at 0x%lx\n",
+					bios32_entry);
 			bios32_indirect.address = bios32_entry + PAGE_OFFSET;
 			if (check_pcibios())
 				return &pci_bios_access;

_

#7 lore raw
Quoted 21 lines · Andrew Morton
Quoted 8 lines · On Wed, 8 Nov 2006 23:39:04 -0800 Andrew Morton <[email protected]> wrote:
Quoted 4 lines

Can you please resend the patchkit with these patches included?

(and any further changes folded in into the respective patches)

argh.

I'll do it.

OK, all done.

I kept prep-for-paravirt-be-careful-about-touching-bios.patch (below) separate, because it's dependent on x86_64-mm-i386-create-e820.c-to-handle-standard-io-mem-resources.patch. It could be folded into one of the other patches I guess.

So I have:

Quoted 8 lines

paravirt-i386-header-and-stubs-for-paravirtualisation.patch paravirt-i386-patch-inline-replacements-for.patch paravirt-i386-more-generic-paravirtualization.patch paravirt-i386-allow-selected-bug-checks-to-be.patch paravirt-i386-allow-disabling-legacy-power.patch paravirt-i386-add-apic-accessors-to-paravirt-ops.patch paravirt-i386-add-mmu-virtualization-to.patch prep-for-paravirt-be-careful-about-touching-bios.patch

Thanks. Where can I get them?

-Andi

#8 lore raw
Quoted 31 lines · On 9 Nov 2006 15:11:09 +0100 Andi Kleen <[email protected]> wrote:
Quoted 21 lines · Andrew Morton
Quoted 8 lines · On Wed, 8 Nov 2006 23:39:04 -0800 Andrew Morton <[email protected]> wrote:
Quoted 4 lines

Can you please resend the patchkit with these patches included?

(and any further changes folded in into the respective patches)

argh.

I'll do it.

OK, all done.

I kept prep-for-paravirt-be-careful-about-touching-bios.patch (below) separate, because it's dependent on x86_64-mm-i386-create-e820.c-to-handle-standard-io-mem-resources.patch. It could be folded into one of the other patches I guess.

So I have:

Quoted 8 lines

paravirt-i386-header-and-stubs-for-paravirtualisation.patch paravirt-i386-patch-inline-replacements-for.patch paravirt-i386-more-generic-paravirtualization.patch paravirt-i386-allow-selected-bug-checks-to-be.patch paravirt-i386-allow-disabling-legacy-power.patch paravirt-i386-add-apic-accessors-to-paravirt-ops.patch paravirt-i386-add-mmu-virtualization-to.patch prep-for-paravirt-be-careful-about-touching-bios.patch

Quoted 2 lines

Thanks. Where can I get them?

I'm still waiting for you to drop the paravirt patches and republish the tree. So I can make sure it all applies and is nice.

I guess that won't be happening, so I'll send them over now.

#9 lore raw
Quoted 1 line · On Thu, 9 Nov 2006 09:13:03 -0800 Andrew Morton <[email protected]> wrote:

so I'll send them over now.

You'll need to drop

header-and-stubs-for.patch
paravirt-patch.patch
paravirt-entry.patch
paravirt-bug-skip.patch
paravirt-no-legacy.patch
paravirt-apic.patch
paravirt-tlb.patch
paravirt-broken.patch
paravirt-compile.patch

#10 lore raw
In reply to Andi Kleen
Quoted 7 lines · Andi Kleen
Quoted 2 lines · Rusty Russell

OK, at least two patches got dropped on the way from the mm tree to Andi's tree: the desc.h cleanup, and the processor.h rearrangement.

Can you please resend the patchkit with these patches included?

(and any further changes folded in into the respective patches)

No, I'm supposed to be on leave for 3 weeks, starting yesterday.

They went into Andrew Morton's tree. They were fine there, and had been there for a few weeks!

You can either go back and pull them out of the -mm tree before -rc5-mm1 (say -rc4-mm2), or drop all of them and have Andrew can reinstate the ones he dropped.

The relevant patches from -rc4-mm2 seem to be:

prep-for-paravirt-be-careful-about-touching-bios.patch
Prep for paravirt: Be careful about touching BIOS address space

prep-for-paravirt-be-careful-about-touching-bios-warning-fix.patch
prep-for-paravirt-be-careful-about-touching-bios-warning-fix

prep-for-paravirt-cpu_detect-extraction.patch
Prep for paravirt: cpu_detect extraction

prep-for-paravirt-desch-clearer-parameter-names.patch
Prep for paravirt: desc.h clearer parameter names, some code motion

prep-for-paravirt-desch-clearer-parameter-names-fix.patch
prep-for-paravirt-desch-clearer-parameter-names fix

prep-for-paravirt-rearrange-processorh.patch
Prep for paravirt: rearrange processor.h

paravirtualization-header-and-stubs-for.patch
paravirtualization: header and stubs for paravirtualizing critical operations

paravirtualization-patch-inline-replacements-for.patch
paravirtualization: Patch inline replacements for common paravirt operations.

paravirtualization-patch-inline-replacements-for-fix.patch
paravirtualization-patch-inline-replacements-for (fix)

paravirtualization-more-generic-paravirtualization.patch
paravirtualization: More generic paravirtualization entry point.

paravirtualization-allow-selected-bug-checks-to-be.patch
paravirtualization: Allow selected bug checks to be skipped by paravirt kernels

paravirtualization-allow-disabling-legacy-power.patch
paravirtualization: Allow disabling legacy power management modes with paravirt kernels

paravirtualization-add-apic-accessors-to-paravirt-ops.patch
paravirtualization: Add APIC accessors to paravirt-ops.

paravirtualization-add-apic-accessors-to-paravirt-ops-tidy.patch
paravirtualization: Add APIC accessors to paravirt-ops

paravirtualization-add-mmu-virtualization-to.patch
paravirtualization: Add mmu virtualization to paravirt-ops.

There were then some fixes which went in after that, in rc5-mm1:

paravirtualization-header-and-stubs-for-fix.patch
fix "paravirtualization: header and stubs for paravirtualizing critical operations"

paravirtualization-header-and-stubs-for-headers_check-fix.patch
paravirtualization: header and stubs for paravirtualizing critical operations (headers_check fix)

paravirtualization-patch-inline-replacements-for-fix-2.patch
paravirtualization-patch-inline-replacements-for fix 2

paravirtualization-patch-inline-replacements-for-fix-3.patch
Fix 'arch/i386/kernel/alternative.c:355: warning: unused variable 'i''

paravirtualization-more-generic-paravirtualization-warning-fix.patch
Fix 'arch/i386/kernel/paravirt.c:481: warning: initialization from incompatible pointer type'

Rusty.