[v7,12/18] vdpa/ifc: add some log at vDPA launch before qemu connect
Checks
Commit Message
Add some log of virtio blk device config space information
at VDPA launch before qemu connects.
Signed-off-by: Andy Pei <andy.pei@intel.com>
---
drivers/vdpa/ifc/ifcvf_vdpa.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
Comments
> -----Original Message-----
> From: Pei, Andy <andy.pei@intel.com>
> Sent: Wednesday, April 27, 2022 4:30 PM
> To: dev@dpdk.org
> Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com; Cao,
> Gang <gang.cao@intel.com>; Liu, Changpeng <changpeng.liu@intel.com>
> Subject: [PATCH v7 12/18] vdpa/ifc: add some log at vDPA launch before
> qemu connect
Title can be:
vdpa/ifc: add log for config space of virtio blk
>
> Add some log of virtio blk device config space information
> at VDPA launch before qemu connects.
>
> Signed-off-by: Andy Pei <andy.pei@intel.com>
> ---
> drivers/vdpa/ifc/ifcvf_vdpa.c | 28 ++++++++++++++++++++++++++++
> 1 file changed, 28 insertions(+)
>
> diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
> index ca49bc3..4060a44 100644
> --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> @@ -1363,6 +1363,9 @@ struct rte_vdpa_dev_info dev_info[] = {
> struct rte_kvargs *kvlist = NULL;
> int ret = 0;
> int16_t device_id;
> + uint64_t capacity = 0;
> + uint8_t *byte;
> + uint32_t i;
>
> if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> return 0;
> @@ -1429,6 +1432,31 @@ struct rte_vdpa_dev_info dev_info[] = {
> internal->features = features &
> ~(1ULL << VIRTIO_F_IOMMU_PLATFORM);
> internal->features |= dev_info[IFCVF_BLK].features;
> +
> + /* cannot read 64-bit register in one attempt,
> + * so read byte by byte.
> + */
> + for (i = 0; i < sizeof(internal->hw.blk_cfg->capacity); i++) {
> + byte = (uint8_t *)&internal->hw.blk_cfg->capacity + i;
> + capacity |= (uint64_t)*byte << (i * 8);
> + }
> + DRV_LOG(INFO, "capacity : %"PRIu64"G", capacity >> 21);
I believe this '21' should be calculated rather than hard-code.
And should these log all be debug log?
Thanks,
Chenbo
> +
> + DRV_LOG(INFO, "size_max : 0x%08x",
> + internal->hw.blk_cfg->size_max);
> + DRV_LOG(INFO, "seg_max : 0x%08x",
> + internal->hw.blk_cfg->seg_max);
> + DRV_LOG(INFO, "blk_size : 0x%08x",
> + internal->hw.blk_cfg->blk_size);
> + DRV_LOG(INFO, "geometry");
> + DRV_LOG(INFO, " cylinders: %u",
> + internal->hw.blk_cfg->geometry.cylinders);
> + DRV_LOG(INFO, " heads : %u",
> + internal->hw.blk_cfg->geometry.heads);
> + DRV_LOG(INFO, " sectors : %u",
> + internal->hw.blk_cfg->geometry.sectors);
> + DRV_LOG(INFO, "num_queues: 0x%08x",
> + internal->hw.blk_cfg->num_queues);
> }
>
> list->internal = internal;
> --
> 1.8.3.1
Hi Chenbo,
Thanks for your reply.
My reply is inline.
> -----Original Message-----
> From: Xia, Chenbo <chenbo.xia@intel.com>
> Sent: Thursday, May 12, 2022 9:53 PM
> To: Pei, Andy <andy.pei@intel.com>; dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; Cao, Gang <gang.cao@intel.com>; Liu,
> Changpeng <changpeng.liu@intel.com>
> Subject: RE: [PATCH v7 12/18] vdpa/ifc: add some log at vDPA launch before
> qemu connect
>
> > -----Original Message-----
> > From: Pei, Andy <andy.pei@intel.com>
> > Sent: Wednesday, April 27, 2022 4:30 PM
> > To: dev@dpdk.org
> > Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com;
> > Cao, Gang <gang.cao@intel.com>; Liu, Changpeng
> > <changpeng.liu@intel.com>
> > Subject: [PATCH v7 12/18] vdpa/ifc: add some log at vDPA launch before
> > qemu connect
>
> Title can be:
>
> vdpa/ifc: add log for config space of virtio blk
>
Sure.
> >
> > Add some log of virtio blk device config space information at VDPA
> > launch before qemu connects.
> >
> > Signed-off-by: Andy Pei <andy.pei@intel.com>
> > ---
> > drivers/vdpa/ifc/ifcvf_vdpa.c | 28 ++++++++++++++++++++++++++++
> > 1 file changed, 28 insertions(+)
> >
> > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c
> > b/drivers/vdpa/ifc/ifcvf_vdpa.c index ca49bc3..4060a44 100644
> > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> > @@ -1363,6 +1363,9 @@ struct rte_vdpa_dev_info dev_info[] = {
> > struct rte_kvargs *kvlist = NULL;
> > int ret = 0;
> > int16_t device_id;
> > + uint64_t capacity = 0;
> > + uint8_t *byte;
> > + uint32_t i;
> >
> > if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> > return 0;
> > @@ -1429,6 +1432,31 @@ struct rte_vdpa_dev_info dev_info[] = {
> > internal->features = features &
> > ~(1ULL <<
> VIRTIO_F_IOMMU_PLATFORM);
> > internal->features |= dev_info[IFCVF_BLK].features;
> > +
> > + /* cannot read 64-bit register in one attempt,
> > + * so read byte by byte.
> > + */
> > + for (i = 0; i < sizeof(internal->hw.blk_cfg->capacity); i++) {
> > + byte = (uint8_t *)&internal->hw.blk_cfg->capacity + i;
> > + capacity |= (uint64_t)*byte << (i * 8);
> > + }
> > + DRV_LOG(INFO, "capacity : %"PRIu64"G", capacity >> 21);
>
> I believe this '21' should be calculated rather than hard-code.
>
/* The capacity (in 512-byte sectors). */
So right shift 1 we gwt in K. Another right shift 10 we get in M, right shift 10 more bits, we get in G.
10 + 10 + 1 = 21.
I think add some comments in code is fine, what do you think?
> And should these log all be debug log?
>
These information is hardware ability. I think INFO is fine.
> Thanks,
> Chenbo
>
> > +
> > + DRV_LOG(INFO, "size_max : 0x%08x",
> > + internal->hw.blk_cfg->size_max);
> > + DRV_LOG(INFO, "seg_max : 0x%08x",
> > + internal->hw.blk_cfg->seg_max);
> > + DRV_LOG(INFO, "blk_size : 0x%08x",
> > + internal->hw.blk_cfg->blk_size);
> > + DRV_LOG(INFO, "geometry");
> > + DRV_LOG(INFO, " cylinders: %u",
> > + internal->hw.blk_cfg->geometry.cylinders);
> > + DRV_LOG(INFO, " heads : %u",
> > + internal->hw.blk_cfg->geometry.heads);
> > + DRV_LOG(INFO, " sectors : %u",
> > + internal->hw.blk_cfg->geometry.sectors);
> > + DRV_LOG(INFO, "num_queues: 0x%08x",
> > + internal->hw.blk_cfg->num_queues);
> > }
> >
> > list->internal = internal;
> > --
> > 1.8.3.1
>
> -----Original Message-----
> From: Pei, Andy <andy.pei@intel.com>
> Sent: Friday, May 13, 2022 4:35 PM
> To: Xia, Chenbo <chenbo.xia@intel.com>; dev@dpdk.org
> Cc: maxime.coquelin@redhat.com; Cao, Gang <gang.cao@intel.com>; Liu,
> Changpeng <changpeng.liu@intel.com>
> Subject: RE: [PATCH v7 12/18] vdpa/ifc: add some log at vDPA launch before
> qemu connect
>
> Hi Chenbo,
>
> Thanks for your reply.
> My reply is inline.
>
> > -----Original Message-----
> > From: Xia, Chenbo <chenbo.xia@intel.com>
> > Sent: Thursday, May 12, 2022 9:53 PM
> > To: Pei, Andy <andy.pei@intel.com>; dev@dpdk.org
> > Cc: maxime.coquelin@redhat.com; Cao, Gang <gang.cao@intel.com>; Liu,
> > Changpeng <changpeng.liu@intel.com>
> > Subject: RE: [PATCH v7 12/18] vdpa/ifc: add some log at vDPA launch
> before
> > qemu connect
> >
> > > -----Original Message-----
> > > From: Pei, Andy <andy.pei@intel.com>
> > > Sent: Wednesday, April 27, 2022 4:30 PM
> > > To: dev@dpdk.org
> > > Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com;
> > > Cao, Gang <gang.cao@intel.com>; Liu, Changpeng
> > > <changpeng.liu@intel.com>
> > > Subject: [PATCH v7 12/18] vdpa/ifc: add some log at vDPA launch before
> > > qemu connect
> >
> > Title can be:
> >
> > vdpa/ifc: add log for config space of virtio blk
> >
> Sure.
> > >
> > > Add some log of virtio blk device config space information at VDPA
> > > launch before qemu connects.
> > >
> > > Signed-off-by: Andy Pei <andy.pei@intel.com>
> > > ---
> > > drivers/vdpa/ifc/ifcvf_vdpa.c | 28 ++++++++++++++++++++++++++++
> > > 1 file changed, 28 insertions(+)
> > >
> > > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c
> > > b/drivers/vdpa/ifc/ifcvf_vdpa.c index ca49bc3..4060a44 100644
> > > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> > > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> > > @@ -1363,6 +1363,9 @@ struct rte_vdpa_dev_info dev_info[] = {
> > > struct rte_kvargs *kvlist = NULL;
> > > int ret = 0;
> > > int16_t device_id;
> > > +uint64_t capacity = 0;
> > > +uint8_t *byte;
> > > +uint32_t i;
> > >
> > > if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> > > return 0;
> > > @@ -1429,6 +1432,31 @@ struct rte_vdpa_dev_info dev_info[] = {
> > > internal->features = features &
> > > ~(1ULL <<
> > VIRTIO_F_IOMMU_PLATFORM);
> > > internal->features |= dev_info[IFCVF_BLK].features;
> > > +
> > > +/* cannot read 64-bit register in one attempt,
> > > + * so read byte by byte.
> > > + */
> > > +for (i = 0; i < sizeof(internal->hw.blk_cfg->capacity); i++) {
> > > +byte = (uint8_t *)&internal->hw.blk_cfg->capacity + i;
> > > +capacity |= (uint64_t)*byte << (i * 8);
> > > +}
> > > +DRV_LOG(INFO, "capacity : %"PRIu64"G", capacity >> 21);
> >
> > I believe this '21' should be calculated rather than hard-code.
> >
> /* The capacity (in 512-byte sectors). */
> So right shift 1 we gwt in K. Another right shift 10 we get in M, right
> shift 10 more bits, we get in G.
> 10 + 10 + 1 = 21.
> I think add some comments in code is fine, what do you think?
Ok. Work for me.
Thanks,
Chenbo
>
> > And should these log all be debug log?
> >
> These information is hardware ability. I think INFO is fine.
>
> > Thanks,
> > Chenbo
> >
> > > +
> > > +DRV_LOG(INFO, "size_max : 0x%08x",
> > > +internal->hw.blk_cfg->size_max);
> > > +DRV_LOG(INFO, "seg_max : 0x%08x",
> > > +internal->hw.blk_cfg->seg_max);
> > > +DRV_LOG(INFO, "blk_size : 0x%08x",
> > > +internal->hw.blk_cfg->blk_size);
> > > +DRV_LOG(INFO, "geometry");
> > > +DRV_LOG(INFO, " cylinders: %u",
> > > +internal->hw.blk_cfg->geometry.cylinders);
> > > +DRV_LOG(INFO, " heads : %u",
> > > +internal->hw.blk_cfg->geometry.heads);
> > > +DRV_LOG(INFO, " sectors : %u",
> > > +internal->hw.blk_cfg->geometry.sectors);
> > > +DRV_LOG(INFO, "num_queues: 0x%08x",
> > > +internal->hw.blk_cfg->num_queues);
> > > }
> > >
> > > list->internal = internal;
> > > --
> > > 1.8.3.1
> >
>
On Fri, 13 May 2022 08:34:38 +0000
"Pei, Andy" <andy.pei@intel.com> wrote:
> Hi Chenbo,
>
> Thanks for your reply.
> My reply is inline.
>
> > -----Original Message-----
> > From: Xia, Chenbo <chenbo.xia@intel.com>
> > Sent: Thursday, May 12, 2022 9:53 PM
> > To: Pei, Andy <andy.pei@intel.com>; dev@dpdk.org
> > Cc: maxime.coquelin@redhat.com; Cao, Gang <gang.cao@intel.com>; Liu,
> > Changpeng <changpeng.liu@intel.com>
> > Subject: RE: [PATCH v7 12/18] vdpa/ifc: add some log at vDPA launch before
> > qemu connect
> >
> > > -----Original Message-----
> > > From: Pei, Andy <andy.pei@intel.com>
> > > Sent: Wednesday, April 27, 2022 4:30 PM
> > > To: dev@dpdk.org
> > > Cc: Xia, Chenbo <chenbo.xia@intel.com>; maxime.coquelin@redhat.com;
> > > Cao, Gang <gang.cao@intel.com>; Liu, Changpeng
> > > <changpeng.liu@intel.com>
> > > Subject: [PATCH v7 12/18] vdpa/ifc: add some log at vDPA launch before
> > > qemu connect
> >
> > Title can be:
> >
> > vdpa/ifc: add log for config space of virtio blk
> >
> Sure.
> > >
> > > Add some log of virtio blk device config space information at VDPA
> > > launch before qemu connects.
> > >
> > > Signed-off-by: Andy Pei <andy.pei@intel.com>
> > > ---
> > > drivers/vdpa/ifc/ifcvf_vdpa.c | 28 ++++++++++++++++++++++++++++
> > > 1 file changed, 28 insertions(+)
> > >
> > > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c
> > > b/drivers/vdpa/ifc/ifcvf_vdpa.c index ca49bc3..4060a44 100644
> > > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> > > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> > > @@ -1363,6 +1363,9 @@ struct rte_vdpa_dev_info dev_info[] = {
> > > struct rte_kvargs *kvlist = NULL;
> > > int ret = 0;
> > > int16_t device_id;
> > > + uint64_t capacity = 0;
> > > + uint8_t *byte;
> > > + uint32_t i;
> > >
> > > if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> > > return 0;
> > > @@ -1429,6 +1432,31 @@ struct rte_vdpa_dev_info dev_info[] = {
> > > internal->features = features &
> > > ~(1ULL <<
> > VIRTIO_F_IOMMU_PLATFORM);
> > > internal->features |= dev_info[IFCVF_BLK].features;
> > > +
> > > + /* cannot read 64-bit register in one attempt,
> > > + * so read byte by byte.
> > > + */
> > > + for (i = 0; i < sizeof(internal->hw.blk_cfg->capacity); i++) {
> > > + byte = (uint8_t *)&internal->hw.blk_cfg->capacity + i;
> > > + capacity |= (uint64_t)*byte << (i * 8);
> > > + }
> > > + DRV_LOG(INFO, "capacity : %"PRIu64"G", capacity >> 21);
> >
> > I believe this '21' should be calculated rather than hard-code.
Sounds like a debug not info message.
It is meant for developer not end user.
Hi Stephen,
Thanks for your reply.
I will change to DEBUG level log in next version.
> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Friday, May 13, 2022 11:38 PM
> To: Pei, Andy <andy.pei@intel.com>
> Cc: Xia, Chenbo <chenbo.xia@intel.com>; dev@dpdk.org;
> maxime.coquelin@redhat.com; Cao, Gang <gang.cao@intel.com>; Liu,
> Changpeng <changpeng.liu@intel.com>
> Subject: Re: [PATCH v7 12/18] vdpa/ifc: add some log at vDPA launch before
> qemu connect
>
> On Fri, 13 May 2022 08:34:38 +0000
> "Pei, Andy" <andy.pei@intel.com> wrote:
>
> > Hi Chenbo,
> >
> > Thanks for your reply.
> > My reply is inline.
> >
> > > -----Original Message-----
> > > From: Xia, Chenbo <chenbo.xia@intel.com>
> > > Sent: Thursday, May 12, 2022 9:53 PM
> > > To: Pei, Andy <andy.pei@intel.com>; dev@dpdk.org
> > > Cc: maxime.coquelin@redhat.com; Cao, Gang <gang.cao@intel.com>; Liu,
> > > Changpeng <changpeng.liu@intel.com>
> > > Subject: RE: [PATCH v7 12/18] vdpa/ifc: add some log at vDPA launch
> > > before qemu connect
> > >
> > > > -----Original Message-----
> > > > From: Pei, Andy <andy.pei@intel.com>
> > > > Sent: Wednesday, April 27, 2022 4:30 PM
> > > > To: dev@dpdk.org
> > > > Cc: Xia, Chenbo <chenbo.xia@intel.com>;
> > > > maxime.coquelin@redhat.com; Cao, Gang <gang.cao@intel.com>; Liu,
> > > > Changpeng <changpeng.liu@intel.com>
> > > > Subject: [PATCH v7 12/18] vdpa/ifc: add some log at vDPA launch
> > > > before qemu connect
> > >
> > > Title can be:
> > >
> > > vdpa/ifc: add log for config space of virtio blk
> > >
> > Sure.
> > > >
> > > > Add some log of virtio blk device config space information at VDPA
> > > > launch before qemu connects.
> > > >
> > > > Signed-off-by: Andy Pei <andy.pei@intel.com>
> > > > ---
> > > > drivers/vdpa/ifc/ifcvf_vdpa.c | 28 ++++++++++++++++++++++++++++
> > > > 1 file changed, 28 insertions(+)
> > > >
> > > > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c
> > > > b/drivers/vdpa/ifc/ifcvf_vdpa.c index ca49bc3..4060a44 100644
> > > > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> > > > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> > > > @@ -1363,6 +1363,9 @@ struct rte_vdpa_dev_info dev_info[] = {
> > > > struct rte_kvargs *kvlist = NULL;
> > > > int ret = 0;
> > > > int16_t device_id;
> > > > + uint64_t capacity = 0;
> > > > + uint8_t *byte;
> > > > + uint32_t i;
> > > >
> > > > if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> > > > return 0;
> > > > @@ -1429,6 +1432,31 @@ struct rte_vdpa_dev_info dev_info[] = {
> > > > internal->features = features &
> > > > ~(1ULL <<
> > > VIRTIO_F_IOMMU_PLATFORM);
> > > > internal->features |= dev_info[IFCVF_BLK].features;
> > > > +
> > > > + /* cannot read 64-bit register in one attempt,
> > > > + * so read byte by byte.
> > > > + */
> > > > + for (i = 0; i < sizeof(internal->hw.blk_cfg->capacity); i++) {
> > > > + byte = (uint8_t *)&internal->hw.blk_cfg->capacity + i;
> > > > + capacity |= (uint64_t)*byte << (i * 8);
> > > > + }
> > > > + DRV_LOG(INFO, "capacity : %"PRIu64"G", capacity >> 21);
> > >
> > > I believe this '21' should be calculated rather than hard-code.
>
> Sounds like a debug not info message.
> It is meant for developer not end user.
@@ -1363,6 +1363,9 @@ struct rte_vdpa_dev_info dev_info[] = {
struct rte_kvargs *kvlist = NULL;
int ret = 0;
int16_t device_id;
+ uint64_t capacity = 0;
+ uint8_t *byte;
+ uint32_t i;
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
@@ -1429,6 +1432,31 @@ struct rte_vdpa_dev_info dev_info[] = {
internal->features = features &
~(1ULL << VIRTIO_F_IOMMU_PLATFORM);
internal->features |= dev_info[IFCVF_BLK].features;
+
+ /* cannot read 64-bit register in one attempt,
+ * so read byte by byte.
+ */
+ for (i = 0; i < sizeof(internal->hw.blk_cfg->capacity); i++) {
+ byte = (uint8_t *)&internal->hw.blk_cfg->capacity + i;
+ capacity |= (uint64_t)*byte << (i * 8);
+ }
+ DRV_LOG(INFO, "capacity : %"PRIu64"G", capacity >> 21);
+
+ DRV_LOG(INFO, "size_max : 0x%08x",
+ internal->hw.blk_cfg->size_max);
+ DRV_LOG(INFO, "seg_max : 0x%08x",
+ internal->hw.blk_cfg->seg_max);
+ DRV_LOG(INFO, "blk_size : 0x%08x",
+ internal->hw.blk_cfg->blk_size);
+ DRV_LOG(INFO, "geometry");
+ DRV_LOG(INFO, " cylinders: %u",
+ internal->hw.blk_cfg->geometry.cylinders);
+ DRV_LOG(INFO, " heads : %u",
+ internal->hw.blk_cfg->geometry.heads);
+ DRV_LOG(INFO, " sectors : %u",
+ internal->hw.blk_cfg->geometry.sectors);
+ DRV_LOG(INFO, "num_queues: 0x%08x",
+ internal->hw.blk_cfg->num_queues);
}
list->internal = internal;