qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 3/7] ACPI ERST: support for ACPI ERST feature


From: Igor Mammedov
Subject: Re: [PATCH v2 3/7] ACPI ERST: support for ACPI ERST feature
Date: Mon, 17 May 2021 18:31:38 +0200

On Mon, 17 May 2021 15:01:02 +0000
Eric DeVolder <eric.devolder@oracle.com> wrote:

> Hi Igor,
> I've been working to transition ERST to use the hostmem-file object as the 
> backing store, as requested.
> 
> I have the backend-file object now in ERST, and I have a question for you. 
> This hostmem-file initializes
> itself from a file, but in looking at the code, I do not see that it ever 
> writes back to the file!? Furthermore,
> I don't see a "flush" type method to force writeback of data in the object 
> back to file?
> 
> The original ERST code would flush/write to the backing file each record as 
> it was created. I don't see
> any equivalent way of doing that with hostmem-file?

To force flush you can use memory_region_msync() on MemoryRegion that you get 
from hostmem backend.
But question is what are you trying to achieve with sync
  1. data persistence in case of QEMU crash
  2. data persistence in case of host crash

for the former you do not need explicit sync as memory buffers should be 
flushed to disk by kernel
if you put backend on nvdimm, you should get 2 without sync as well (see 
pmem=on property)

just do not forget that sync is not free, so if #1 is acceptable I'd avoid 
explicit sync.


> Please point out where I am misunderstanding.
> 
> Thanks,
> eric
> 
> ________________________________
> From: Igor Mammedov <imammedo@redhat.com>
> Sent: Monday, May 3, 2021 12:07 PM
> To: Eric DeVolder <eric.devolder@oracle.com>
> Cc: ehabkost@redhat.com <ehabkost@redhat.com>; mst@redhat.com 
> <mst@redhat.com>; Konrad Wilk <konrad.wilk@oracle.com>; qemu-devel@nongnu.org 
> <qemu-devel@nongnu.org>; pbonzini@redhat.com <pbonzini@redhat.com>; Boris 
> Ostrovsky <boris.ostrovsky@oracle.com>; rth@twiddle.net <rth@twiddle.net>; 
> jusual@redhat.com <jusual@redhat.com>
> Subject: Re: [PATCH v2 3/7] ACPI ERST: support for ACPI ERST feature
> 
> On Mon, 3 May 2021 15:49:28 +0000
> Eric DeVolder <eric.devolder@oracle.com> wrote:
> 
> > Igor,
> > I've rebased the original patches on to qemu-v6.0.0-rc4, and finally have 
> > everything working as it previously did.
> > I've started now to work to incorporate the HostMemoryBackendFile; that is 
> > progressing.
> > My question for you today is with regard to placing ERST device on PCI. The 
> > PCI example provided is a template device, and while I do find that 
> > helpful, I still do not understand how the ERST Actions, which contain GAS 
> > for describing the register accesses, would be patched/linked when a PCI 
> > bar is assigned. Or is there perhaps another way of obtaining the PCI BAR 
> > using ACPI semantics?  
> 
> current order of initialization is,
>  0. QEMU builds initial ACPI tables (unpatched, mainly used to gauge total 
> size of ACPI tables) and starts guest
>  1. guest firmware initializes PCI devices (including BARs)
>  2. guest reads ACPI tables from QEMU(via fwcfg)
>  2.1 reading ACPI tables traps into QEMU and QEMU rebuilds all ACPI tables 
> (including ERST)
>       at this time one can get info from PCI devices (probably 
> pci_get_bar_addr() is what you are looking for)
>       that were initialized by firmware and build tables using address.
>       Maybe it will need dynamic tables patching but lets get to that only if 
> rebuilding table won't be enough
> 
> 
> 
> > Thanks,
> > eric
> >
> > ________________________________
> > From: Igor Mammedov <imammedo@redhat.com>
> > Sent: Wednesday, April 14, 2021 4:17 AM
> > To: Eric DeVolder <eric.devolder@oracle.com>
> > Cc: ehabkost@redhat.com <ehabkost@redhat.com>; mst@redhat.com 
> > <mst@redhat.com>; Konrad Wilk <konrad.wilk@oracle.com>; 
> > qemu-devel@nongnu.org <qemu-devel@nongnu.org>; pbonzini@redhat.com 
> > <pbonzini@redhat.com>; Boris Ostrovsky <boris.ostrovsky@oracle.com>; 
> > rth@twiddle.net <rth@twiddle.net>; jusual@redhat.com <jusual@redhat.com>
> > Subject: Re: [PATCH v2 3/7] ACPI ERST: support for ACPI ERST feature
> >
> > On Fri, 9 Apr 2021 15:54:47 +0000
> > Eric DeVolder <eric.devolder@oracle.com> wrote:
> >  
> > > Hi Igor,
> > > Thank you for reviewing. I've responded inline below.
> > > eric
> > >
> > > ________________________________
> > > From: Igor Mammedov <imammedo@redhat.com>
> > > Sent: Tuesday, April 6, 2021 2:31 PM
> > > To: Eric DeVolder <eric.devolder@oracle.com>
> > > Cc: mst@redhat.com <mst@redhat.com>; marcel.apfelbaum@gmail.com 
> > > <marcel.apfelbaum@gmail.com>; pbonzini@redhat.com <pbonzini@redhat.com>; 
> > > rth@twiddle.net <rth@twiddle.net>; ehabkost@redhat.com 
> > > <ehabkost@redhat.com>; qemu-devel@nongnu.org <qemu-devel@nongnu.org>; 
> > > Boris Ostrovsky <boris.ostrovsky@oracle.com>; kwilk@oracle.com 
> > > <kwilk@oracle.com>
> > > Subject: Re: [PATCH v2 3/7] ACPI ERST: support for ACPI ERST feature
> > >
> > > On Mon,  8 Feb 2021 15:57:55 -0500
> > > Eric DeVolder <eric.devolder@oracle.com> wrote:
> > >  
> > > > This change implements the support for the ACPI ERST feature[1,2].
> > > >
> > > > The size of the ACPI ERST storage is declared via the QEMU
> > > > global parameter acpi-erst.size. The size can range from 64KiB
> > > > to to 64MiB. The default is 64KiB.
> > > >
> > > > The location of the ACPI ERST storage backing file is delared
> > > > via the QEMU global parameter acpi-erst.filename. The default
> > > > is acpi-erst.backing.
> > > >
> > > > [1] "Advanced Configuration and Power Interface Specification",
> > > >     version 6.2, May 2017.
> > > >     https://www.uefi.org/sites/default/files/resources/ACPI_6_2.pdf
> > > >
> > > > [2] "Unified Extensible Firmware Interface Specification",
> > > >     version 2.8, March 2019.
> > > >     
> > > > https://uefi.org/sites/default/files/resources/UEFI_Spec_2_8_final.pdf
> > > >
> > > > Signed-off-by: Eric DeVolder <eric.devolder@oracle.com>  
> > >
> > > items 2/4/5 from v1 review still need to be addressed.
> > >  
> > > >
> > > > 2. patch is too big to review, please split it up in smaller chunks.
> > > >
> > > > EJD: Done.  
> > >
> > > (separating a header and a makefile rule doesn't make much sense)
> > >
> > > it should be split at least on part that implements device model and ACPI 
> > > parts
> > >
> > > EJD: I'll rebase this patch set on qemu-6 and accommodate your 
> > > suggestions with how to split/organize the patch set.
> > >
> > > [...]  
> > > >
> > > > 4. Maybe instead of SYSBUS device, implement it as a PCI device and
> > > >    use its BAR/control registers for pstore storage and control 
> > > > interface.
> > > >    It could save you headache of picking address where to map it +
> > > >    it would take care of migration part automatically, as firmware
> > > >    would do it for you and then QEMU could pickup firmware programmed
> > > >    address and put it into ERST table.
> > > > EJD: Thanks for the idea. For now I've left it as a SYSBUS device; we 
> > > > can revisit as needed.  
> > >
> > > I would really prefer to see a PCI version (current way is just a hack)
> > >
> > > EJD: I understand, I don't like the base address problem either. Is there 
> > > an example PCI device that gets its base address assigned during ACPI 
> > > setup that I could reference and pattern this work after? I've been using 
> > > SYSBUS as that most closely mimics the real hardware implementations I've 
> > > studied in order to produce this code.
> > > EJD: I thought my inexperience with authoring QEMU devices was the 
> > > primary problem in establishing a solution for the base address. 
> > > Otherwise, this thing only needs a single 4KiB page (for the 2 registers 
> > > + exchange buffer) exposed.  
> >
> > I don't recall if we merged example PCI device in QEMU, but someone worked 
> > on it before.
> > Google search yields following:
> >  
> > https://github.com/grandemk/qemu_devices/commit/ba8d38a858ba63ef4d419a926f58328b9675fc98
> >
> >  
> > > > 5. instead of dealing with file for storage directly, reuse hostmem 
> > > > backend
> > > >    to provide it to for your device. ex: pc-dimm. i.e. split device
> > > >    on frontend and backend
> > > >
> > > > EJD: I had looked into that prior to posting v1. The entire ERST 
> > > > storage is not memory mapped, just an exchange buffer. So the hostmem 
> > > > backend is not suitable for this purpose.  
> > >
> > > Is there a compelling reason why it can't be memory mapped?
> > >
> > > EJD: Well, this ERST device I've coded pretty much follows the ACPI ERST 
> > > spec verbatim. As it stands today, the spec doesn't provide a way to 
> > > report the total size of the persistent storage behind the interface; you 
> > > know when storage is full only when you receive an Out Of Storage error 
> > > code upon write. In a sense, that allows the size of the storage to vary 
> > > greatly and be implemented in any way needed (ie actual hardware, this 
> > > has tended to be in the 64KiB range when it is carved out of system 
> > > parallel flash memory, but some hardware uses serial flash as well). In 
> > > virtual environments, it can be of any size, and we at Oracle have 
> > > intentions of heavily utilizing ACPI ERST to stuff all kinds of 
> > > diagnostic information into it, thus wanting the storage to be very 
> > > large. By not actually exposing/memory-mapping the storage, the issue of 
> > > where to drop it in the memory map goes away (yes a PCI BAR could solve 
> > > this).
> > > EJD: But at the end of the day, could this storage be memory mapped? I 
> > > suppose it could be, but then that rather circumvents the entire need for 
> > > the ACPI ERST interface to start with. Linux and Windows both already 
> > > know how to utilize ACPI ERST.  
> >
> > Maybe I wasn't clear on it, I did not propose to map storage into guest.
> > Only use MemoryRegion provided by backend inside of your device.
> > This way you can drop all file related code from your patch,
> > and just work with read/store info from/to memory directly.
> >
> > [...]
> >  
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]