public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: "Zhijian Li (Fujitsu)" <lizhijian@fujitsu.com>
Cc: "linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"jgg@ziepe.ca" <jgg@ziepe.ca>
Subject: Re: [PATCH rdma-core] libibverbs/man/ibv_reg_mr.3: Document errno on failure
Date: Wed, 18 Oct 2023 06:45:13 +0200	[thread overview]
Message-ID: <875y3435eu.fsf@pond.sub.org> (raw)
In-Reply-To: <c6f747e3-7e2a-41de-8ff4-63e00bbf1de8@fujitsu.com> (Zhijian Li's message of "Wed, 18 Oct 2023 01:11:25 +0000")

"Zhijian Li (Fujitsu)" <lizhijian@fujitsu.com> writes:

> On 17/10/2023 16:01, Markus Armbruster wrote:
>> Li Zhijian <lizhijian@fujitsu.com> writes:
>> 
>>> 'errno' is being widely used by applications when ibv_reg_mr returns NULL.
>>> They all believe errno indicates the error on failure, so let's document
>>> it explicitly.
>> 
>> Similar issue with ibv_open_device() .  Possibly more.
>
> You are right, ibv_open_device()'s call chains are more complicated,
> I have not figured out if it ought to set errno though QEMU relies on it.

I think a question to answer is for what purposes callers need errno.

The only callers I know are in QEMU.  There are three:

* qemu_rdma_reg_whole_ram_blocks() and qemu_rdma_register_and_get_keys()

  When ibv_reg_mr() fails, maybe try again with IBV_ACCESS_ON_DEMAND
  added to the protection attributes.

  "Maybe": if errno is ENOTSUP, and ibv_query_device_ex() reports
  IBV_ODP_SUPPORT.

* qemu_rdma_broken_ipv6_kernel()

  This function appears to probe the devices returned by
  ibv_get_device_list().

  For each device in the list, in order: try to ibv_open_device().  If
  it fails: ignore the device if errno is EPERM, else return failure.

I'm not familiar with RDMA, and I can't say whether any of this makes
sense.

If it doesn't, we need to talk about what problem the QEMU code is
trying to solve, and how to solve it properly.

If it does, we have legitimate uses of errno, and we need to talk how to
make errno usable safely, or else how to replace its use in QEMU.


  reply	other threads:[~2023-10-18  4:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-17  5:37 [PATCH rdma-core] libibverbs/man/ibv_reg_mr.3: Document errno on failure Li Zhijian
2023-10-17  8:01 ` Markus Armbruster
2023-10-18  1:11   ` Zhijian Li (Fujitsu)
2023-10-18  4:45     ` Markus Armbruster [this message]
2023-10-18  6:14       ` Zhijian Li (Fujitsu)

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=875y3435eu.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-rdma@vger.kernel.org \
    --cc=lizhijian@fujitsu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox