From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: Gerhard Brauer <gerhard.brauer@web.de>
Cc: "Luiz Fernando N. Capitulino" <lcapitulino@mandriva.com.br>,
"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org
Subject: Re: 2.6.{26.2,27-rc} oops on virtualbox
Date: Tue, 26 Aug 2008 16:48:14 -0400 [thread overview]
Message-ID: <20080826204814.GB23544@Krystal> (raw)
In-Reply-To: <20080826203449.GD5300@tux1.brauer.lan>
* Gerhard Brauer (gerhard.brauer@web.de) wrote:
> On Tue, Aug 26, 2008 at 02:15:58PM -0400, Mathieu Desnoyers wrote:
> >
> > Ok, it might still be caused by paravirt and alternatives instruction
> > patching. What if you also do :
> >
> > alternative_instructions()
> >
> > + unsigned long flags;
> > /* The patching is not fully atomic, so try to avoid local interruptions
> > that might execute the to be patched code.
> > Other CPUs are not running. */
> > stop_nmi();
> > #ifdef CONFIG_X86_MCE
> > stop_mce();
> > #endif
> > + local_irq_save(flags);
> >
> >
> > ...
> > + local_irq_restore(flags);
> > restart_nmi();
> > #ifdef CONFIG_X86_MCE
> > restart_mce();
> > #endif
> >
> > ?
>
> Hej! This last changes (in addition to the others you mentioned) seems
> to be a good shot. I could reboot 8 times the guest, compile several
> packages (something which always leeds to the oops) and currently i
> build two big packages simultan. So this is heavy IO.
>
> I will try tomorrow more heavy build tests (to gain the good feeling to
> the vbox+guest kernel again like it was with 2.6.25), but i think your
> changes goes in the right direction.
>
OK, so we have a problem with interrupts coming while we are doing the
alternatives patching.
First thing, I wonder if Virtualbox expects the OS to patch all its
paravirt instructions in one go ?
Also, could you then try to :
- to revert all those changes
- Do this to text_poke_early and text_poke :
- put the sync_core() within the irq off critical section
(test)
- add a wbinvd(); just after the sync_core() in both functions
(test).
Thanks,
Mathieu
> Here is the diff what i've changed on your hints:
>
> ,----[ arch/x86/kernel/alternative.c ]
> | --- alternative.c.org 2008-07-13 23:51:29.000000000 +0200
> | +++ alternative.c 2008-08-26 21:35:20.000000000 +0200
> | @@ -343,6 +343,7 @@
> | void alternatives_smp_switch(int smp)
> | {
> | struct smp_alt_module *mod;
> | + unsigned long flags;
> |
> | #ifdef CONFIG_LOCKDEP
> | /*
> | @@ -359,7 +360,7 @@
> | return;
> | BUG_ON(!smp && (num_online_cpus() > 1));
> |
> | - spin_lock(&smp_alt);
> | + spin_lock_irqsave(&smp_alt, flags);
> |
> | /*
> | * Avoid unnecessary switches because it forces JIT based VMs to
> | @@ -383,7 +384,7 @@
> | mod->text, mod->text_end);
> | }
> | smp_mode = smp;
> | - spin_unlock(&smp_alt);
> | + spin_unlock_irqrestore(&smp_alt, flags);
> | }
> |
> | #endif
> | @@ -420,6 +421,7 @@
> |
> | void __init alternative_instructions(void)
> | {
> | + unsigned long flags;
> | /* The patching is not fully atomic, so try to avoid local interruptions
> | that might execute the to be patched code.
> | Other CPUs are not running. */
> | @@ -427,6 +429,7 @@
> | #ifdef CONFIG_X86_MCE
> | stop_mce();
> | #endif
> | + local_irq_save(flags);
> |
> | apply_alternatives(__alt_instructions, __alt_instructions_end);
> |
> | @@ -465,6 +468,7 @@
> | (unsigned long)__smp_locks,
> | (unsigned long)__smp_locks_end);
> |
> | + local_irq_restore(flags);
> | restart_nmi();
> | #ifdef CONFIG_X86_MCE
> | restart_mce();
> | @@ -508,33 +512,5 @@
> | */
> | void *__kprobes text_poke(void *addr, const void *opcode, size_t len)
> | {
> | - unsigned long flags;
> | - char *vaddr;
> | - int nr_pages = 2;
> | - struct page *pages[2];
> | - int i;
> | -
> | - if (!core_kernel_text((unsigned long)addr)) {
> | - pages[0] = vmalloc_to_page(addr);
> | - pages[1] = vmalloc_to_page(addr + PAGE_SIZE);
> | - } else {
> | - pages[0] = virt_to_page(addr);
> | - WARN_ON(!PageReserved(pages[0]));
> | - pages[1] = virt_to_page(addr + PAGE_SIZE);
> | - }
> | - BUG_ON(!pages[0]);
> | - if (!pages[1])
> | - nr_pages = 1;
> | - vaddr = vmap(pages, nr_pages, VM_MAP, PAGE_KERNEL);
> | - BUG_ON(!vaddr);
> | - local_irq_save(flags);
> | - memcpy(&vaddr[(unsigned long)addr & ~PAGE_MASK], opcode, len);
> | - local_irq_restore(flags);
> | - vunmap(vaddr);
> | - sync_core();
> | - /* Could also do a CLFLUSH here to speed up CPU recovery; but
> | - that causes hangs on some VIA CPUs. */
> | - for (i = 0; i < len; i++)
> | - BUG_ON(((char *)addr)[i] != ((char *)opcode)[i]);
> | - return addr;
> | + return text_poke_early(addr, opcode, len);
> | }
> `----
>
> So if Luiz and others could also try all 3 mentioned changes, maybe we
> have a solution. I also will build tomorrow a new LiveCD/Install ISO
> with these patches to see if the error there is also gone.
>
> > Thanks,
> >
> > Mathieu
>
> Gerhard
>
>
> --
> Was wir wissen, ist ein Tropfen.
> Was wir nicht wissen, ein Ozean (Newton)
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
next prev parent reply other threads:[~2008-08-26 20:48 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-20 19:29 Luiz Fernando N. Capitulino
2008-08-21 21:34 ` H. Peter Anvin
2008-08-22 6:42 ` H. Peter Anvin
2008-08-22 6:50 ` Ingo Molnar
2008-08-22 14:39 ` Luiz Fernando N. Capitulino
2008-08-22 15:34 ` Mathieu Desnoyers
2008-08-22 16:29 ` Luiz Fernando N. Capitulino
2008-08-22 16:35 ` Mathieu Desnoyers
2008-08-22 17:20 ` Luiz Fernando N. Capitulino
2008-08-22 18:11 ` H. Peter Anvin
2008-08-22 19:40 ` Luiz Fernando N. Capitulino
2008-08-22 20:31 ` H. Peter Anvin
2008-08-22 20:55 ` Luiz Fernando N. Capitulino
2008-08-22 20:57 ` Luiz Fernando N. Capitulino
2008-08-22 21:08 ` H. Peter Anvin
2008-08-26 14:18 ` Gerhard Brauer
2008-08-26 14:53 ` Mathieu Desnoyers
2008-08-26 16:09 ` Luiz Fernando N. Capitulino
2008-08-26 16:13 ` Luiz Fernando N. Capitulino
2008-08-26 17:18 ` Mathieu Desnoyers
2008-08-26 17:32 ` H. Peter Anvin
2008-08-26 18:02 ` Luiz Fernando N. Capitulino
2008-08-26 18:15 ` Mathieu Desnoyers
2008-08-26 19:52 ` H. Peter Anvin
2008-08-26 20:34 ` Gerhard Brauer
2008-08-26 20:48 ` Mathieu Desnoyers [this message]
2008-08-26 21:25 ` Gerhard Brauer
2008-08-26 21:35 ` Mathieu Desnoyers
2008-08-26 21:51 ` H. Peter Anvin
2008-08-27 0:13 ` Gerhard Brauer
2008-08-27 19:13 ` Luiz Fernando N. Capitulino
2008-08-27 23:33 ` Mathieu Desnoyers
2008-08-28 13:30 ` Luiz Fernando N. Capitulino
2008-08-31 9:29 ` Gerhard Brauer
2008-08-31 13:28 ` Stefan Lippers-Hollmann
2008-08-31 14:03 ` Gerhard Brauer
2008-08-31 14:09 ` Luiz Fernando N. Capitulino
2008-09-21 13:41 ` Gerhard Brauer
2008-09-22 9:51 ` Ingo Molnar
2008-09-24 13:24 ` Luiz Fernando N. Capitulino
2008-08-28 13:50 ` Gerhard Brauer
2008-08-26 19:27 ` Gerhard Brauer
2008-08-26 16:02 ` Luiz Fernando N. Capitulino
2008-08-26 16:40 ` Gerhard Brauer
2008-08-22 17:16 ` H. Peter Anvin
2008-08-22 17:45 ` Mathieu Desnoyers
2008-08-22 17:57 ` H. Peter Anvin
2008-08-22 19:10 ` Luiz Fernando N. Capitulino
2008-08-22 19:14 ` H. Peter Anvin
2008-08-22 19:18 ` H. Peter Anvin
2008-08-22 19:42 ` Luiz Fernando N. Capitulino
2008-08-22 14:28 ` Luiz Fernando N. Capitulino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080826204814.GB23544@Krystal \
--to=mathieu.desnoyers@polymtl.ca \
--cc=gerhard.brauer@web.de \
--cc=hpa@zytor.com \
--cc=lcapitulino@mandriva.com.br \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®