From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: jasowang@redhat.com, pbonzini@redhat.com, vkuznets@redhat.com,
qemu-devel@nongnu.org
Subject: Re: [PATCH v2 2/3] memory: Allow a MemoryRegion to be marked no_vhost
Date: Tue, 14 Jan 2020 09:52:37 -0500 [thread overview]
Message-ID: <20200114095157-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20200114112608.GF2812@work-vm>
On Tue, Jan 14, 2020 at 11:26:08AM +0000, Dr. David Alan Gilbert wrote:
> * Michael S. Tsirkin (mst@redhat.com) wrote:
> > On Mon, Jan 13, 2020 at 05:36:46PM +0000, Dr. David Alan Gilbert (git) wrote:
> > > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> > >
> > > Allow a memory region to be marked as 'no_vhost' and
> > > exclude that region from vhost's list build.
> > >
> > > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> >
> > I thought we agreed vfio needs this as well?
> > I'd rather this had some meaning not just "no vhost" ...
> > no_dma?
>
> VFIO tends to be unplugged on migration anyway (at the moment);
But it still should ignore synic, right?
> but I'm happy to change the name if everyone is happy with the rest of
> the series and we can agree on the new name,
>
> Dave
>
> > > ---
> > > hw/virtio/vhost.c | 3 ++-
> > > include/exec/memory.h | 21 +++++++++++++++++++++
> > > memory.c | 15 +++++++++++++++
> > > 3 files changed, 38 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> > > index 774d87d98e..462498bfe6 100644
> > > --- a/hw/virtio/vhost.c
> > > +++ b/hw/virtio/vhost.c
> > > @@ -402,7 +402,8 @@ static bool vhost_section(struct vhost_dev *dev, MemoryRegionSection *section)
> > > bool log_dirty = memory_region_get_dirty_log_mask(section->mr) &
> > > ~(1 << DIRTY_MEMORY_MIGRATION);
> > > result = memory_region_is_ram(section->mr) &&
> > > - !memory_region_is_rom(section->mr);
> > > + !memory_region_is_rom(section->mr) &&
> > > + !memory_region_get_no_vhost(section->mr);
> > >
> > > /* Vhost doesn't handle any block which is doing dirty-tracking other
> > > * than migration; this typically fires on VGA areas.
> > > diff --git a/include/exec/memory.h b/include/exec/memory.h
> > > index aef8123d48..f475c06d63 100644
> > > --- a/include/exec/memory.h
> > > +++ b/include/exec/memory.h
> > > @@ -394,6 +394,7 @@ struct MemoryRegion {
> > > bool ram_device;
> > > bool enabled;
> > > bool warning_printed; /* For reservations */
> > > + bool no_vhost;
> > > uint8_t vga_logging_count;
> > > MemoryRegion *alias;
> > > hwaddr alias_offset;
> > > @@ -1625,6 +1626,26 @@ void memory_region_set_readonly(MemoryRegion *mr, bool readonly);
> > > */
> > > void memory_region_set_nonvolatile(MemoryRegion *mr, bool nonvolatile);
> > >
> > > +/**
> > > + * memory_region_set_no_vhost: Make vhost ignore a memory region
> > > + *
> > > + * Makes vhost ignore a memory region, useful if it isn't real
> > > + * DMAble memory and is at inconvenient addresses
> > > + *
> > > + * @mr: the region being updated.
> > > + * @no_vhost: true to ignore
> > > + */
> > > +void memory_region_set_no_vhost(MemoryRegion *mr, bool no_vhost);
> > > +
> > > +/**
> > > + * memory_region_set_no_vhost: Test if memory region is marked no vhost
> > > + *
> > > + * Test if the no_vhost flag is set on the memory region
> > > + *
> > > + * @mr: the region being tested.
> > > + */
> > > +bool memory_region_get_no_vhost(const MemoryRegion *mr);
> > > +
> > > /**
> > > * memory_region_rom_device_set_romd: enable/disable ROMD mode
> > > *
> > > diff --git a/memory.c b/memory.c
> > > index d7b9bb6951..9371998e30 100644
> > > --- a/memory.c
> > > +++ b/memory.c
> > > @@ -2136,6 +2136,21 @@ void memory_region_set_nonvolatile(MemoryRegion *mr, bool nonvolatile)
> > > }
> > > }
> > >
> > > +void memory_region_set_no_vhost(MemoryRegion *mr, bool no_vhost)
> > > +{
> > > + if (mr->no_vhost != no_vhost) {
> > > + memory_region_transaction_begin();
> > > + mr->no_vhost = no_vhost;
> > > + memory_region_update_pending |= mr->enabled;
> > > + memory_region_transaction_commit();
> > > + }
> > > +}
> > > +
> > > +bool memory_region_get_no_vhost(const MemoryRegion *mr)
> > > +{
> > > + return mr->no_vhost;
> > > +}
> > > +
> > > void memory_region_rom_device_set_romd(MemoryRegion *mr, bool romd_mode)
> > > {
> > > if (mr->romd_mode != romd_mode) {
> > > --
> > > 2.24.1
> >
> --
> Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2020-01-14 14:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-13 17:36 [PATCH v2 0/3] exclude hyperv synic sections from vhost Dr. David Alan Gilbert (git)
2020-01-13 17:36 ` [PATCH v2 1/3] vhost: Add names to section rounded warning Dr. David Alan Gilbert (git)
2020-01-13 17:36 ` [PATCH v2 2/3] memory: Allow a MemoryRegion to be marked no_vhost Dr. David Alan Gilbert (git)
2020-01-14 7:19 ` Michael S. Tsirkin
2020-01-14 11:26 ` Dr. David Alan Gilbert
2020-01-14 14:52 ` Michael S. Tsirkin [this message]
2020-01-14 15:02 ` Alex Williamson
2020-01-13 17:36 ` [PATCH v2 3/3] hyperv/synic: Mark regions as no vhost Dr. David Alan Gilbert (git)
2020-01-13 18:13 ` [PATCH v2 0/3] exclude hyperv synic sections from vhost Paolo Bonzini
2020-01-13 18:58 ` Dr. David Alan Gilbert
2020-01-14 7:17 ` Michael S. Tsirkin
2020-01-17 12:35 ` Dr. David Alan Gilbert
2020-01-15 12:12 ` Roman Kagan
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=20200114095157-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=dgilbert@redhat.com \
--cc=jasowang@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=vkuznets@redhat.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;
as well as URLs for NNTP newsgroup(s).