public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>
To: Jason Gunthorpe <jgg@nvidia.com>,
	Alex Williamson <alex.williamson@redhat.com>
Cc: Yishai Hadas <yishaih@nvidia.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"maorg@nvidia.com" <maorg@nvidia.com>,
	"cohuck@redhat.com" <cohuck@redhat.com>,
	"kevin.tian@intel.com" <kevin.tian@intel.com>,
	liulongfang <liulongfang@huawei.com>
Subject: RE: [PATCH] vfio: Split migration ops from main device ops
Date: Tue, 24 May 2022 07:30:55 +0000	[thread overview]
Message-ID: <cdc5ea6bd40745d0ab86ef790a893ddf@huawei.com> (raw)
In-Reply-To: <20220523232820.GM1343366@nvidia.com>



> -----Original Message-----
> From: Jason Gunthorpe [mailto:jgg@nvidia.com]
> Sent: 24 May 2022 00:28
> To: Alex Williamson <alex.williamson@redhat.com>
> Cc: Yishai Hadas <yishaih@nvidia.com>; kvm@vger.kernel.org;
> maorg@nvidia.com; cohuck@redhat.com; kevin.tian@intel.com; Shameerali
> Kolothum Thodi <shameerali.kolothum.thodi@huawei.com>; liulongfang
> <liulongfang@huawei.com>
> Subject: Re: [PATCH] vfio: Split migration ops from main device ops
> 
> On Mon, May 23, 2022 at 11:25:00AM -0600, Alex Williamson wrote:
> > On Sun, 22 May 2022 12:47:56 +0300
> > Yishai Hadas <yishaih@nvidia.com> wrote:
> >
> > > vfio core checks whether the driver sets some migration op (e.g.
> > > set_state/get_state) and accordingly calls its op.
> > >
> > > However, currently mlx5 driver sets the above ops without regards to
> > > its migration caps.
> > >
> > > This might lead to unexpected usage/Oops if user space may call to
> > > the above ops even if the driver doesn't support migration. As for
> > > example, the migration state_mutex is not initialized in that case.
> > >
> > > The cleanest way to manage that seems to split the migration ops
> > > from the main device ops, this will let the driver setting them
> > > separately from the main ops when it's applicable.
> > >
> > > As part of that, cleaned-up HISI driver to match this scheme.
> > >
> > > This scheme may enable down the road to come with some extra group
> > > of ops (e.g. DMA log) that can be set without regards to the other
> > > options based on driver caps.
> >
> > It seems like the hisi-acc driver already manages this by registering
> > different structs based on the device migration capabilities, why is
> > that not the default solution here?  Or of course the mlx5 driver
> > could test the migration capabilities before running into the weeds.
> > We also have vfio_device.migration_flags which could factor in here as well.
> 
> It starts to hit combinatoral explosion when the next patches add ops for dirty
> logging that may be optional too. This is simpler and simpifies the hisi driver to
> remove the 2nd ops too.

Hmm..but for hisi driver we still need to have those mmap/ioctl/read/write override 
functions to restrict the BAR region exposure to Guest in case of migration support. So I
am not sure we can get rid of two ops easily there(Though, we could add an explicit
check for the migration support in those callbacks).

Thanks,
Shameer



      reply	other threads:[~2022-05-24  7:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-22  9:47 [PATCH] vfio: Split migration ops from main device ops Yishai Hadas
2022-05-22 14:21 ` kernel test robot
2022-05-22 15:03   ` Yishai Hadas
2022-05-23  9:17     ` Shameerali Kolothum Thodi
2022-05-22 17:54 ` kernel test robot
2022-05-23 17:25 ` Alex Williamson
2022-05-23 23:28   ` Jason Gunthorpe
2022-05-24  7:30     ` Shameerali Kolothum Thodi [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=cdc5ea6bd40745d0ab86ef790a893ddf@huawei.com \
    --to=shameerali.kolothum.thodi@huawei.com \
    --cc=alex.williamson@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=liulongfang@huawei.com \
    --cc=maorg@nvidia.com \
    --cc=yishaih@nvidia.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