Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Jason Gunthorpe <jgg@nvidia.com>,
	Bernard Metzler <bmt@zurich.ibm.com>,
	Doug Ledford <dledford@redhat.com>,
	linux-rdma@vger.kernel.org, Zhu Yanjun <yanjunz@nvidia.com>,
	"Pearson, Robert B" <robert.pearson2@hpe.com>
Subject: Re: [PATCH] RDMA/siw,rxe: Make emulated devices virtual in the device tree
Date: Fri, 6 Nov 2020 17:04:24 -0800	[thread overview]
Message-ID: <677434b0-7482-2a11-ae80-7f9f9563aad0@acm.org> (raw)
In-Reply-To: <0-v1-dcbfc68c4b4a+d6-virtual_dev_jgg@nvidia.com>

On 11/6/20 6:00 AM, Jason Gunthorpe wrote:
> This moves siw and rxe to be virtual devices in the device tree:
> 
> lrwxrwxrwx 1 root root 0 Nov  6 13:55 /sys/class/infiniband/rxe0 -> ../../devices/virtual/infiniband/rxe0/
> 
> Previously they were trying to parent themselves to the physical device of
> their attached netdev, which doesn't make alot of sense.
> 
> My hope is this will solve some weird syzkaller hits related to sysfs as
> it could be possible that the parent of a netdev is another netdev, eg
> under bonding or some other syzkaller found netdev configuration.
> 
> Nesting a ib_device under anything but a physical device is going to cause
> inconsistencies in sysfs during destructions.

Hi Jason,

I do not know enough about the code touched by this patch to comment on
the patch itself. But I expect that the blktests code will have to be
modified to compensate for this change. How to translate the name of a
virtual RDMA device into a netdev device with this patch applied?

From the blktests project:

# Check whether or not an rdma_rxe instance has been associated with
# network interface $1.
has_rdma_rxe() {
	local f

	for f in /sys/class/infiniband/*/parent; do
		if [ -e "$f" ] && [ "$(<"$f")" = "$1" ]; then
			return 0
		fi
	done

	return 1
}

rdma_dev_to_net_dev() {
	local b d rdma_dev=$1

	b=/sys/class/infiniband/$rdma_dev/parent
	if [ -e "$b" ]; then
		echo "$(<"$b")"
	else
		echo "${rdma_dev%_siw}"
	fi
}

Bart.

  reply	other threads:[~2020-11-07  1:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-06 14:00 [PATCH] RDMA/siw,rxe: Make emulated devices virtual in the device tree Jason Gunthorpe
2020-11-07  1:04 ` Bart Van Assche [this message]
2020-11-09 20:54   ` Jason Gunthorpe
2020-11-23 20:15 ` Jason Gunthorpe

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=677434b0-7482-2a11-ae80-7f9f9563aad0@acm.org \
    --to=bvanassche@acm.org \
    --cc=bmt@zurich.ibm.com \
    --cc=dledford@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=robert.pearson2@hpe.com \
    --cc=yanjunz@nvidia.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