From: "Michael S. Tsirkin" <mst@redhat.com>
To: Laszlo Ersek <lersek@redhat.com>
Cc: Achin Gupta <achin.gupta@arm.com>,
gengdongjiu <gengdongjiu@huawei.com>,
ard.biesheuvel@linaro.org, edk2-devel@lists.01.org,
qemu-devel@nongnu.org, zhaoshenglong@huawei.com,
James Morse <james.morse@arm.com>,
Christoffer Dall <cdall@linaro.org>,
xiexiuqi@huawei.com, Marc Zyngier <marc.zyngier@arm.com>,
catalin.marinas@arm.com, will.deacon@arm.com,
christoffer.dall@linaro.org, rkrcmar@redhat.com,
suzuki.poulose@arm.com, andre.przywara@arm.com,
mark.rutland@arm.com, vladimir.murzin@arm.com,
linux-arm-kernel@lists.infradead.org,
kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org, wangxiongfeng2@huawei.com,
wuquanming@huawei.com, huangshaoyu@huawei.com,
Leif.Lindholm@linaro.comnd@arm.com,
Igor Mammedov <imammedo@redhat.com>
Subject: Re: [PATCH] kvm: pass the virtual SEI syndrome to guest OS
Date: Wed, 29 Mar 2017 16:54:41 +0300 [thread overview]
Message-ID: <20170329164811-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <756e3032-e619-a70d-3e29-d2797e52fecf@redhat.com>
On Wed, Mar 29, 2017 at 03:36:59PM +0200, Laszlo Ersek wrote:
> On 03/29/17 14:51, Michael S. Tsirkin wrote:
> > On Wed, Mar 29, 2017 at 01:58:29PM +0200, Laszlo Ersek wrote:
> >> (8) When QEMU gets SIGBUS from the kernel -- I hope that's going to come
> >> through a signalfd -- QEMU can format the CPER right into guest memory,
> >> and then inject whatever interrupt (or assert whatever GPIO line) is
> >> necessary for notifying the guest.
> >
> > I think I see a race condition potential - what if guest accesses
> > CPER in guest memory while it's being written?
>
> I'm not entirely sure about the data flow here (these parts of the ACPI
> spec are particularly hard to read...), but I thought the OS wouldn't
> look until it got a notification.
There could be multiple notifications, OS might be looking
there because of them.
> Or, are you concerned about the next CPER write by QEMU, while the OS is
> reading the last one (and maybe the CPER area could wrap around?)
>
> >
> > We can probably use another level of indirection to fix this:
> >
> > allocate twice the space, add a pointer to where the valid
> > table is located and update that after writing CPER completely.
> > The pointer can be written atomically but also needs to
> > be read atomically, so I suspect it should be a single byte
> > as we don't know how are OSPMs implementing this.
> >
>
> A-B-A problem? (Is that usually solved with a cookie or a wider
> generation counter? But that would again require wider atomics.)
>
> I do wonder though how this is handled on physical hardware. Assuming
> the hardware error traps to the firmware first (which, on phys hw, is
> responsible for depositing the CPER), in that scenario the phys firmware
> would face the same issue (i.e., asynchronously interrupting the OS,
> which could be reading the previously stored CPER).
>
> Thanks,
> Laszlo
ACPI spec seems to specify a set of serialization actions. I'm guessing
this is what you need to use to avoid changing guest state
while it's reading entries.
--
MST
next prev parent reply other threads:[~2017-03-29 13:54 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-20 7:55 [PATCH] kvm: pass the virtual SEI syndrome to guest OS Dongjiu Geng
2017-03-20 11:24 ` Marc Zyngier
2017-03-20 12:28 ` gengdongjiu
2017-03-20 13:58 ` Marc Zyngier
2017-03-20 15:08 ` James Morse
2017-03-21 6:32 ` gengdongjiu
2017-03-21 11:34 ` Christoffer Dall
2017-03-21 19:11 ` James Morse
2017-03-21 19:36 ` Christoffer Dall
2017-03-21 19:39 ` Christoffer Dall
2017-03-21 22:10 ` Peter Maydell
2017-03-22 11:15 ` Marc Zyngier
2017-03-28 10:48 ` James Morse
2017-03-28 11:23 ` Christoffer Dall
2017-03-28 11:33 ` Peter Maydell
2017-03-28 13:27 ` James Morse
2017-03-28 11:54 ` Achin Gupta
2017-03-28 12:16 ` gengdongjiu
2017-03-28 13:40 ` James Morse
2017-03-29 9:36 ` gengdongjiu
2017-03-29 10:36 ` Achin Gupta
2017-03-29 11:58 ` [edk2] " Laszlo Ersek
2017-03-29 12:51 ` Michael S. Tsirkin
2017-03-29 13:36 ` Laszlo Ersek
2017-03-29 13:54 ` Michael S. Tsirkin [this message]
2017-03-29 13:56 ` Punit Agrawal
2017-04-06 12:35 ` gengdongjiu
2017-04-06 18:55 ` [edk2] " Laszlo Ersek
2017-04-07 2:52 ` gengdongjiu
2017-04-07 9:21 ` Laszlo Ersek
2017-04-21 13:27 ` gengdongjiu
2017-04-24 11:27 ` Laszlo Ersek
2017-03-29 14:36 ` gengdongjiu
2017-03-29 14:48 ` Christoffer Dall
2017-03-29 15:37 ` [edk2] " Laszlo Ersek
2017-03-29 17:44 ` Christoffer Dall
2017-03-30 1:22 ` gengdongjiu
2017-03-28 12:22 ` Christoffer Dall
2017-03-28 13:24 ` Achin Gupta
2017-03-28 13:40 ` Christoffer Dall
2017-03-21 13:10 ` James Morse
2017-03-22 13:37 ` gengdongjiu
2017-03-22 18:56 ` James Morse
2017-03-21 6:07 ` gengdongjiu
2017-03-21 13:51 ` kbuild test robot
2017-03-22 3:20 ` 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=20170329164811-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=Leif.Lindholm@linaro.comnd \
--cc=achin.gupta@arm.com \
--cc=andre.przywara@arm.com \
--cc=ard.biesheuvel@linaro.org \
--cc=catalin.marinas@arm.com \
--cc=cdall@linaro.org \
--cc=christoffer.dall@linaro.org \
--cc=edk2-devel@lists.01.org \
--cc=gengdongjiu@huawei.com \
--cc=huangshaoyu@huawei.com \
--cc=james.morse@arm.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=lersek@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=mark.rutland@arm.com \
--cc=qemu-devel@nongnu.org \
--cc=rkrcmar@redhat.com \
--cc=suzuki.poulose@arm.com \
--cc=vladimir.murzin@arm.com \
--cc=wangxiongfeng2@huawei.com \
--cc=will.deacon@arm.com \
--cc=wuquanming@huawei.com \
--cc=xiexiuqi@huawei.com \
--cc=zhaoshenglong@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