All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Alexander Graf <graf@amazon.com>, Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>,
	Eduardo Habkost <eduardo@habkost.net>,
	"Daniel P . Berrange" <berrange@redhat.com>,
	Eric Blake <eblake@redhat.com>,
	Philippe Mathieu-Daude <philmd@linaro.org>,
	Peter Xu <peterx@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>,
	Ashish Kalra <ashish.kalra@amd.com>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	Stefan Hajnoczi <stefanha@gmail.com>
Subject: Re: [PATCH v4] hostmem-file: add offset option
Date: Tue, 4 Apr 2023 10:29:19 +0200	[thread overview]
Message-ID: <a0710fac-fe6d-364d-56ae-1f0b116b44bf@redhat.com> (raw)
In-Reply-To: <b3e4a295-f233-9a49-2220-9ad4638e6c65@amazon.com>

>>> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
>>
>> The change itself looks good to me, but I do think some other QEMU code
>> that ends up working on the RAMBlock is not prepared yet. Most probably,
>> because we never ended up using fd with an offset as guest RAM.
>>
>> We don't seem to be remembering that offset in the RAMBlock. First, I
>> thought block->offset would be used for that, but that's just the offset
>> in the ram_addr_t space. Maybe we need a new "block->fd_offset" to
>> remember the offset (unless I am missing something).
>>
>> The real offset in the file would be required at least in two cases I
>> can see (whenever we essentially end up calling mmap() on the fd again):
>>
>> 1) qemu_ram_remap(): We'd have to add the file offset on top of the
>> calculated offset.
> 
> 
> This one is a bit tricky to test, as we're only running into that code
> path with KVM when we see an #MCE. But it's trivial, so I'm confident it
> will work as expected.
> 

Indeed.

> 
>>
>> 2) vhost-user: most probably whenever we set the mmap_offset. For
>> example, in vhost_user_fill_set_mem_table_msg() we'd similarly have to
>> add the file_offset on top of the calculated offset.
>> vhost_user_get_mr_data() should most probably do that.
> 
> 
> I agree - adding the offset as part of get_mr_data() is sufficient. I
> have validated it works correctly with QEMU's vhost-user-blk target.
> 
> I think the changes are still obvious enough that I'll fold them all
> into a single patch.

Most probably good enough. Having the offset part separately as a fix 
for ed5d001916 ("multi-process: setup memory manager for remote device") 
could be beneficial, though.

Thanks Alex!

-- 
Thanks,

David / dhildenb



      reply	other threads:[~2023-04-04  8:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-01 12:42 [PATCH v4] hostmem-file: add offset option Alexander Graf
2023-04-01 17:47 ` Stefan Hajnoczi
2023-04-03  7:13   ` David Hildenbrand
2023-04-03 15:49     ` Peter Xu
2023-04-03 18:27       ` David Hildenbrand
2023-04-03 22:11     ` Alexander Graf
2023-04-04  8:29       ` David Hildenbrand [this message]

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=a0710fac-fe6d-364d-56ae-1f0b116b44bf@redhat.com \
    --to=david@redhat.com \
    --cc=armbru@redhat.com \
    --cc=ashish.kalra@amd.com \
    --cc=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=graf@amazon.com \
    --cc=imammedo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=stefanha@redhat.com \
    --cc=thomas.lendacky@amd.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.