[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/3] virtio: Basic implementation of virtio psto
From: |
Namhyung Kim |
Subject: |
Re: [Qemu-devel] [PATCH 1/3] virtio: Basic implementation of virtio pstore driver |
Date: |
Thu, 1 Sep 2016 09:03:06 +0900 |
User-agent: |
Mutt/1.7.0 (2016-08-17) |
Hi Michael,
On Wed, Aug 31, 2016 at 05:54:04PM +0300, Michael S. Tsirkin wrote:
> On Wed, Aug 31, 2016 at 05:08:00PM +0900, Namhyung Kim wrote:
> > The virtio pstore driver provides interface to the pstore subsystem so
> > that the guest kernel's log/dump message can be saved on the host
> > machine. Users can access the log file directly on the host, or on the
> > guest at the next boot using pstore filesystem. It currently deals with
> > kernel log (printk) buffer only, but we can extend it to have other
> > information (like ftrace dump) later.
> >
> > It supports legacy PCI device using single order-2 page buffer. It uses
> > two virtqueues - one for (sync) read and another for (async) write.
> > Since it cannot wait for write finished, it supports up to 128
> > concurrent IO. The buffer size is configurable now.
> >
> > Cc: Paolo Bonzini <address@hidden>
> > Cc: Radim Krčmář <address@hidden>
> > Cc: "Michael S. Tsirkin" <address@hidden>
> > Cc: Anthony Liguori <address@hidden>
> > Cc: Anton Vorontsov <address@hidden>
> > Cc: Colin Cross <address@hidden>
> > Cc: Kees Cook <address@hidden>
> > Cc: Tony Luck <address@hidden>
> > Cc: Steven Rostedt <address@hidden>
> > Cc: Ingo Molnar <address@hidden>
> > Cc: Minchan Kim <address@hidden>
> > Cc: Will Deacon <address@hidden>
> > Cc: address@hidden
> > Cc: address@hidden
> > Cc: address@hidden
> > Cc: address@hidden
> > Signed-off-by: Namhyung Kim <address@hidden>
> > ---
[SNIP]
> > +#define TYPE_TABLE_ENTRY(_entry) \
> > + { PSTORE_TYPE_##_entry, VIRTIO_PSTORE_TYPE_##_entry }
> > +
> > +struct type_table {
> > + int pstore;
> > + u16 virtio;
> > +} type_table[] = {
> > + TYPE_TABLE_ENTRY(DMESG),
> > +};
> > +
> > +#undef TYPE_TABLE_ENTRY
> > +
> > +
> > +static u16 to_virtio_type(struct virtio_pstore *vps, enum pstore_type_id
> > type)
> > +{
> > + unsigned int i;
> > +
> > + for (i = 0; i < ARRAY_SIZE(type_table); i++) {
> > + if (type == type_table[i].pstore)
> > + return cpu_to_virtio16(vps->vdev, type_table[i].virtio);
>
> Does this pass sparse checks? If yes I'm surprised - this clearly
> returns a virtio16 type.
Ah, didn't run sparse. Will change it to return a __le16 type
(according to your comment below).
>
>
> > + }
> > +
> > + return cpu_to_virtio16(vps->vdev, VIRTIO_PSTORE_TYPE_UNKNOWN);
> > +}
> > +
> > +static enum pstore_type_id from_virtio_type(struct virtio_pstore *vps, u16
> > type)
This one should be '__le16 type' as well.
> > +{
> > + unsigned int i;
> > +
> > + for (i = 0; i < ARRAY_SIZE(type_table); i++) {
> > + if (virtio16_to_cpu(vps->vdev, type) == type_table[i].virtio)
> > + return type_table[i].pstore;
> > + }
> > +
> > + return PSTORE_TYPE_UNKNOWN;
> > +}
> > +
[SNIP]
> > +
> > +struct virtio_pstore_req {
> > + __virtio16 cmd;
> > + __virtio16 type;
> > + __virtio32 flags;
> > + __virtio64 id;
> > + __virtio32 count;
> > + __virtio32 reserved;
> > +};
> > +
> > +struct virtio_pstore_res {
> > + __virtio16 cmd;
> > + __virtio16 type;
> > + __virtio32 ret;
> > +};
>
> Is there a reason to support legacy endian-ness?
> If not, you can just use __le formats.
I just didn't know what's the preferred type. Will change!
Thanks,
Namhyung
>
>
> > +struct virtio_pstore_fileinfo {
> > + __virtio64 id;
> > + __virtio32 count;
> > + __virtio16 type;
> > + __virtio16 unused;
> > + __virtio32 flags;
> > + __virtio32 len;
> > + __virtio64 time_sec;
> > + __virtio32 time_nsec;
> > + __virtio32 reserved;
> > +};
> > +
> > +struct virtio_pstore_config {
> > + __virtio32 bufsize;
> > +};
> > +
> > +#endif /* _LINUX_VIRTIO_PSTORE_H */
> > --
> > 2.9.3