[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1273798701.3564.112.camel@yhuang-dev.sh.intel.com>
Date: Fri, 14 May 2010 08:58:21 +0800
From: Huang Ying <ying.huang@...el.com>
To: Marcelo Tosatti <mtosatti@...hat.com>
Cc: Avi Kivity <avi@...hat.com>, Andi Kleen <andi@...stfloor.org>,
Andrew Morton <akpm@...ux-foundation.org>,
"masbock@...ux.vnet.ibm.com" <masbock@...ux.vnet.ibm.com>,
"Wu, Fengguang" <fengguang.wu@...el.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>
Subject: Re: [PATCH -v2] KVM, Fix QEMU-KVM is killed by guest SRAO MCE
On Fri, 2010-05-14 at 05:43 +0800, Marcelo Tosatti wrote:
> On Wed, May 12, 2010 at 02:44:03PM +0800, Huang Ying wrote:
> > @@ -1975,6 +1976,27 @@ static int __direct_map(struct kvm_vcpu
> > return pt_write;
> > }
> >
> > +static void kvm_send_hwpoison_signal(struct kvm *kvm, gfn_t gfn)
> > +{
> > + char buf[1];
> > + void __user *hva;
> > + int r;
> > +
> > + /* Touch the page, so send SIGBUS */
> > + hva = (void __user *)gfn_to_hva(kvm, gfn);
> > + r = copy_from_user(buf, hva, 1);
> > +}
>
> A SIGBUS signal has been raised by memory poisoning already, so i don't
> see why this is needed?
>
> To avoid the MMIO processing in userspace before the MCE is sent to the
> guest you can just return -EAGAIN from the page fault handlers back to
> kvm_mmu_page_fault.
The SIGBUS signal is necessary here because this SIGBUS is SRAR (Action
Requirement) while the previously sent one is SRAO (Action Optional).
They have different semantics and processed differently in QEMU-KVM and
guest OS.
For example the guest Linux kernel may ignore SRAO MCE (raised by
QEMU-KVM after receiving SRAO SIGBUS), because it is optional, but for
SRAR MCE (raised by QEMU-KVM after receiving SRAR SIGBUS) the guest
Linux kernel must kill corresponding application or go panic.
> > +int is_hwpoison_address(unsigned long addr)
> > +{
> > + pgd_t *pgdp;
> > + pud_t *pudp;
> > + pmd_t *pmdp;
> > + pte_t pte, *ptep;
> > + swp_entry_t entry;
> > +
> > + pgdp = pgd_offset(current->mm, addr);
> > + if (!pgd_present(*pgdp))
> > + return 0;
> > + pudp = pud_offset(pgdp, addr);
> > + if (!pud_present(*pudp))
> > + return 0;
> > + pmdp = pmd_offset(pudp, addr);
> > + if (!pmd_present(*pmdp))
> > + return 0;
>
> Need to bail out if pmd is huge.
Yes. I will change this.
Best Regards,
Huang Ying
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists