All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tiwei Bie <tiwei.bie@intel.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: mst@redhat.com, jasowang@redhat.com,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org, shahafs@mellanox.com,
	rob.miller@broadcom.com, haotian.wang@sifive.com,
	eperezma@redhat.com, lulu@redhat.com, parav@mellanox.com,
	rdunlap@infradead.org, hch@infradead.org, jiri@mellanox.com,
	hanand@xilinx.com, mhabets@solarflare.com,
	maxime.coquelin@redhat.com, lingshan.zhu@intel.com,
	dan.daly@intel.com, cunming.liang@intel.com,
	zhihong.wang@intel.com
Subject: Re: [PATCH] vhost: introduce vDPA based backend
Date: Thu, 20 Feb 2020 10:42:21 +0800	[thread overview]
Message-ID: <20200220024220.GA43609@___> (raw)
In-Reply-To: <20200219131102.GN31668@ziepe.ca>

On Wed, Feb 19, 2020 at 09:11:02AM -0400, Jason Gunthorpe wrote:
> 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.

I see. Thanks! I will embed the cdev in each vhost_vdpa
structure directly.

Regards,
Tiwei

> 
> Jason

      reply	other threads:[~2020-02-20  2:42 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-31  3:36 [PATCH] vhost: introduce vDPA based backend Tiwei Bie
2020-01-31  3:56 ` Randy Dunlap
2020-01-31  5:12   ` Randy Dunlap
2020-01-31  5:54     ` Tiwei Bie
2020-01-31  5:52   ` Tiwei Bie
2020-02-04  3:30 ` Jason Wang
2020-02-04  6:01   ` Michael S. Tsirkin
2020-02-04  6:01     ` Michael S. Tsirkin
2020-02-04  6:46     ` Jason Wang
2020-02-05  2:05       ` Tiwei Bie
2020-02-05  3:12         ` Jason Wang
2020-02-05  5:31           ` Michael S. Tsirkin
2020-02-05  5:50             ` Jason Wang
2020-02-05  5:50               ` Jason Wang
2020-02-05  6:30               ` Michael S. Tsirkin
2020-02-05  6:49                 ` Jason Wang
2020-02-05  6:49                   ` Jason Wang
2020-02-05  7:16                   ` Michael S. Tsirkin
2020-02-05  7:42                     ` Jason Wang
2020-02-05  9:22                       ` Michael S. Tsirkin
2020-02-05  2:02   ` Tiwei Bie
2020-02-05  3:11     ` Jason Wang
2020-02-05  7:15     ` Shahaf Shuler
2020-02-05  7:15       ` Shahaf Shuler
2020-02-05  7:50       ` Jason Wang
2020-02-05  7:50         ` Jason Wang
2020-02-05  9:23         ` Michael S. Tsirkin
2020-02-05  9:23           ` Michael S. Tsirkin
2020-02-06  3:07           ` Jason Wang
2020-02-06  3:07             ` Jason Wang
2020-02-05  9:30         ` Shahaf Shuler
2020-02-05  9:30           ` Shahaf Shuler
2020-02-05 10:33           ` Michael S. Tsirkin
2020-02-05 10:33             ` Michael S. Tsirkin
2020-02-06  3:09             ` Jason Wang
2020-02-06  3:09               ` Jason Wang
2020-02-06  3:04           ` Jason Wang
2020-02-06  3:04             ` Jason Wang
2020-02-05 12:56         ` Jason Gunthorpe
2020-02-05 12:56           ` Jason Gunthorpe
2020-02-05 13:14           ` Michael S. Tsirkin
2020-02-05 13:14             ` Michael S. Tsirkin
2020-02-06  3:11             ` Jason Wang
2020-02-06  3:11               ` Jason Wang
2020-02-06  3:21               ` Zhu Lingshan
2020-02-06  3:21                 ` Zhu Lingshan
2020-02-18 13:53 ` Jason Gunthorpe
2020-02-19  2:52   ` Tiwei Bie
2020-02-19 13:11     ` Jason Gunthorpe
2020-02-20  2:42       ` Tiwei Bie [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=20200220024220.GA43609@___ \
    --to=tiwei.bie@intel.com \
    --cc=cunming.liang@intel.com \
    --cc=dan.daly@intel.com \
    --cc=eperezma@redhat.com \
    --cc=hanand@xilinx.com \
    --cc=haotian.wang@sifive.com \
    --cc=hch@infradead.org \
    --cc=jasowang@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=jiri@mellanox.com \
    --cc=kvm@vger.kernel.org \
    --cc=lingshan.zhu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lulu@redhat.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=mhabets@solarflare.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=parav@mellanox.com \
    --cc=rdunlap@infradead.org \
    --cc=rob.miller@broadcom.com \
    --cc=shahafs@mellanox.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=zhihong.wang@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.