From: Ming Lei <ming.lei@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org,
ZiyangZhang <ZiyangZhang@linux.alibaba.com>,
ming.lei@redhat.com
Subject: Re: [PATCH V2 2/2] ublk_drv: make sure that correct flags(features) returned to userspace
Date: Fri, 22 Jul 2022 15:30:17 +0800 [thread overview]
Message-ID: <YtpSCX5ZC3cnWakM@T590> (raw)
In-Reply-To: <Yto6s09YN1FK2Zi6@infradead.org>
On Thu, Jul 21, 2022 at 10:50:43PM -0700, Christoph Hellwig wrote:
> On Fri, Jul 22, 2022 at 01:09:30PM +0800, Ming Lei wrote:
> > + unsigned long *map = (unsigned long *)&ub->dev_info.flags[0];
> > +
> > + /* We are not ready to support zero copy */
> > + ub->dev_info.flags[0] &= ~UBLK_F_SUPPORT_ZERO_COPY;
> > +
> > + /*
> > + * 128bit flags will be copied back to userspace as feature
> > + * negotiation result, so have to clear flags which driver
> > + * doesn't support yet, then userspace can get correct flags
> > + * (features) to handle.
> > + */
> > + bitmap_clear(map, __UBLK_F_NR_BITS, 128 - __UBLK_F_NR_BITS);
>
> Please don't do the cast and bitmap ops. In fact I think the current
> ABI is rather nasty. To make everyones life easier just use a single
> u64 flags, an mark the second one reserved so that we can extent into
> it with extra flags or something else. That way normal C operator
> leve bitops just work.
OK.
>
> > +enum ublk_flag_bits {
> > + __UBLK_F_SUPPORT_ZERO_COPY,
> > + __UBLK_F_URING_CMD_COMP_IN_TASK,
> > + __UBLK_F_NR_BITS,
> > +};
>
> Please make these #defines so that userspace can detect if they
> exist in a header using #ifdef.
userspace is supposed to only use UBLK_F_* instead of __UBLK_F_*, one
benefit of using enum is that UBLK_F_NR_BITS can be figured out
automatically, otherwise how can we figure out the max bits?
thanks,
Ming
next prev parent reply other threads:[~2022-07-22 7:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-22 5:09 [PATCH V2 0/2] ublk_drv: make sure that correct flags(features) returned to userspace Ming Lei
2022-07-22 5:09 ` [PATCH V2 1/2] ublk_drv: fix error handling of ublk_add_dev Ming Lei
2022-07-22 5:48 ` Christoph Hellwig
2022-07-22 6:17 ` Christoph Hellwig
2022-07-22 7:35 ` Ziyang Zhang
2022-07-22 5:58 ` Ziyang Zhang
2022-07-22 5:09 ` [PATCH V2 2/2] ublk_drv: make sure that correct flags(features) returned to userspace Ming Lei
2022-07-22 5:50 ` Christoph Hellwig
2022-07-22 7:30 ` Ming Lei [this message]
2022-07-22 8:09 ` Christoph Hellwig
2022-07-22 6:00 ` Ziyang Zhang
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=YtpSCX5ZC3cnWakM@T590 \
--to=ming.lei@redhat.com \
--cc=ZiyangZhang@linux.alibaba.com \
--cc=axboe@kernel.dk \
--cc=hch@infradead.org \
--cc=linux-block@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox