Skip to contentSkip to conversation

hotplug: Restore block-tap phy compatibility

PATCH In review Jason Andryuk 5 participants 6 messages May 16, 2024 – Jun 20, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hotplug: Restore block-tap phy compatibility

From: Jason Andryuk <[email protected]>

From: Jason Andryuk <[email protected]>

backendtype=phy using the blktap kernel module needs to use write_dev, but tapback can't support that. tapback should perform better, but make the script compatible with the old kernel module again.

---
This is tested with tapback, but untested with phy/blkback since I don't have the kernel module setup.

 tools/hotplug/Linux/block-tap | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
tools/hotplug/Linux/block-tap +15 -6
index 126e472786..8661ce77e3 100755
@@ -20,9 +20,13 @@
 #
 # Disks should be specified using the following syntax:
 #
+# For use with tapback (vbd3) (preferred):
 # vdev=xvda,backendtype=tap,format=vhd,target=/srv/target.vhd
 #
-# format is either "aio" (for raw files), or "vhd"
+# For use with blkback and the blktap2 kernel module:
+# script=block-tap,vdev=xvda,target=<type>:<file>
+#
+# format/<type> is either "aio" (for raw files), or "vhd"
 
 dir=$(dirname "$0")
 . "$dir/block-common.sh"
@@ -205,12 +209,17 @@ add()
 
     xenstore_write "$XENBUS_PATH/pid" "$pid"
     xenstore_write "$XENBUS_PATH/minor" "$minor"
-    # dev, as a unix socket, would end up with major:minor 0:0 in
-    # physical-device if write_dev were used.  tapback would be thrown off by
-    # that incorrect minor, so just skip writing physical-device.
-    xenstore_write "$XENBUS_PATH/physical-device-path" "$dev"
 
-    success
+    if [ "$XENBUS_TYPE" = "vbd3" ] ; then
+        # $dev, as a unix socket, has major:minor 0:0.  If write_dev writes
+        # physical-device, tapback would use that incorrect minor 0.  So don't
+        # write physical-device.
+        xenstore_write "$XENBUS_PATH/physical-device-path" "$dev"
+
+        success
+    else
+        write_dev "$dev"
+    fi
 
     release_lock "block"
 }
Signature · 1 line
2.40.1
#1 lore raw
Quoted 3 lines · Jason Andryuk

From: Jason Andryuk <[email protected]>

From: Jason Andryuk <[email protected]>

Two identical From: (also in another patch of yours, while in yet another one you have two _different_ ones, when only one will survive into the eventual commit anyway)?

Quoted 5 lines

backendtype=phy using the blktap kernel module needs to use write_dev, but tapback can't support that. tapback should perform better, but make the script compatible with the old kernel module again.

Should there be a Fixes: tag here?

Jan

#2 lore raw
Quoted 8 lines · Jan Beulich
Quoted 3 lines · Jason Andryuk

From: Jason Andryuk <[email protected]>

From: Jason Andryuk <[email protected]>

Two identical From: (also in another patch of yours, while in yet another one you have two _different_ ones, when only one will survive into the eventual commit anyway)?

Sorry about that. Since I was sending from my gmail account, I thought I needed explicit From: lines to ensure the authorship was listed w/ amd.com. I generated the patches with git format-patch --from, to get the explicit From: lines, and then sent with git send-email. The send-email step then inserted the additional lines. I guess it added From amd.com since I had changed to that address in .gitconfig.

Quoted 7 lines
Quoted 5 lines

backendtype=phy using the blktap kernel module needs to use write_dev, but tapback can't support that. tapback should perform better, but make the script compatible with the old kernel module again.

Should there be a Fixes: tag here?

That makes sense.

Fixes 76a484193d ("hotplug: Update block-tap")

Thanks,
Jason

#3 lore raw
Quoted 21 lines · Jason Andryuk
Quoted 8 lines · Jan Beulich
Quoted 3 lines · Jason Andryuk

From: Jason Andryuk <[email protected]>

From: Jason Andryuk <[email protected]>

Two identical From: (also in another patch of yours, while in yet another one you have two _different_ ones, when only one will survive into the eventual commit anyway)?

Sorry about that. Since I was sending from my gmail account, I thought I needed explicit From: lines to ensure the authorship was listed w/ amd.com. I generated the patches with git format-patch --from, to get the explicit From: lines, and then sent with git send-email. The send-email step then inserted the additional lines. I guess it added
From amd.com since I had changed to that address in .gitconfig.

Quoted 4 lines
Quoted 4 lines

backendtype=phy using the blktap kernel module needs to use write_dev, but tapback can't support that. tapback should perform better, but make the script compatible with the old kernel module again.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Should there be a Fixes: tag here?

That makes sense.

Fixes 76a484193d ("hotplug: Update block-tap")

Surely this wants going into 4.19? Thus - Anthony, Oleksii?

Jan

#4 lore raw
Quoted 24 lines · Jan Beulich
Quoted 23 lines · Jason Andryuk
Quoted 8 lines · Jan Beulich
Quoted 3 lines · Jason Andryuk

From: Jason Andryuk <[email protected]>

From: Jason Andryuk <[email protected]>

Two identical From: (also in another patch of yours, while in yet another one you have two _different_ ones, when only one will survive into the eventual commit anyway)?

Sorry about that. Since I was sending from my gmail account, I thought I needed explicit From: lines to ensure the authorship was listed w/ amd.com. I generated the patches with git format-patch --from, to get the explicit From: lines, and then sent with git send-email. The send-email step then inserted the additional lines. I guess it added
From amd.com since I had changed to that address in .gitconfig.

Quoted 6 lines
Quoted 5 lines

backendtype=phy using the blktap kernel module needs to use write_dev, but tapback can't support that. tapback should perform better, but make the script compatible with the old kernel module again.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Should there be a Fixes: tag here?

That makes sense.

Fixes 76a484193d ("hotplug: Update block-tap")

Surely this wants going into 4.19? Thus - Anthony, Oleksii?

Yes, I think so.

Thanks,

Signature · 5 lines
Anthony Perard | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech
#5 lore raw
Quoted 38 lines · Anthony PERARD
Quoted 37 lines · Jan Beulich
Quoted 36 lines · Jason Andryuk
Quoted 10 lines · Jan Beulich
Quoted 3 lines · Jason Andryuk

From: Jason Andryuk <[email protected]>

From: Jason Andryuk <[email protected]>

Two identical From: (also in another patch of yours, while in yet another one
you have two _different_ ones, when only one will survive into the eventual
commit anyway)?

Sorry about that.  Since I was sending from my gmail account, I thought
I needed explicit From: lines to ensure the authorship was listed w/
amd.com.  I generated the patches with git format-patch --from, to get
the explicit From: lines, and then sent with git send-email. The
send-email step then inserted the additional lines.  I guess it added
 From amd.com since I had changed to that address in .gitconfig.

Quoted 9 lines
Quoted 7 lines

backendtype=phy using the blktap kernel module needs to use write_dev,
but tapback can't support that.  tapback should perform better, but make
the script compatible with the old kernel module again.

Should there be a Fixes: tag here?

That makes sense.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Fixes 76a484193d ("hotplug: Update block-tap")

Surely this wants going into 4.19? Thus - Anthony, Oleksii?

Yes, I think so.

~ Oleksii