[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87vaqsdw4f.fsf@e105922-lin.cambridge.arm.com>
Date: Wed, 29 Mar 2017 14:56:48 +0100
From: Punit Agrawal <punit.agrawal@....com>
To: Laszlo Ersek <lersek@...hat.com>
Cc: "Michael S. Tsirkin" <mst@...hat.com>, kvm@...r.kernel.org,
catalin.marinas@....com, Achin Gupta <achin.gupta@....com>,
will.deacon@....com, qemu-devel@...gnu.org, wuquanming@...wei.com,
kvmarm@...ts.cs.columbia.edu, Christoffer Dall <cdall@...aro.org>,
gengdongjiu <gengdongjiu@...wei.com>, Leif.Lindholm@...aro.com,
huangshaoyu@...wei.com, Marc Zyngier <marc.zyngier@....com>,
andre.przywara@....com, edk2-devel@...ts.01.org,
wangxiongfeng2@...wei.com, nd@....com,
linux-arm-kernel@...ts.infradead.org, ard.biesheuvel@...aro.org,
linux-kernel@...r.kernel.org, Igor Mammedov <imammedo@...hat.com>
Subject: Re: [PATCH] kvm: pass the virtual SEI syndrome to guest OS
Laszlo Ersek <lersek@...hat.com> writes:
> 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.
>
> 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).
Not sure about other error sources but for GHESv2 (ACPI 6.1, Section
18.3.2.8) the OS is expected to acknowledge the error before the
firmware is allowed to reuse the memory.
>
> Thanks,
> Laszlo
> _______________________________________________
> kvmarm mailing list
> kvmarm@...ts.cs.columbia.edu
> https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Powered by blists - more mailing lists