Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Steven Sistare <steven.sistare@oracle.com>
Cc: kvm@vger.kernel.org, Cornelia Huck <cohuck@redhat.com>,
	Jason Gunthorpe <jgg@nvidia.com>
Subject: Re: [PATCH V3 1/5] vfio/type1: exclude mdevs from VFIO_UPDATE_VADDR
Date: Wed, 14 Dec 2022 13:29:34 -0700	[thread overview]
Message-ID: <20221214132934.28bf308b.alex.williamson@redhat.com> (raw)
In-Reply-To: <e03a0787-4bd3-de21-9439-a91db71bd05a@oracle.com>

On Wed, 14 Dec 2022 15:20:44 -0500
Steven Sistare <steven.sistare@oracle.com> wrote:

> On 12/14/2022 3:03 PM, Steven Sistare wrote:
> > On 12/14/2022 2:40 PM, Alex Williamson wrote:  
> >> On Wed, 14 Dec 2022 11:22:47 -0800
> >> Steve Sistare <steven.sistare@oracle.com> wrote:
> >>> @@ -3080,6 +3112,11 @@ static int vfio_iommu_type1_dma_rw_chunk(struct vfio_iommu *iommu,
> >>>  	size_t offset;
> >>>  	int ret;
> >>>  
> >>> +	if (iommu->vaddr_invalid_count) {
> >>> +		WARN_ONCE(1, "mdev not allowed with VFIO_UPDATE_VADDR\n");
> >>> +		return -EIO;
> >>> +	}  
> >>
> >> Same optimization above, but why are we letting the code iterate this
> >> multiple times in the _chunk function rather than testing once in the
> >> caller?  Thanks,  
> > 
> > An oversight, I'll hoist it.  
> 
> It's actually a little nicer to leave the test here.  The first call to
> here returns failure, and the caller exits the loop.  
> 
> Hoisting it requires jumping to an out label that releases the iommu lock.
> 
> Which do you prefer?

The failure might exit on the first chunk, but non-failure incurs
overhead per chunk.  I suspect we're not often iterating multiple
chunks, but I don't mind the goto in order to avoid that possibility.
Thanks,

Alex


  reply	other threads:[~2022-12-14 20:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-14 19:22 [PATCH V3 0/5] fixes for virtual address update Steve Sistare
2022-12-14 19:22 ` [PATCH V3 1/5] vfio/type1: exclude mdevs from VFIO_UPDATE_VADDR Steve Sistare
2022-12-14 19:40   ` Alex Williamson
2022-12-14 20:03     ` Steven Sistare
2022-12-14 20:20       ` Steven Sistare
2022-12-14 20:29         ` Alex Williamson [this message]
2022-12-14 19:22 ` [PATCH V3 2/5] vfio/type1: prevent locked_vm underflow Steve Sistare
2022-12-14 20:03   ` Alex Williamson
2022-12-14 20:11     ` Steven Sistare
2022-12-14 19:22 ` [PATCH V3 3/5] vfio/type1: revert "block on invalid vaddr" Steve Sistare
2022-12-14 19:22 ` [PATCH V3 4/5] vfio/type1: revert "implement notify callback" Steve Sistare
2022-12-14 19:22 ` [PATCH V3 5/5] vfio: revert "iommu driver " Steve Sistare

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=20221214132934.28bf308b.alex.williamson@redhat.com \
    --to=alex.williamson@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=kvm@vger.kernel.org \
    --cc=steven.sistare@oracle.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