public inbox for kvmarm@lists.cs.columbia.edu
 help / color / mirror / Atom feed
From: gengdongjiu <gengdongjiu@huawei.com>
To: James Morse <james.morse@arm.com>, kvmarm@lists.cs.columbia.edu
Cc: wuquanming <wuquanming@huawei.com>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Punit Agrawal <punit.agrawal@arm.com>,
	Huangshaoyu <huangshaoyu@huawei.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2] KVM: arm/arm64: Signal SIGBUS when stage2 discovers hwpoison memory
Date: Wed, 21 Jun 2017 15:42:05 +0800	[thread overview]
Message-ID: <3dbafd74-57f2-e724-ace2-0f84abb57e59@huawei.com> (raw)
In-Reply-To: <20170524163250.29281-1-james.morse@arm.com>

Hi James,
  I have a comment here:

On 2017/5/25 0:32, James Morse wrote:
> +static void kvm_send_hwpoison_signal(unsigned long address,
> +				     struct vm_area_struct *vma)
> +{
> +	siginfo_t info;
> +
> +	info.si_signo   = SIGBUS;
> +	info.si_errno   = 0;
> +	info.si_code    = BUS_MCEERR_AR;
> +	info.si_addr    = (void __user *)address;
> +
> +	if (is_vm_hugetlb_page(vma))
> +		info.si_addr_lsb = huge_page_shift(hstate_vma(vma));
> +	else
> +		info.si_addr_lsb = PAGE_SHIFT;
> +
> +	send_sig_info(SIGBUS, &info, current);
> +}
> +
>  static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
>  			  struct kvm_memory_slot *memslot, unsigned long hva,
>  			  unsigned long fault_status)
> @@ -1318,6 +1337,10 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
>  	smp_rmb();
>  
>  	pfn = gfn_to_pfn_prot(kvm, gfn, write_fault, &writable);
> +	if (pfn == KVM_PFN_ERR_HWPOISON) {
> +		kvm_send_hwpoison_signal(hva, vma);
> +		return 0;
> +	}
I heard from our CPU hardware team, when happen HWpoison, CPU hardware does not record the IPA address in the HPFAR_EL2.
Only when the SEA error is related to the page table walk, the HPFAR_EL2 register is updated.
here we got the pfn/gfn from the register HPFAR_EL2, if CPU does not update the HPFAR_EL2 register, we may can not use this method to get the pfn/gfn.
could you confirm arm's armv8.0/armv8.2 standard CPU also use such design? if so, we may need to use other method to get the gfn/pfn/hva address.


>  	if (is_error_noslot_pfn(pfn))
>  		return -EFAULT;

  parent reply	other threads:[~2017-06-21  7:38 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-24 16:32 [PATCH v2] KVM: arm/arm64: Signal SIGBUS when stage2 discovers hwpoison memory James Morse
2017-06-01 22:22 ` Christoffer Dall
2017-06-02 10:16   ` James Morse
2017-06-02 10:43     ` Christoffer Dall
2017-06-07  9:41       ` James Morse
2017-06-16 11:32         ` James Morse
2017-06-21  7:42 ` gengdongjiu [this message]
2017-06-21  9:53   ` James Morse
2017-06-21 10:59     ` gengdongjiu
2017-06-21 12:44       ` James Morse
2017-06-22  6:47         ` gengdongjiu
2017-06-22 16:39           ` James Morse
2017-06-24 14:56             ` gengdongjiu
2017-06-23  9:38           ` James Morse
2017-06-23 10:18             ` Peter Maydell
2017-06-24 15:07               ` gengdongjiu
2017-06-24  8:23             ` gengdongjiu
2017-06-22 14:49         ` gengdongjiu
2017-06-21 11:12     ` gengdongjiu

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=3dbafd74-57f2-e724-ace2-0f84abb57e59@huawei.com \
    --to=gengdongjiu@huawei.com \
    --cc=huangshaoyu@huawei.com \
    --cc=james.morse@arm.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=marc.zyngier@arm.com \
    --cc=punit.agrawal@arm.com \
    --cc=wuquanming@huawei.com \
    /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