From: <wang.yi59@zte.com.cn> To: <sgarzare@redhat.com> Cc: <mst@redhat.com>, <zhang.min9@zte.com.cn>, <wang.liang82@zte.com.cn>, <kvm@vger.kernel.org>, <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <virtualization@lists.linux-foundation.org>, <xue.zhihong@zte.com.cn> Subject: Re:[PATCH] vdpa: regist vhost-vdpa dev class Date: Fri, 24 Dec 2021 15:02:15 +0800 (CST) [thread overview] Message-ID: <202112241502155477712@zte.com.cn> (raw) In-Reply-To: <20211223105950.ovywoj6v3aooh2v5@steredhat> Hi Stefano, Thanks for your quick reply and review, :) > On Thu, Dec 23, 2021 at 03:31:45PM +0800, Yi Wang wrote: > >From: Zhang Min <zhang.min9@zte.com.cn> > > > >Some applications like kata-containers need to acquire MAJOR/MINOR/DEVNAME > >for devInfo [1], so regist vhost-vdpa dev class to expose uevent. > > > >1. https://github.com/kata-containers/kata-containers/blob/main/src/runtime/virtcontainers/device/config/config.go > > > >Signed-off-by: Zhang Min <zhang.min9@zte.com.cn> > >Signed-off-by: Yi Wang <wang.yi59@zte.com.cn> > >--- > > drivers/vhost/vdpa.c | 12 ++++++++++++ > > 1 file changed, 12 insertions(+) > > > >diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c > >index fb41db3da611..90fbad93e7a2 100644 > >--- a/drivers/vhost/vdpa.c > >+++ b/drivers/vhost/vdpa.c .. > >+ vhost_vdpa_class = class_create(THIS_MODULE, "vhost-vdpa"); > >+ if (IS_ERR(vhost_vdpa_class)) { > >+ r = PTR_ERR(vhost_vdpa_class); > >+ pr_warn("vhost vdpa class create error %d, maybe mod reinserted\n", r); > ^ > double space. > > I'm not a native speaker, but I would rephrase the second part to "maybe > the module is already loaded" > > >+ vhost_vdpa_class = NULL; > >+ return r; > >+ } > >+ > > r = alloc_chrdev_region(&vhost_vdpa_major, 0, VHOST_VDPA_DEV_MAX, > > "vhost-vdpa"); > > if (r) > >@@ -1111,6 +1121,7 @@ static int __init vhost_vdpa_init(void) > > err_vdpa_register_driver: > > unregister_chrdev_region(vhost_vdpa_major, VHOST_VDPA_DEV_MAX); > > err_alloc_chrdev: > >+ class_destroy(vhost_vdpa_class); > > Should we set `vhost_vdpa_class` to NULL here? > > If yes, maybe better to add a new label, and a goto in the > `class_create` error handling. Yes, reset to NULL is unnecessary, and pr_warn will not be reached when module is already loaded, so it's no need too. There will be a v2 patch which simply return PTR_ERR(vhost_vdpa_class); Other suggestions are also accepted. > > return r; > > }
WARNING: multiple messages have this Message-ID (diff)
From: <wang.yi59@zte.com.cn> To: <sgarzare@redhat.com> Cc: zhang.min9@zte.com.cn, wang.liang82@zte.com.cn, kvm@vger.kernel.org, mst@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, xue.zhihong@zte.com.cn Subject: Re:[PATCH] vdpa: regist vhost-vdpa dev class Date: Fri, 24 Dec 2021 15:02:15 +0800 (CST) [thread overview] Message-ID: <202112241502155477712@zte.com.cn> (raw) In-Reply-To: <20211223105950.ovywoj6v3aooh2v5@steredhat> Hi Stefano, Thanks for your quick reply and review, :) > On Thu, Dec 23, 2021 at 03:31:45PM +0800, Yi Wang wrote: > >From: Zhang Min <zhang.min9@zte.com.cn> > > > >Some applications like kata-containers need to acquire MAJOR/MINOR/DEVNAME > >for devInfo [1], so regist vhost-vdpa dev class to expose uevent. > > > >1. https://github.com/kata-containers/kata-containers/blob/main/src/runtime/virtcontainers/device/config/config.go > > > >Signed-off-by: Zhang Min <zhang.min9@zte.com.cn> > >Signed-off-by: Yi Wang <wang.yi59@zte.com.cn> > >--- > > drivers/vhost/vdpa.c | 12 ++++++++++++ > > 1 file changed, 12 insertions(+) > > > >diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c > >index fb41db3da611..90fbad93e7a2 100644 > >--- a/drivers/vhost/vdpa.c > >+++ b/drivers/vhost/vdpa.c .. > >+ vhost_vdpa_class = class_create(THIS_MODULE, "vhost-vdpa"); > >+ if (IS_ERR(vhost_vdpa_class)) { > >+ r = PTR_ERR(vhost_vdpa_class); > >+ pr_warn("vhost vdpa class create error %d, maybe mod reinserted\n", r); > ^ > double space. > > I'm not a native speaker, but I would rephrase the second part to "maybe > the module is already loaded" > > >+ vhost_vdpa_class = NULL; > >+ return r; > >+ } > >+ > > r = alloc_chrdev_region(&vhost_vdpa_major, 0, VHOST_VDPA_DEV_MAX, > > "vhost-vdpa"); > > if (r) > >@@ -1111,6 +1121,7 @@ static int __init vhost_vdpa_init(void) > > err_vdpa_register_driver: > > unregister_chrdev_region(vhost_vdpa_major, VHOST_VDPA_DEV_MAX); > > err_alloc_chrdev: > >+ class_destroy(vhost_vdpa_class); > > Should we set `vhost_vdpa_class` to NULL here? > > If yes, maybe better to add a new label, and a goto in the > `class_create` error handling. Yes, reset to NULL is unnecessary, and pr_warn will not be reached when module is already loaded, so it's no need too. There will be a v2 patch which simply return PTR_ERR(vhost_vdpa_class); Other suggestions are also accepted. > > return r; > > } _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization
next prev parent reply other threads:[~2021-12-24 7:02 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-12-23 7:31 [PATCH] vdpa: regist vhost-vdpa dev class Yi Wang 2021-12-23 7:31 ` Yi Wang 2021-12-23 10:59 ` Stefano Garzarella 2021-12-23 10:59 ` Stefano Garzarella 2021-12-24 7:02 ` wang.yi59 [this message] 2021-12-24 7:02 ` wang.yi59 2021-12-23 13:58 ` [PATCH] " Michael S. Tsirkin 2021-12-23 13:58 ` Michael S. Tsirkin 2021-12-23 15:53 ` Longpeng (Mike, Cloud Infrastructure Service Product Dept.)
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=202112241502155477712@zte.com.cn \ --to=wang.yi59@zte.com.cn \ --cc=kvm@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=mst@redhat.com \ --cc=netdev@vger.kernel.org \ --cc=sgarzare@redhat.com \ --cc=virtualization@lists.linux-foundation.org \ --cc=wang.liang82@zte.com.cn \ --cc=xue.zhihong@zte.com.cn \ --cc=zhang.min9@zte.com.cn \ /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: linkBe 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.