qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Steven Sistare <steven.sistare@oracle.com>
To: "Duan, Zhenzhong" <zhenzhong.duan@intel.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "alex.williamson@redhat.com" <alex.williamson@redhat.com>,
	"clg@redhat.com" <clg@redhat.com>
Subject: Re: [PATCH] vfio/container: Remap only populated parts in a section
Date: Tue, 2 Sep 2025 09:10:40 -0400	[thread overview]
Message-ID: <0026017b-770e-467b-ab7d-98cac1c70463@oracle.com> (raw)
In-Reply-To: <IA3PR11MB91363501F1A6ED40098AF8249207A@IA3PR11MB9136.namprd11.prod.outlook.com>

On 8/31/2025 10:13 PM, Duan, Zhenzhong wrote:
>> -----Original Message-----
>> From: Steven Sistare <steven.sistare@oracle.com>
>> Subject: Re: [PATCH] vfio/container: Remap only populated parts in a section
>>
>> On 8/13/2025 11:24 PM, Zhenzhong Duan wrote:
>>> If there are multiple containers and unmap-all fails for some container, we
>>> need to remap vaddr for the other containers for which unmap-all
>> succeeded.
>>> When ram discard is enabled, we should only remap populated parts in a
>>> section instead of the whole section.
>>>
>>> Export vfio_ram_discard_notify_populate() and use it to do population.
>>>
>>> Fixes: eba1f657cbb1 ("vfio/container: recover from unmap-all-vaddr
>> failure")
>>> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
>>> ---
>>> btw: I didn't find easy to test this corner case, only code inspecting
>>
>> Thanks Zhenzhong, this looks correct.
>>
>> However, I never liked patch
>>    eba1f657cbb1 ("vfio/container: recover from unmap-all-vaddr failure")
>>
>> I think it adds too much complexity for a rare case.  In fact, if we
>> examine all the possible error return codes, I believe they all would
>> be caused by other qemu application bugs, or kernel bugs:
>>
>> vfio_dma_do_unmap()
>>    returns -EBUSY if an mdev exists.  qemu blocks live update blocker
>>      when mdev is present.  If this occurs, the blocker has a bug.
>>    returns -EINVAL if the vaddr was already invalidated.  qemu already
>>      invalidated it, or never remapped the vaddr after a previous live
>>      update.  Both are qemu bugs.
>>
>> iopt_unmap_all
>>    iopt_unmap_iova_range
>>      -EBUSY - qemu is concurrently performing other dma map or unmap
>>               operations.  a bug.
>>
>>      -EDEADLOCK - Something is not responding to unmap requests.
>>
>> Therefore, I think we should just revert eba1f657cbb1, and assert that
>> the qemu vfio_dma_unmap_vaddr_all() call succeeds.
>>
>> Thoughts?
> 
> I agree it's a rare case and your suggestion will make code simple, but I feel it's aggressive to kill QEMU instance if live update fails, try to restore and keep current instance running is important in cloud env and looks more moderate.

OK.

Reviewed-by: Steve Sistare <steven.sistare@oracle.com>

(but you should also seek an RB from someone who is more familiar with ram discard and
its callbacks).

- Steve


  reply	other threads:[~2025-09-02 13:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-14  3:24 [PATCH] vfio/container: Remap only populated parts in a section Zhenzhong Duan
2025-08-28 12:28 ` Steven Sistare
2025-09-01  2:13   ` Duan, Zhenzhong
2025-09-02 13:10     ` Steven Sistare [this message]
2025-09-05  9:04       ` Duan, Zhenzhong
2025-09-05 10:17         ` David Hildenbrand
2025-09-08  6:18           ` Duan, Zhenzhong
2025-09-26  2:26           ` Duan, Zhenzhong
2025-09-01 11:12   ` Cédric Le Goater

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=0026017b-770e-467b-ab7d-98cac1c70463@oracle.com \
    --to=steven.sistare@oracle.com \
    --cc=alex.williamson@redhat.com \
    --cc=clg@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=zhenzhong.duan@intel.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).