From: Jason Gunthorpe <jgg@nvidia.com>
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@huawei.com,
liulongfang@huawei.com
Subject: Re: [PATCH] vfio: Split migration ops from main device ops
Date: Mon, 23 May 2022 20:28:20 -0300 [thread overview]
Message-ID: <20220523232820.GM1343366@nvidia.com> (raw)
In-Reply-To: <20220523112500.3a227814.alex.williamson@redhat.com>
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.
Jason
next prev parent reply other threads:[~2022-05-23 23:28 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 [this message]
2022-05-24 7:30 ` Shameerali Kolothum Thodi
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=20220523232820.GM1343366@nvidia.com \
--to=jgg@nvidia.com \
--cc=alex.williamson@redhat.com \
--cc=cohuck@redhat.com \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=liulongfang@huawei.com \
--cc=maorg@nvidia.com \
--cc=shameerali.kolothum.thodi@huawei.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