From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH] vdpa: Consider device id larger than 31
Date: Mon, 29 Nov 2021 09:58:46 +0300 [thread overview]
Message-ID: <20211129065846.GN18178@kadam> (raw)
In-Reply-To: <20211128071435.GB99190@mtl-vdi-166.wap.labs.mlnx>
[-- Attachment #1: Type: text/plain, Size: 1869 bytes --]
On Sun, Nov 28, 2021 at 09:14:35AM +0200, Eli Cohen wrote:
> On Fri, Nov 26, 2021 at 10:48:12AM +0800, Jason Wang wrote:
> > On Fri, Nov 26, 2021 at 2:09 AM Parav Pandit <parav@nvidia.com> wrote:
> > >
> > > virtio device id value can be more than 31. Hence, use BIT_ULL in
> > > assignment.
> > >
> > > Fixes: 33b347503f01 ("vdpa: Define vdpa mgmt device, ops and a netlink interface")
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > > Signed-off-by: Parav Pandit <parav@nvidia.com>
> >
> > Acked-by: Jason Wang <jasowang@redhat.com>
> >
> > > ---
> > > drivers/vdpa/vdpa.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
> > > index 7332a74a4b00..e91c71aeeddf 100644
> > > --- a/drivers/vdpa/vdpa.c
> > > +++ b/drivers/vdpa/vdpa.c
> > > @@ -404,7 +404,7 @@ static int vdpa_mgmtdev_fill(const struct vdpa_mgmt_dev *mdev, struct sk_buff *m
> > > goto msg_err;
> > >
> > > while (mdev->id_table[i].device) {
> > > - supported_classes |= BIT(mdev->id_table[i].device);
> > > + supported_classes |= BIT_ULL(mdev->id_table[i].device);
> > > i++;
> > > }
> > >
>
> type of mdev->id_table[i].device is __u32 so in theory you're limited
> to device ID's up to 63.
A u32 can fit numbers up to 4 million? These .device numbers are
normally hardcoded defines listed in usr/include/linux/virtio_ids.h
But sometimes they're not like in vp_modern_probe() which does:
mdev->id.device = pci_dev->device - 0x1040;
I don't know if an assert is really worth it, considering how almost all
of them are hardcoded. Also if we do want an assert maybe there is a
better place to put it?
regards,
dan carpenter
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Eli Cohen <elic@nvidia.com>
Cc: kbuild-all@lists.01.org, kernel test robot <lkp@intel.com>,
mst <mst@redhat.com>, linux-kernel <linux-kernel@vger.kernel.org>,
virtualization <virtualization@lists.linux-foundation.org>,
Eric Dumazet <edumazet@google.com>,
kbuild@lists.01.org
Subject: Re: [PATCH] vdpa: Consider device id larger than 31
Date: Mon, 29 Nov 2021 09:58:46 +0300 [thread overview]
Message-ID: <20211129065846.GN18178@kadam> (raw)
In-Reply-To: <20211128071435.GB99190@mtl-vdi-166.wap.labs.mlnx>
On Sun, Nov 28, 2021 at 09:14:35AM +0200, Eli Cohen wrote:
> On Fri, Nov 26, 2021 at 10:48:12AM +0800, Jason Wang wrote:
> > On Fri, Nov 26, 2021 at 2:09 AM Parav Pandit <parav@nvidia.com> wrote:
> > >
> > > virtio device id value can be more than 31. Hence, use BIT_ULL in
> > > assignment.
> > >
> > > Fixes: 33b347503f01 ("vdpa: Define vdpa mgmt device, ops and a netlink interface")
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > > Signed-off-by: Parav Pandit <parav@nvidia.com>
> >
> > Acked-by: Jason Wang <jasowang@redhat.com>
> >
> > > ---
> > > drivers/vdpa/vdpa.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
> > > index 7332a74a4b00..e91c71aeeddf 100644
> > > --- a/drivers/vdpa/vdpa.c
> > > +++ b/drivers/vdpa/vdpa.c
> > > @@ -404,7 +404,7 @@ static int vdpa_mgmtdev_fill(const struct vdpa_mgmt_dev *mdev, struct sk_buff *m
> > > goto msg_err;
> > >
> > > while (mdev->id_table[i].device) {
> > > - supported_classes |= BIT(mdev->id_table[i].device);
> > > + supported_classes |= BIT_ULL(mdev->id_table[i].device);
> > > i++;
> > > }
> > >
>
> type of mdev->id_table[i].device is __u32 so in theory you're limited
> to device ID's up to 63.
A u32 can fit numbers up to 4 million? These .device numbers are
normally hardcoded defines listed in usr/include/linux/virtio_ids.h
But sometimes they're not like in vp_modern_probe() which does:
mdev->id.device = pci_dev->device - 0x1040;
I don't know if an assert is really worth it, considering how almost all
of them are hardcoded. Also if we do want an assert maybe there is a
better place to put it?
regards,
dan carpenter
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH] vdpa: Consider device id larger than 31
Date: Mon, 29 Nov 2021 09:58:46 +0300 [thread overview]
Message-ID: <20211129065846.GN18178@kadam> (raw)
In-Reply-To: <20211128071435.GB99190@mtl-vdi-166.wap.labs.mlnx>
[-- Attachment #1: Type: text/plain, Size: 1869 bytes --]
On Sun, Nov 28, 2021 at 09:14:35AM +0200, Eli Cohen wrote:
> On Fri, Nov 26, 2021 at 10:48:12AM +0800, Jason Wang wrote:
> > On Fri, Nov 26, 2021 at 2:09 AM Parav Pandit <parav@nvidia.com> wrote:
> > >
> > > virtio device id value can be more than 31. Hence, use BIT_ULL in
> > > assignment.
> > >
> > > Fixes: 33b347503f01 ("vdpa: Define vdpa mgmt device, ops and a netlink interface")
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > > Signed-off-by: Parav Pandit <parav@nvidia.com>
> >
> > Acked-by: Jason Wang <jasowang@redhat.com>
> >
> > > ---
> > > drivers/vdpa/vdpa.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
> > > index 7332a74a4b00..e91c71aeeddf 100644
> > > --- a/drivers/vdpa/vdpa.c
> > > +++ b/drivers/vdpa/vdpa.c
> > > @@ -404,7 +404,7 @@ static int vdpa_mgmtdev_fill(const struct vdpa_mgmt_dev *mdev, struct sk_buff *m
> > > goto msg_err;
> > >
> > > while (mdev->id_table[i].device) {
> > > - supported_classes |= BIT(mdev->id_table[i].device);
> > > + supported_classes |= BIT_ULL(mdev->id_table[i].device);
> > > i++;
> > > }
> > >
>
> type of mdev->id_table[i].device is __u32 so in theory you're limited
> to device ID's up to 63.
A u32 can fit numbers up to 4 million? These .device numbers are
normally hardcoded defines listed in usr/include/linux/virtio_ids.h
But sometimes they're not like in vp_modern_probe() which does:
mdev->id.device = pci_dev->device - 0x1040;
I don't know if an assert is really worth it, considering how almost all
of them are hardcoded. Also if we do want an assert maybe there is a
better place to put it?
regards,
dan carpenter
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Eli Cohen <elic@nvidia.com>
Cc: Jason Wang <jasowang@redhat.com>, Parav Pandit <parav@nvidia.com>,
virtualization <virtualization@lists.linux-foundation.org>,
mst <mst@redhat.com>, Eric Dumazet <edumazet@google.com>,
kbuild-all@lists.01.org, kernel test robot <lkp@intel.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
kbuild@lists.01.org
Subject: Re: [PATCH] vdpa: Consider device id larger than 31
Date: Mon, 29 Nov 2021 09:58:46 +0300 [thread overview]
Message-ID: <20211129065846.GN18178@kadam> (raw)
In-Reply-To: <20211128071435.GB99190@mtl-vdi-166.wap.labs.mlnx>
On Sun, Nov 28, 2021 at 09:14:35AM +0200, Eli Cohen wrote:
> On Fri, Nov 26, 2021 at 10:48:12AM +0800, Jason Wang wrote:
> > On Fri, Nov 26, 2021 at 2:09 AM Parav Pandit <parav@nvidia.com> wrote:
> > >
> > > virtio device id value can be more than 31. Hence, use BIT_ULL in
> > > assignment.
> > >
> > > Fixes: 33b347503f01 ("vdpa: Define vdpa mgmt device, ops and a netlink interface")
> > > Reported-by: kernel test robot <lkp@intel.com>
> > > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > > Signed-off-by: Parav Pandit <parav@nvidia.com>
> >
> > Acked-by: Jason Wang <jasowang@redhat.com>
> >
> > > ---
> > > drivers/vdpa/vdpa.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
> > > index 7332a74a4b00..e91c71aeeddf 100644
> > > --- a/drivers/vdpa/vdpa.c
> > > +++ b/drivers/vdpa/vdpa.c
> > > @@ -404,7 +404,7 @@ static int vdpa_mgmtdev_fill(const struct vdpa_mgmt_dev *mdev, struct sk_buff *m
> > > goto msg_err;
> > >
> > > while (mdev->id_table[i].device) {
> > > - supported_classes |= BIT(mdev->id_table[i].device);
> > > + supported_classes |= BIT_ULL(mdev->id_table[i].device);
> > > i++;
> > > }
> > >
>
> type of mdev->id_table[i].device is __u32 so in theory you're limited
> to device ID's up to 63.
A u32 can fit numbers up to 4 million? These .device numbers are
normally hardcoded defines listed in usr/include/linux/virtio_ids.h
But sometimes they're not like in vp_modern_probe() which does:
mdev->id.device = pci_dev->device - 0x1040;
I don't know if an assert is really worth it, considering how almost all
of them are hardcoded. Also if we do want an assert maybe there is a
better place to put it?
regards,
dan carpenter
next prev parent reply other threads:[~2021-11-29 6:58 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-25 18:09 [PATCH] vdpa: Consider device id larger than 31 Parav Pandit via Virtualization
2021-11-25 18:09 ` Parav Pandit
2021-11-25 18:09 ` Parav Pandit
2021-11-26 2:48 ` Jason Wang
2021-11-26 2:48 ` Jason Wang
2021-11-26 2:48 ` Jason Wang
2021-11-28 7:14 ` Eli Cohen
2021-11-28 7:14 ` Eli Cohen
2021-11-28 7:45 ` Michael S. Tsirkin
2021-11-28 7:45 ` Michael S. Tsirkin
2021-11-28 7:45 ` Michael S. Tsirkin
2021-11-29 6:58 ` Dan Carpenter [this message]
2021-11-29 6:58 ` Dan Carpenter
2021-11-29 6:58 ` Dan Carpenter
2021-11-29 6:58 ` Dan Carpenter
2021-11-29 7:22 ` Parav Pandit via Virtualization
2021-11-29 7:22 ` Parav Pandit
2021-11-29 7:22 ` Parav Pandit
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=20211129065846.GN18178@kadam \
--to=dan.carpenter@oracle.com \
--cc=kbuild@lists.01.org \
/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.