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]
Message-ID: <20200219131102.GN31668@ziepe.ca>
Date:   Wed, 19 Feb 2020 09:11:02 -0400
From:   Jason Gunthorpe <jgg@...pe.ca>
To:     Tiwei Bie <tiwei.bie@...el.com>
Cc:     mst@...hat.com, jasowang@...hat.com, linux-kernel@...r.kernel.org,
        kvm@...r.kernel.org, virtualization@...ts.linux-foundation.org,
        netdev@...r.kernel.org, shahafs@...lanox.com,
        rob.miller@...adcom.com, haotian.wang@...ive.com,
        eperezma@...hat.com, lulu@...hat.com, parav@...lanox.com,
        rdunlap@...radead.org, hch@...radead.org, jiri@...lanox.com,
        hanand@...inx.com, mhabets@...arflare.com,
        maxime.coquelin@...hat.com, lingshan.zhu@...el.com,
        dan.daly@...el.com, cunming.liang@...el.com, zhihong.wang@...el.com
Subject: Re: [PATCH] vhost: introduce vDPA based backend

On Wed, Feb 19, 2020 at 10:52:38AM +0800, Tiwei Bie wrote:
> > > +static int __init vhost_vdpa_init(void)
> > > +{
> > > +	int r;
> > > +
> > > +	idr_init(&vhost_vdpa.idr);
> > > +	mutex_init(&vhost_vdpa.mutex);
> > > +	init_waitqueue_head(&vhost_vdpa.release_q);
> > > +
> > > +	/* /dev/vhost-vdpa/$vdpa_device_index */
> > > +	vhost_vdpa.class = class_create(THIS_MODULE, "vhost-vdpa");
> > > +	if (IS_ERR(vhost_vdpa.class)) {
> > > +		r = PTR_ERR(vhost_vdpa.class);
> > > +		goto err_class;
> > > +	}
> > > +
> > > +	vhost_vdpa.class->devnode = vhost_vdpa_devnode;
> > > +
> > > +	r = alloc_chrdev_region(&vhost_vdpa.devt, 0, MINORMASK + 1,
> > > +				"vhost-vdpa");
> > > +	if (r)
> > > +		goto err_alloc_chrdev;
> > > +
> > > +	cdev_init(&vhost_vdpa.cdev, &vhost_vdpa_fops);
> > > +	r = cdev_add(&vhost_vdpa.cdev, vhost_vdpa.devt, MINORMASK + 1);
> > > +	if (r)
> > > +		goto err_cdev_add;
> > 
> > It is very strange, is the intention to create a single global char
> > dev?
> 
> No. It's to create a per-vdpa char dev named
> vhost-vdpa/$vdpa_device_index in dev.
> 
> I followed the code in VFIO which creates char dev
> vfio/$GROUP dynamically, e.g.:
> 
> https://github.com/torvalds/linux/blob/b1da3acc781c/drivers/vfio/vfio.c#L2164-L2180
> https://github.com/torvalds/linux/blob/b1da3acc781c/drivers/vfio/vfio.c#L373-L387
> https://github.com/torvalds/linux/blob/b1da3acc781c/drivers/vfio/vfio.c#L1553
> 
> Is it something unwanted?

Yes it is unwanted. This is some special pattern for vfio's unique
needs. 

Since this has a struct device for each char dev instance please use
the normal cdev_device_add() driven pattern here, or justify why it
needs to be special like this.

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ