Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1451913
| From | "Daniel P. Berrange" <berrange@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [Qemu-devel] [PATCH 6/7] qemu: Implement virtio-pstore device |
| Date | 2016-07-28 15:10 +0200 |
| Message-ID | <rZTex-6Gr-3@gated-at.bofh.it> (permalink) |
| References | <rZyD7-12s-9@gated-at.bofh.it> <rZyMN-164-23@gated-at.bofh.it> <rZH3H-6Lq-3@gated-at.bofh.it> <rZMmK-1PT-9@gated-at.bofh.it> <rZT4R-6ny-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, Jul 28, 2016 at 01:56:07PM +0100, Stefan Hajnoczi wrote:
> On Thu, Jul 28, 2016 at 02:39:53PM +0900, Namhyung Kim wrote:
> > On Thu, Jul 28, 2016 at 03:02:54AM +0300, Michael S. Tsirkin wrote:
> > > On Thu, Jul 28, 2016 at 12:08:30AM +0900, Namhyung Kim wrote:
> > > > +static ssize_t virtio_pstore_do_write(VirtIOPstore *s, struct iovec *out_sg,
> > > > + unsigned int out_num,
> > > > + struct virtio_pstore_req *req)
> > > > +{
> > > > + char path[PATH_MAX];
> > > > + int fd;
> > > > + ssize_t len;
> > > > + unsigned short type;
> > > > + int flags = O_WRONLY | O_CREAT;
> > > > +
> > > > + /* we already consume the req */
> > > > + iov_discard_front(&out_sg, &out_num, sizeof(*req));
> > > > +
> > > > + virtio_pstore_to_filename(s, path, sizeof(path), req);
> > > > +
> > > > + type = le16_to_cpu(req->type);
> > > > +
> > > > + if (type == VIRTIO_PSTORE_TYPE_DMESG) {
> > > > + flags |= O_TRUNC;
> > > > + } else if (type == VIRTIO_PSTORE_TYPE_CONSOLE) {
> > > > + flags |= O_APPEND;
> > > > + }
> > > > +
> > > > + fd = open(path, flags, 0644);
> > > > + if (fd < 0) {
> > > > + error_report("cannot open %s", path);
> > > > + return -1;
> > > > + }
> > > > + len = writev(fd, out_sg, out_num);
> > > > + close(fd);
> > > > +
> > > > + return len;
> > >
> > > All this is blocking VM until host io completes.
> >
> > Hmm.. I don't know about the internals of qemu. So does it make guest
> > stop? If so, that's what I want to do for _DMESG. :) As it's called
> > only on kernel oops I think it's admittable. But for _CONSOLE, it
> > needs to do asynchronously. Maybe I can add a thread to do the work.
>
> Please look at include/io/channel.h. QEMU is event-driven and tends to
> use asynchronous I/O instead of spawning threads. The include/io/ APIs
> allow you to do asynchronous I/O in the event loop.
That is true, except for I/O to/from plain files - the QIOChannelFile
impl doesn't do anything special (yet) to make that work correctly in
non-blocking mode. Of course that could be fixed...
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC/PATCHSET 0/7] virtio: Implement virtio pstore device (v2) Namhyung Kim <namhyung@kernel.org> - 2016-07-27 17:10 +0200
[PATCH 2/7] pstore/ram: Set pstore flags dynamically Namhyung Kim <namhyung@kernel.org> - 2016-07-27 17:20 +0200
[PATCH 4/7] virtio: Basic implementation of virtio pstore driver Namhyung Kim <namhyung@kernel.org> - 2016-07-27 17:20 +0200
[PATCH 6/7] qemu: Implement virtio-pstore device Namhyung Kim <namhyung@kernel.org> - 2016-07-27 17:20 +0200
Re: [PATCH 6/7] qemu: Implement virtio-pstore device "Michael S. Tsirkin" <mst@redhat.com> - 2016-07-28 02:10 +0200
Re: [PATCH 6/7] qemu: Implement virtio-pstore device Namhyung Kim <namhyung@kernel.org> - 2016-07-28 07:50 +0200
Re: [PATCH 6/7] qemu: Implement virtio-pstore device Stefan Hajnoczi <stefanha@gmail.com> - 2016-07-28 15:00 +0200
Re: [Qemu-devel] [PATCH 6/7] qemu: Implement virtio-pstore device "Daniel P. Berrange" <berrange@redhat.com> - 2016-07-28 15:10 +0200
Re: [Qemu-devel] [PATCH 6/7] qemu: Implement virtio-pstore device Namhyung Kim <namhyung@kernel.org> - 2016-07-30 10:50 +0200
Re: [Qemu-devel] [PATCH 6/7] qemu: Implement virtio-pstore device "Daniel P. Berrange" <berrange@redhat.com> - 2016-08-01 11:50 +0200
Re: [Qemu-devel] [PATCH 6/7] qemu: Implement virtio-pstore device Namhyung Kim <namhyung@kernel.org> - 2016-08-01 17:40 +0200
Re: [PATCH 6/7] qemu: Implement virtio-pstore device Steven Rostedt <rostedt@goodmis.org> - 2016-07-28 16:40 +0200
Re: [Qemu-devel] [PATCH 6/7] qemu: Implement virtio-pstore device "Daniel P. Berrange" <berrange@redhat.com> - 2016-07-28 15:30 +0200
Re: [Qemu-devel] [PATCH 6/7] qemu: Implement virtio-pstore device Namhyung Kim <namhyung@kernel.org> - 2016-07-30 11:00 +0200
Re: [Qemu-devel] [PATCH 6/7] qemu: Implement virtio-pstore device "Daniel P. Berrange" <berrange@redhat.com> - 2016-08-01 11:30 +0200
Re: [Qemu-devel] [PATCH 6/7] qemu: Implement virtio-pstore device Namhyung Kim <namhyung@kernel.org> - 2016-08-01 18:00 +0200
[PATCH 3/7] pstore: Manage buffer position for async write Namhyung Kim <namhyung@kernel.org> - 2016-07-27 17:20 +0200
[PATCH 1/7] pstore: Split pstore fragile flags Namhyung Kim <namhyung@kernel.org> - 2016-07-27 17:20 +0200
[PATCH 5/7] virtio-pstore: Support PSTORE_TYPE_CONSOLE Namhyung Kim <namhyung@kernel.org> - 2016-07-27 17:20 +0200
[PATCH 7/7] kvmtool: Implement virtio-pstore device Namhyung Kim <namhyung@kernel.org> - 2016-07-27 17:20 +0200
Re: [RFC/PATCHSET 0/7] virtio: Implement virtio pstore device (v2) "Michael S. Tsirkin" <mst@redhat.com> - 2016-07-28 00:20 +0200
Re: [RFC/PATCHSET 0/7] virtio: Implement virtio pstore device (v2) Namhyung Kim <namhyung@kernel.org> - 2016-07-28 04:50 +0200
csiph-web