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>
Cc: wuquanming <wuquanming@huawei.com>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Achin Gupta <Achin.Gupta@arm.com>,
	Punit Agrawal <punit.agrawal@arm.com>,
	Huangshaoyu <huangshaoyu@huawei.com>,
	linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH v2] KVM: arm/arm64: Signal SIGBUS when stage2 discovers hwpoison memory
Date: Wed, 21 Jun 2017 18:59:58 +0800	[thread overview]
Message-ID: <3a02e425-5782-dad4-efda-fdc5df73dcf7@huawei.com> (raw)
In-Reply-To: <594A4205.70201@arm.com>

Hi James,

On 2017/6/21 17:53, James Morse wrote:
> I think we discussed this before[0], your CPU has a feature called 'hwpoison'
> that is uses to support RAS. Linux also has a feature called 'hwpoison' [1][2],
> which handles the offline-ing of memory pages when it receives a notification
> through APEI. I've tried to call this memory_failure() to avoid this confusion.
> 
> This patch is to handle stage2 faults when the page was removed from the stage2
> mapping by the memory_failure() code. v3 of this patch[3] does a much better job
> of describing this.
> 
> (... I don't think your question is related to this patch ...)

I know your meaning about the Linux 'hwpoison' feature.
Let see the code that how to get the "pfn"

///get the pfn
fault_ipa = kvm_vcpu_get_fault_ipa(vcpu);
gfn = fault_ipa >> PAGE_SHIFT;
pfn = gfn_to_pfn_prot(kvm, gfn, write_fault, &writable);


As shown in above code, when happen SEA, the fault_ipa is got from the HPFAR_EL2 register.
if the HPFAR_EL2 does not record the IPA. the fault_ipa is zero, then gfn is zero, so the pfn is unknown.

so below judgement always false although firmware notify the memory_failure through APEI, because we do not get the right fault memory page.
using this API "kvm_vcpu_get_fault_ipa" can not get the right fault memory page if cpu does not update the HPFAR_EL2.

+	if (pfn == KVM_PFN_ERR_HWPOISON) {
+		kvm_send_hwpoison_signal(hva, vma);
+		return 0;
+	}

so may be you need to double confirm that whether armv8.0/armv8.2  standard CPU can always update the  HPFAR_EL2 registers.

  reply	other threads:[~2017-06-21 10:55 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
2017-06-21  9:53   ` James Morse
2017-06-21 10:59     ` gengdongjiu [this message]
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=3a02e425-5782-dad4-efda-fdc5df73dcf7@huawei.com \
    --to=gengdongjiu@huawei.com \
    --cc=Achin.Gupta@arm.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