From: Stefano Garzarella <sgarzare@redhat.com>
To: "Zhu, Lingshan" <lingshan.zhu@intel.com>
Cc: jasowang@redhat.com, mst@redhat.com, virtualization@lists.linux.dev
Subject: Re: [PATCH 09/10] vDPA: report virtio-block read-only info to user space
Date: Fri, 3 May 2024 14:18:05 +0200 [thread overview]
Message-ID: <2tzq7nfmcsfxh37mrwkkl25ok3lrn4blj3le5fvzbrcl6w4h4z@22geh32s4bfq> (raw)
In-Reply-To: <a0672e72-5c17-4457-9f31-9f9db6f9f229@intel.com>
On Tue, Apr 09, 2024 at 04:37:18PM GMT, Zhu, Lingshan wrote:
>
>
>On 3/20/2024 12:40 AM, Stefano Garzarella wrote:
>>On Mon, Feb 19, 2024 at 02:56:05AM +0800, Zhu Lingshan wrote:
>>>This commit report read-only information of
>>>virtio-blk devices to user space.
>>>
>>>Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
>>>---
>>>drivers/vdpa/vdpa.c | 14 ++++++++++++++
>>>include/uapi/linux/vdpa.h | 1 +
>>>2 files changed, 15 insertions(+)
>>>
>>>diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
>>>index adbcbc7b18b2..d6fd3cadc44f 100644
>>>--- a/drivers/vdpa/vdpa.c
>>>+++ b/drivers/vdpa/vdpa.c
>>>@@ -1084,6 +1084,17 @@
>>>vdpa_dev_blk_write_zeroes_config_fill(struct sk_buff *msg, u64
>>>features,
>>> return 0;
>>>}
>>>
>>>+static int vdpa_dev_blk_ro_config_fill(struct sk_buff *msg, u64
>>>features)
>>>+{
>>>+ u8 ro;
>>>+
>>>+ ro = ((features & BIT_ULL(VIRTIO_BLK_F_RO)) == 0) ? 0 : 1;
>>>+ if (nla_put_u8(msg, VDPA_ATTR_DEV_BLK_CFG_READ_ONLY, ro))
>>
>>This is not really related to the config space, what about renaming it
>>to VDPA_ATTR_DEV_BLK_READ_ONLY ?
>>
>>Also the type, maybe better to use "flag" and set it through
>>`nla_put_flag()`.
>Hi Stefano,
>
>I am implementing this change.
>In my humble opinion, maybe using a boolean(the u8 above) is better?
If boolean is available, I agree that could be better.
I did just a fast search when I commented.
BTW, sorry for the late reply, I was on PTO.
Stefano
>Because using the flag means we conditionally put a "0" into the
>attribution,
>or the attribution does not exist, this is still a bool logic but
>a little vague.
>
>Thanks
>Lingshan
>>
>>Not a strong opinion on that, it just seems a little more consistent to
>>me.
>>
>>Thanks,
>>Stefano
>>
>>>+ return -EMSGSIZE;
>>>+
>>>+ return 0;
>>>+}
>>>+
>>>static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
>>> struct sk_buff *msg)
>>>{
>>>@@ -1122,6 +1133,9 @@ static int vdpa_dev_blk_config_fill(struct
>>>vdpa_device *vdev,
>>> if (vdpa_dev_blk_write_zeroes_config_fill(msg,
>>>features_device, &config))
>>> return -EMSGSIZE;
>>>
>>>+ if (vdpa_dev_blk_ro_config_fill(msg, features_device))
>>>+ return -EMSGSIZE;
>>>+
>>> return 0;
>>>}
>>>
>>>diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
>>>index 797d5708492f..4be8e3a15874 100644
>>>--- a/include/uapi/linux/vdpa.h
>>>+++ b/include/uapi/linux/vdpa.h
>>>@@ -70,6 +70,7 @@ enum vdpa_attr {
>>> VDPA_ATTR_DEV_BLK_CFG_DISCARD_SEC_ALIGN,/* u32 */
>>> VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEC, /* u32 */
>>> VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEG, /* u32 */
>>>+ VDPA_ATTR_DEV_BLK_CFG_READ_ONLY, /* u8 */
>>>
>>> /* new attributes must be added above here */
>>> VDPA_ATTR_MAX,
>>>--
>>>2.39.3
>>>
>>>
>>
>>
>
next prev parent reply other threads:[~2024-05-03 12:18 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-18 18:55 [PATCH 00/10] vDPA: allow userspace query virito-block device Zhu Lingshan
2024-02-18 18:55 ` [PATCH 01/10] vDPA: report virtio-block capacity to user space Zhu Lingshan
2024-03-19 16:43 ` Stefano Garzarella
2024-02-18 18:55 ` [PATCH 02/10] vDPA: report virtio-block max segment size " Zhu Lingshan
2024-03-19 16:04 ` Stefano Garzarella
2024-03-29 14:48 ` Zhu, Lingshan
2024-03-31 20:03 ` Michael S. Tsirkin
2024-02-18 18:55 ` [PATCH 03/10] vDPA: report virtio-block block-size " Zhu Lingshan
2024-03-19 16:43 ` Stefano Garzarella
2024-02-18 18:56 ` [PATCH 04/10] vDPA: report virtio-block max segments in a request " Zhu Lingshan
2024-03-19 16:43 ` Stefano Garzarella
2024-02-18 18:56 ` [PATCH 05/10] vDPA: report virtio-block MQ info " Zhu Lingshan
2024-03-19 16:44 ` Stefano Garzarella
2024-02-18 18:56 ` [PATCH 06/10] vDPA: report virtio-block topology " Zhu Lingshan
2024-03-19 16:44 ` Stefano Garzarella
2024-02-18 18:56 ` [PATCH 07/10] vDPA: report virtio-block discarding configuration " Zhu Lingshan
2024-03-19 16:44 ` Stefano Garzarella
2024-02-18 18:56 ` [PATCH 08/10] vDPA: report virtio-block write zeroes " Zhu Lingshan
2024-03-19 16:36 ` Stefano Garzarella
2024-03-19 17:02 ` Michael S. Tsirkin
2024-03-19 17:08 ` Stefano Garzarella
2024-03-19 17:57 ` Michael S. Tsirkin
2024-02-18 18:56 ` [PATCH 09/10] vDPA: report virtio-block read-only info " Zhu Lingshan
2024-03-19 16:40 ` Stefano Garzarella
2024-04-09 8:37 ` Zhu, Lingshan
2024-05-03 12:18 ` Stefano Garzarella [this message]
2024-02-18 18:56 ` [PATCH 10/10] vDPA: report virtio-blk flush " Zhu Lingshan
2024-03-19 16:42 ` Stefano Garzarella
2024-03-19 6:39 ` [PATCH 00/10] vDPA: allow userspace query virito-block device Michael S. Tsirkin
2024-03-20 3:30 ` Jason Wang
2024-03-20 7:00 ` Michael S. Tsirkin
2024-03-19 16:49 ` Stefano Garzarella
2024-03-20 10:31 ` Zhu, Lingshan
2024-03-20 10:53 ` Stefano Garzarella
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=2tzq7nfmcsfxh37mrwkkl25ok3lrn4blj3le5fvzbrcl6w4h4z@22geh32s4bfq \
--to=sgarzare@redhat.com \
--cc=jasowang@redhat.com \
--cc=lingshan.zhu@intel.com \
--cc=mst@redhat.com \
--cc=virtualization@lists.linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).