All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH blktests] common/multipath-over-rdma: update is_rdma_device
@ 2021-01-20 23:18 Yi Zhang
  2021-01-21  4:01 ` Bart Van Assche
  0 siblings, 1 reply; 2+ messages in thread
From: Yi Zhang @ 2021-01-20 23:18 UTC (permalink / raw)
  To: bvanassche, osandov; +Cc: linux-block

Below patch make the siw/rxe device virtual in the device tree, update
is_rdma_device to match it.
a9d2e9ae953f RDMA/siw,rxe: Make emulated devices virtual in the device tree

Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
---
 common/multipath-over-rdma | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/common/multipath-over-rdma b/common/multipath-over-rdma
index 355b169..e4269f6 100644
--- a/common/multipath-over-rdma
+++ b/common/multipath-over-rdma
@@ -79,17 +79,24 @@ is_number() {
 # Check whether a device is an RDMA device. An example argument:
 # /sys/devices/pci0000:00/0000:00:03.0/0000:04:00.0
 is_rdma_device() {
-	local d i inode1 inode2
+	local d i f inode1 inode2
 
-	inode1=$(stat -c %i "$1")
-	# echo "inode1 = $inode1"
+	f=$1
+	inode1=$(stat -c %i "$f")
 	for i in /sys/class/infiniband/*; do
 		d=/sys/class/infiniband/"$(readlink "$i")"
-		d=$(dirname "$(dirname "$d")")
-		inode2=$(stat -c %i "$d")
-		# echo "inode2 = $inode2"
-		if [ "$inode1" = "$inode2" ]; then
-			return
+		if [[ "$d" == *"virtual"* ]]; then
+			if [[ -e "$d/parent" && "${f%%/*}" == "$(<"$d"/parent)" ]] || \
+				   [[ "${f%%/*}_siw" == "$(basename "$d")" ]]; then
+				return
+			fi
+		else
+			d1=$(dirname "$(dirname "$d")")
+			inode2=$(stat -c %i "$d1")
+			# echo "inode2 = $inode2"
+			if [ "$inode1" = "$inode2" ]; then
+				return
+			fi
 		fi
 	done
 	false
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH blktests] common/multipath-over-rdma: update is_rdma_device
  2021-01-20 23:18 [PATCH blktests] common/multipath-over-rdma: update is_rdma_device Yi Zhang
@ 2021-01-21  4:01 ` Bart Van Assche
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Van Assche @ 2021-01-21  4:01 UTC (permalink / raw)
  To: Yi Zhang, osandov; +Cc: linux-block

On 1/20/21 3:18 PM, Yi Zhang wrote:
> Below patch make the siw/rxe device virtual in the device tree, update
> is_rdma_device to match it.
> a9d2e9ae953f RDMA/siw,rxe: Make emulated devices virtual in the device tree
> 
> Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
> ---
>  common/multipath-over-rdma | 23 +++++++++++++++--------
>  1 file changed, 15 insertions(+), 8 deletions(-)
> 
> diff --git a/common/multipath-over-rdma b/common/multipath-over-rdma
> index 355b169..e4269f6 100644
> --- a/common/multipath-over-rdma
> +++ b/common/multipath-over-rdma
> @@ -79,17 +79,24 @@ is_number() {
>  # Check whether a device is an RDMA device. An example argument:
>  # /sys/devices/pci0000:00/0000:00:03.0/0000:04:00.0
>  is_rdma_device() {
> -	local d i inode1 inode2
> +	local d i f inode1 inode2
>  
> -	inode1=$(stat -c %i "$1")
> -	# echo "inode1 = $inode1"
> +	f=$1
> +	inode1=$(stat -c %i "$f")
>  	for i in /sys/class/infiniband/*; do
>  		d=/sys/class/infiniband/"$(readlink "$i")"
> -		d=$(dirname "$(dirname "$d")")
> -		inode2=$(stat -c %i "$d")
> -		# echo "inode2 = $inode2"
> -		if [ "$inode1" = "$inode2" ]; then
> -			return
> +		if [[ "$d" == *"virtual"* ]]; then
> +			if [[ -e "$d/parent" && "${f%%/*}" == "$(<"$d"/parent)" ]] || \
> +				   [[ "${f%%/*}_siw" == "$(basename "$d")" ]]; then
> +				return
> +			fi
> +		else
> +			d1=$(dirname "$(dirname "$d")")
> +			inode2=$(stat -c %i "$d1")
> +			# echo "inode2 = $inode2"
> +			if [ "$inode1" = "$inode2" ]; then
> +				return
> +			fi
>  		fi
>  	done
>  	false

Jason Gunthorpe, the RDMA maintainer, asked some time ago to use rdma
link instead of inspecting /sys/class/infiniband to query rdma_rxe / siw
instance properties. Please take a look at the blktests patch that I
just posted and on which I cc-ed you.

Thanks,

Bart.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-21  4:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20 23:18 [PATCH blktests] common/multipath-over-rdma: update is_rdma_device Yi Zhang
2021-01-21  4:01 ` Bart Van Assche

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.