All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Ming Lei <ming.lei@redhat.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org,
	ZiyangZhang <ZiyangZhang@linux.alibaba.com>
Subject: Re: [PATCH V2 2/2] ublk_drv: make sure that correct flags(features) returned to userspace
Date: Thu, 21 Jul 2022 22:50:43 -0700	[thread overview]
Message-ID: <Yto6s09YN1FK2Zi6@infradead.org> (raw)
In-Reply-To: <20220722050930.611232-3-ming.lei@redhat.com>

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.

> +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.

  reply	other threads:[~2022-07-22  5:50 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 [this message]
2022-07-22  7:30     ` Ming Lei
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=Yto6s09YN1FK2Zi6@infradead.org \
    --to=hch@infradead.org \
    --cc=ZiyangZhang@linux.alibaba.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    /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.