public inbox for kvmarm@lists.cs.columbia.edu
 help / color / mirror / Atom feed
From: James Morse <james.morse@arm.com>
To: Christoffer Dall <cdall@linaro.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>,
	Punit Agrawal <punit.agrawal@arm.com>,
	kvmarm@lists.cs.columbia.edu,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2] KVM: arm/arm64: Signal SIGBUS when stage2 discovers hwpoison memory
Date: Fri, 16 Jun 2017 12:32:13 +0100	[thread overview]
Message-ID: <5943C1BD.9040301@arm.com> (raw)
In-Reply-To: <5937CA43.7060108@arm.com>

Hi Christoffer,

On 07/06/17 10:41, James Morse wrote:
> I evidently stopped before I got to the bottom of this, the commit message is
> based on the way I first hit this

I've worked out where I went wrong with this. memory_failure()/hwpoison has two
'modes', early and late. My testing was broken for 'early', but caused both to
happen at the same time, leading to this confusion.

The affected page was mapped and found in the rmap, it then gets unmapped by
memory_failure(), which then skipped the early notification because the flags
were wrong. Meanwhile the late notification fires at the same time on another CPU.

So, from the top:
-----%<-----
memory_failure() has two modes, early and late. Early is used by
machine-managers like Qemu to receive a notification when a memory error is
notified to the host. These can then be relayed to the guest before the affected
page is accessed. To enable this, the process must set PR_MCE_KILL_EARLY in
PR_MCE_KILL_SET using the prctl() syscall.

Once the early notification has been handled, nothing stops the machine-manager
or guest from accessing the affected page. If the machine-manager does this the
page will fail to be mapped and SIGBUS will be sent. This patch adds the
equivalent path for when the guest accesses the page, sending SIGBUS to the
machine-manager.

These two signals can be distinguished by the machine-manager using their
si_code: BUS_MCEERR_AO for 'action optional' early notifications, and
BUS_MCEERR_AR for 'action required' synchronous/late notifications.
-----%<-----

If this clears everything up I will post a v3 with the above as the commit message.


Thanks!

James

  reply	other threads:[~2017-06-16 11:28 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 [this message]
2017-06-21  7:42 ` gengdongjiu
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=5943C1BD.9040301@arm.com \
    --to=james.morse@arm.com \
    --cc=cdall@linaro.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=marc.zyngier@arm.com \
    --cc=punit.agrawal@arm.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