lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 14 Oct 2013 12:13:48 -0500
From:	Scott Wood <scottwood@...escale.com>
To:	Yoder Stuart-B08248 <B08248@...escale.com>
CC:	Kim Phillips <kim.phillips@...aro.org>,
	Wood Scott-B07421 <B07421@...escale.com>,
	"alex.williamson@...hat.com" <alex.williamson@...hat.com>,
	Bhushan Bharat-R65777 <R65777@...escale.com>,
	"christoffer.dall@...aro.org" <christoffer.dall@...aro.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"a.motakis@...tualopensystems.com" <a.motakis@...tualopensystems.com>,
	"agraf@...e.de" <agraf@...e.de>,
	Sethi Varun-B16395 <B16395@...escale.com>,
	"peter.maydell@...aro.org" <peter.maydell@...aro.org>,
	"santosh.shukla@...aro.org" <santosh.shukla@...aro.org>,
	"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
	"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>
Subject: Re: [PATCH 3/4] VFIO: pci: amend vfio-pci for explicit binding via
 sysfs only

On Mon, 2013-10-14 at 08:01 -0500, Yoder Stuart-B08248 wrote:
> 
> > -----Original Message-----
> > From: Kim Phillips [mailto:kim.phillips@...aro.org]
> > Sent: Friday, October 11, 2013 6:17 PM
> > To: Wood Scott-B07421
> > Cc: Bhushan Bharat-R65777; Wood Scott-B07421; Yoder Stuart-B08248;
> > christoffer.dall@...aro.org; alex.williamson@...hat.com; linux-
> > kernel@...r.kernel.org; a.motakis@...tualopensystems.com; agraf@...e.de;
> > Sethi Varun-B16395; peter.maydell@...aro.org; santosh.shukla@...aro.org;
> > kvm@...r.kernel.org; gregkh@...uxfoundation.org
> > Subject: Re: [PATCH 3/4] VFIO: pci: amend vfio-pci for explicit binding
> > via sysfs only
> > 
> > On Fri, 11 Oct 2013 15:43:40 -0500
> > Scott Wood <scottwood@...escale.com> wrote:
> > 
> > > On Fri, 2013-10-11 at 01:27 -0500, Kim Phillips wrote:
> > > > Force the vfio-pci driver to only be bound explicitly via sysfs to
> > avoid
> > > > conflics with other drivers in the event of a hotplug.
> > > >
> > > > Signed-off-by: Kim Phillips <kim.phillips@...aro.org>
> > > > ---
> > > >  drivers/vfio/pci/vfio_pci.c | 3 +++
> > > >  1 file changed, 3 insertions(+)
> > > >
> > > > diff --git a/drivers/vfio/pci/vfio_pci.c
> > b/drivers/vfio/pci/vfio_pci.c
> > > > index 6ab71b9..bdd7833 100644
> > > > --- a/drivers/vfio/pci/vfio_pci.c
> > > > +++ b/drivers/vfio/pci/vfio_pci.c
> > > > @@ -901,6 +901,9 @@ static struct pci_driver vfio_pci_driver = {
> > > >  	.probe		= vfio_pci_probe,
> > > >  	.remove		= vfio_pci_remove,
> > > >  	.err_handler	= &vfio_err_handlers,
> > > > +	.driver = {
> > > > +		.sysfs_bind_only = true,
> > > > +	},
> > > >  };
> > > >
> > > >  static void __exit vfio_pci_cleanup(void)
> > >
> > > You also need to add a PCI_ANY_ID match in order to be able to get rid
> > > of the new_id usage.
> > 
> > thanks - see below.
> > 
> > Can someone with a PCI bus test this?  Bharat?
> > 
> > Kim
> > 
> > From a8d6c12f2ec763c2ac7fd384a3397c370cc1b932 Mon Sep 17 00:00:00 2001
> > From: Kim Phillips <kim.phillips@...aro.org>
> > Date: Thu, 10 Oct 2013 22:16:34 -0500
> > Subject: [PATCH 3/4 v2] VFIO: pci: amend vfio-pci for explicit binding
> > via sysfs
> >  only
> > 
> > Force the vfio-pci driver to only be bound explicitly via sysfs to avoid
> > conflics with other drivers in the event of a hotplug.  Also replace
> > the only dynamic ids assignment with a table with a single PCI_ANY_ID
> > entry since writing the sysfs bind file without having to specify ids
> > via the new_id file first should no longer be necessary.
> > 
> > Signed-off-by: Kim Phillips <kim.phillips@...aro.org>
> > ---
> >  drivers/vfio/pci/vfio_pci.c | 12 +++++++++++-
> >  1 file changed, 11 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
> > index 6ab71b9..c5b434f 100644
> > --- a/drivers/vfio/pci/vfio_pci.c
> > +++ b/drivers/vfio/pci/vfio_pci.c
> > @@ -895,12 +895,22 @@ static struct pci_error_handlers vfio_err_handlers
> > = {
> >  	.error_detected = vfio_pci_aer_err_detected,
> >  };
> > 
> > +static DEFINE_PCI_DEVICE_TABLE(vfio_pci_id_table) = {
> > +        { PCI_DEVICE(PCI_ANY_ID, PCI_ANY_ID) },
> > +        { 0 }
> > +};
> > +
> > +MODULE_DEVICE_TABLE(pci, vfio_pci_id_table);
> > +
> >  static struct pci_driver vfio_pci_driver = {
> >  	.name		= "vfio-pci",
> > -	.id_table	= NULL, /* only dynamic ids */
> > +	.id_table	= vfio_pci_id_table, /* no dynamic ids */
> >  	.probe		= vfio_pci_probe,
> >  	.remove		= vfio_pci_remove,
> >  	.err_handler	= &vfio_err_handlers,
> > +	.driver = {
> > +		.sysfs_bind_only = true, /* bind only via sysfs */
> > +	},
> >  };
> > 
> >  static void __exit vfio_pci_cleanup(void)
> 
> sysfs bind only seems orthogonal to PCI_ANY_ID...I would have split
> those into 2 different patches.

The mechanisms are orthogonal, but the change in use case is not.
sysfs_bind_only is required for PCI_ANY_ID to be safely used here.  I
don't see a huge need to split them, but if they are split then
sysfs_bind_only must be first.

-Scott



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ