Mailing List Archive

XEN 4.12, redirect tape drive to domu
Dear all.

I have an ubuntu 18.04LTS DOM0 with XEN 4.12 installed, and several PV
domUs (mainly ubuntu linux).

In the dom0, I have a tape drive installed:
st 4:0:6:0: Attached scsi tape st0

This is a good old HP DAT 72 SCSI tape drive.

From the dom0, I can access the tape drive, no problem, but it woudl be
more conveniant if I could access it directly form one of the domus.

The scsi card is a very old Adaptec AIC-7892A U160/m from the late 90s,
so it does not support any virtualization specific helpers.

My question is, should it be possible to passthrough this tape drive, or
the complete scsi card sitting on the pci (due to it's only aim is to
provide access to the tape), somehow? Are there any specialities?


--

?li?s Tam?s
Thomas Elias

ETIT[nwpro] KFT, ?gyvezet?-H?l?zatbiztons?gi specialista
ETIT[nwpro] Ltd, General Manager-Network security specialist

Tel. HU: +36/30-497-1626
OpenPGP pubkey: http://etit.hu/doc/et-pub.asc

Okleveles m?rn?k-informatikus (MSC)
Master of Science in Information Technology (MSC)
Licenced Penetration Tester (TM15-047)

Kapcsolat: http://etit.hu/index.php/hu/kapcsolat
Jogi nyilatkozat: http://etit.hu/disclaimer-email-hu.txt
Contact: http://etit.hu/index.php/en/contact
Disclaimer: http://etit.hu/disclaimer-email-en.txt
Re: XEN 4.12, redirect tape drive to domu [ In reply to ]
Am Freitag, 25. September 2020, 15:20:53 CEST schrieb ?li?s Tam?s:
> My question is, should it be possible to passthrough this tape drive, or
> the complete scsi card sitting on the pci (due to it's only aim is to
> provide access to the tape), somehow? Are there any specialities?
hmm,
if just one DomU should gain access to that PCI device, PCI passthrough may
work, but if you want to use it from different DomU things may get
complicated, because only one DomU at a time should get access to it. If xen
allows to attach tape scsci devices (never tried it) this may be a way to
instead.

If you want to use it i.e., for a daily/nightly backup of all DomU, PCI
hotplug and PCI attach (or storage device attach/detach iif it works with
tape) may be way to "connect" -> backup -> "disconnect" to the volumes of
each DomU.

I wrote a xenbackup tool (shell scripts) for Dom0 side backup of LVM based
DomU storages (with snapshots) - by default for backup-manager, but it may be
a base to adapt it to your "batch" application with PCI passthrough and some
ssh command to do the backup "from within" the DomUs if you need that.

https://www.syndicat.com/open_source/projekte/xenbackup/
https://github.com/nielsd/xen-host-allbackup

you would have to adapt the snaps_backup_mount / snaps_backup_umount scripts

DomUs/storages could be configured in:
/etc/xenback_vols



hth,


niels.
--
---
Niels Dettenbach
Syndicat IT & Internet
http://www.syndicat.com
PGP: https://syndicat.com/pub_key.asc
---
Re: XEN 4.12, redirect tape drive to domu [ In reply to ]
Hi!

Thank you for the responses. At the moment when I'm using PCI
passthorugh I receive the follwoing error:


[ 17.592149] scsi 4:0:6:0: Sequential-Access IBM DDS Gen5
A1B0 PQ: 0 ANSI: 3
[ 17.607179] scsi target4:0:6: Beginning Domain Validation
[ 17.612790] scsi target4:0:6: wide asynchronous
[ 17.616625] scsi target4:0:6: FAST-20 WIDE SCSI 40.0 MB/s ST (50 ns,
offset 32)
[ 17.619668] scsi target4:0:6: Domain Validation skipping write tests
[ 17.619670] scsi target4:0:6: Ending Domain Validation
[ 19.677562] scsi 4:0:6:0: Attached scsi generic sg9 type 1
[ 19.683814] st: Version 20160209, fixed bufsize 32768, s/g segs 256
[ 19.685623] st 4:0:6:0: Attached scsi tape st0
[ 19.685626] st 4:0:6:0: st0: try direct i/o: yes (alignment 4 B)
[19057.309731] st 4:0:6:0: Power-on or device reset occurred
[19121.837625] st 4:0:6:0: [st0] Block limits 1 - 16777215 bytes.
[20183.205282] INFO: task mt:12738 blocked for more than 120 seconds.
[20183.205408] Not tainted 5.4.0-48-generic #52~18.04.1-Ubuntu
[20183.205516] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"
disables this message.
[20183.205644] mt D 0 12738 12736 0x00000000
[20183.205649] Call Trace:
[20183.205668] __schedule+0x293/0x720
[20183.205672] schedule+0x33/0xa0
[20183.205675] schedule_timeout+0x1d3/0x320
[20183.205684] ? __blk_mq_delay_run_hw_queue+0x107/0x160
[20183.205687] ? blk_mq_run_hw_queue+0x56/0x100
[20183.205690] wait_for_completion+0xba/0x140
[20183.205696] ? wake_up_q+0x80/0x80
[20183.205704] st_do_scsi.constprop.29+0x37f/0x420 [st]
[20183.205707] st_int_ioctl+0x28f/0xf80 [st]
[20183.205711] ? st_int_ioctl+0x28f/0xf80 [st]
[20183.205714] st_ioctl+0x6b4/0x1770 [st]
[20183.205721] ? _copy_to_user+0x26/0x30
[20183.205728] ? cp_new_stat+0x152/0x180
[20183.205732] do_vfs_ioctl+0xa9/0x640
[20183.205735] ? __do_sys_newfstat+0x44/0x70
[20183.205738] ksys_ioctl+0x75/0x80
[20183.205740] __x64_sys_ioctl+0x1a/0x20
[20183.205747] do_syscall_64+0x57/0x190
[20183.205749] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[20183.205753] RIP: 0033:0x7fc44fdca6d7
[20183.205777] Code: Bad RIP value.
[20183.205779] RSP: 002b:00007ffc346c4f78 EFLAGS: 00000246 ORIG_RAX:
0000000000000010
[20183.205781] RAX: ffffffffffffffda RBX: 00007ffc346c5802 RCX:
00007fc44fdca6d7
[20183.205783] RDX: 00007ffc346c4f80 RSI: 0000000040086d01 RDI:
0000000000000003
[20183.205784] RBP: 00007ffc346c5802 R08: 0000000000000000 R09:
0000000000000000
[20183.205785] R10: 0000000000000000 R11: 0000000000000246 R12:
00005578d705fcf0
[20183.205787] R13: 00007ffc346c50a0 R14: 0000000000000000 R15:
0000000000000000
[20185.674286] st 4:0:6:0: [st0] Sense Key : Medium Error [current]
[20185.674291] st 4:0:6:0: [st0] Add. Sense: Excessive write errors

If I reboot the system, tape drive works from dom0, but I get the above
message from domu. I guess there should be some kind of fine-tuning
available for pci passthrough?

I admint the pci device is an old one, it does not even supports
function level reset:
29:01.0 SCSI storage controller: Adaptec AIC-7892A U160/m (rev 02)
Subsystem: Adaptec 29160 Ultra160 SCSI Controller
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop-
ParErr+ Stepping- SERR+ FastB2B- DisINTx-
Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium
>TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 64 (10000ns min, 6250ns max), Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 16
BIST result: 00
Region 0: I/O ports at 1000 [disabled] [size=256]
Region 1: Memory at 97900000 (64-bit, non-prefetchable) [size=4K]
Expansion ROM at 97920000 [disabled] [size=128K]
Capabilities: [dc] Power Management version 2
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA
PME(D0-,D1-,D2-,D3hot-,D3cold-)
Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
Kernel driver in use: aic7xxx
Kernel modules: aic7xxx


These io-specific functions are supported by my server:


(XEN) I/O virtualisation disabled
(XEN) ENABLING IO-APIC IRQs
(XEN) -> Using new ACK method
(XEN) Allocated console ring of 16 KiB.
(XEN) VMX: Supported advanced features:
(XEN) - APIC MMIO access virtualisation
(XEN) - APIC TPR shadow
(XEN) - Extended Page Tables (EPT)
(XEN) - Virtual-Processor Identifiers (VPID)
(XEN) - Virtual NMI
(XEN) - MSR direct-access bitmap
(XEN) HVM: ASIDs enabled.
(XEN) VMX: Disabling executable EPT superpages due to CVE-2018-12207
(XEN) HVM: VMX enabled
(XEN) HVM: Hardware Assisted Paging (HAP) detected
(XEN) HVM: HAP page sizes: 4kB, 2MB

[ 0.000000] DMI: IBM IBM System x3400 M3 Server -[7379KTG]-/69Y4356,
BIOS -[Y4E159AUS-1.14]- 05/06/2013




2020. 09. 28. 10:36 keltez?ssel, Niels Dettenbach ?rta:
> Am Freitag, 25. September 2020, 15:20:53 CEST schrieb ?li?s Tam?s:
>> My question is, should it be possible to passthrough this tape drive, or
>> the complete scsi card sitting on the pci (due to it's only aim is to
>> provide access to the tape), somehow? Are there any specialities?
> hmm,
> if just one DomU should gain access to that PCI device, PCI passthrough may
> work, but if you want to use it from different DomU things may get
> complicated, because only one DomU at a time should get access to it. If xen
> allows to attach tape scsci devices (never tried it) this may be a way to
> instead.
>
> If you want to use it i.e., for a daily/nightly backup of all DomU, PCI
> hotplug and PCI attach (or storage device attach/detach iif it works with
> tape) may be way to "connect" -> backup -> "disconnect" to the volumes of
> each DomU.
>
> I wrote a xenbackup tool (shell scripts) for Dom0 side backup of LVM based
> DomU storages (with snapshots) - by default for backup-manager, but it may be
> a base to adapt it to your "batch" application with PCI passthrough and some
> ssh command to do the backup "from within" the DomUs if you need that.
>
> https://www.syndicat.com/open_source/projekte/xenbackup/
> https://github.com/nielsd/xen-host-allbackup
>
> you would have to adapt the snaps_backup_mount / snaps_backup_umount scripts
>
> DomUs/storages could be configured in:
> /etc/xenback_vols
>
>
>
> hth,
>
>
> niels.
>

--

?li?s Tam?s
Thomas Elias

ETIT[nwpro] KFT, ?gyvezet?-H?l?zatbiztons?gi specialista
ETIT[nwpro] Ltd, General Manager-Network security specialist

Tel. HU: +36/30-497-1626
OpenPGP pubkey: http://etit.hu/doc/et-pub.asc

Okleveles m?rn?k-informatikus (MSC)
Master of Science in Information Technology (MSC)
Licenced Penetration Tester (TM15-047)

Kapcsolat: http://etit.hu/index.php/hu/kapcsolat
Jogi nyilatkozat: http://etit.hu/disclaimer-email-hu.txt
Contact: http://etit.hu/index.php/en/contact
Disclaimer: http://etit.hu/disclaimer-email-en.txt
Re: XEN 4.12, redirect tape drive to domu [ In reply to ]
Am Montag, 28. September 2020, 11:05:01 CEST schrieb ?li?s Tam?s:
> [20183.205282] INFO: task mt:12738 blocked for more than 120 seconds.
> [20183.205408] Not tainted 5.4.0-48-generic #52~18.04.1-Ubuntu
> [20183.205516] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"
> disables this message.
just shot in the dark: did you tried that advice?

--
---
Niels Dettenbach
Syndicat IT & Internet
http://www.syndicat.com
PGP: https://syndicat.com/pub_key.asc
---
Re: XEN 4.12, redirect tape drive to domu [ In reply to ]
Nope, due to as per my previous experience it does not resolve anything,
you just cannot see that there is a problem... :) A "rewind" command
should not take more than 120 seconds anyway, for a casette that is
already at it's beginning... The command by the way does not goes in to
the device, due to it is not trying to rewind the tape (it does nothing).

2020. 09. 28. 11:11 keltez?ssel, Niels Dettenbach ?rta:
> Am Montag, 28. September 2020, 11:05:01 CEST schrieb ?li?s Tam?s:
>> [20183.205282] INFO: task mt:12738 blocked for more than 120 seconds.
>> [20183.205408] Not tainted 5.4.0-48-generic #52~18.04.1-Ubuntu
>> [20183.205516] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs"
>> disables this message.
> just shot in the dark: did you tried that advice?
>

--

?li?s Tam?s
Thomas Elias

ETIT[nwpro] KFT, ?gyvezet?-H?l?zatbiztons?gi specialista
ETIT[nwpro] Ltd, General Manager-Network security specialist

Tel. HU: +36/30-497-1626
OpenPGP pubkey: http://etit.hu/doc/et-pub.asc

Okleveles m?rn?k-informatikus (MSC)
Master of Science in Information Technology (MSC)
Licenced Penetration Tester (TM15-047)

Kapcsolat: http://etit.hu/index.php/hu/kapcsolat
Jogi nyilatkozat: http://etit.hu/disclaimer-email-hu.txt
Contact: http://etit.hu/index.php/en/contact
Disclaimer: http://etit.hu/disclaimer-email-en.txt
Re: XEN 4.12, redirect tape drive to domu [ In reply to ]
Am Montag, 28. September 2020, 11:20:05 CEST schrieb ?li?s Tam?s:
> Nope, due to as per my previous experience it does not resolve anything,
> you just cannot see that there is a problem... A "rewind" command
> should not take more than 120 seconds anyway, for a casette that is
> already at it's beginning... The command by the way does not goes in to
> the device, due to it is not trying to rewind the tape (it does nothing).
...thought something similiar, but sometimes such advices are bit unclear.
To me it seems like some "timeout" in a regarding subsystem (scsi driver?),
but my scope ends here too ?).

did you read this?
https://wiki.xenproject.org/wiki/Paravirtualized_SCSI

--
---
Niels Dettenbach
Syndicat IT & Internet
http://www.syndicat.com
PGP: https://syndicat.com/pub_key.asc
---
Re: XEN 4.12, redirect tape drive to domu [ In reply to ]
Hi.

Thank you for bringing this into my attention. I will try this one
during the next "playtime window". :)

> did you read this?
> https://wiki.xenproject.org/wiki/Paravirtualized_SCSI

>

--

?li?s Tam?s
Thomas Elias

ETIT[nwpro] KFT, ?gyvezet?-H?l?zatbiztons?gi specialista
ETIT[nwpro] Ltd, General Manager-Network security specialist

Tel. HU: +36/30-497-1626
OpenPGP pubkey: http://etit.hu/doc/et-pub.asc

Okleveles m?rn?k-informatikus (MSC)
Master of Science in Information Technology (MSC)
Licenced Penetration Tester (TM15-047)

Kapcsolat: http://etit.hu/index.php/hu/kapcsolat
Jogi nyilatkozat: http://etit.hu/disclaimer-email-hu.txt
Contact: http://etit.hu/index.php/en/contact
Disclaimer: http://etit.hu/disclaimer-email-en.txt
Re: XEN 4.12, redirect tape drive to domu [ In reply to ]
Niels Dettenbach schrieb:

> did you read this?
> https://wiki.xenproject.org/wiki/Paravirtualized_SCSI

Does this really work? Last time I tried I got the impression that it
does not. At least not in the case I tried (passing through a CD drive).

--
Manfred Härtel, DB3HM mailto:Manfred.Haertel@rz-online.de
http://rz-home.de/mhaertel
Re: XEN 4.12, redirect tape drive to domu [ In reply to ]
Am Montag, 28. September 2020, 12:10:08 CEST schrieb Manfred Haertel, DB3HM:
> Does this really work? Last time I tried I got the impression that it
> does not. At least not in the case I tried (passing through a CD drive).
Never used it productive byself, but expect it was (is) used with typical
SCSI stack (i.e. FC, iSCSI etc.) HA setups like here:
http://www-archive.xenproject.org/files/xensummit_fall07/19_Matsumoto.pdf

at least in that doc Fijutsu stated pvSCSCI as follows in a "older"
presentation:

--- snip ---
- pvSCSI driver on driver domain is under evaluation.
-? pvSCSI driver works on HVM domain and PV domain.
--- snap ---


i.e. "current" 5.8.5 linux kernel states in "drivers/xen/Kconfig":

--- snip ---
config XEN_SCSI_BACKEND

tristate "XEN SCSI backend driver"

depends on XEN && XEN_BACKEND && TARGET_CORE

The SCSI backend driver allows the kernel to export its SCSI Devices to other
guests via a high-performance shared-memory interface.
Only needed for systems running as XEN driver domains (e.g. Dom0) and if
guests need generic access to SCSI devices.
--- snap ---

so i would give it a try...?)

--
---
Niels Dettenbach
Syndicat IT & Internet
http://www.syndicat.com
PGP: https://syndicat.com/pub_key.asc
---
Re: XEN 4.12, redirect tape drive to domu [ In reply to ]
Hi!

You need to load the xen pci passtrough driver for the card in the dom0. So
it is not supposed to work in dom0, if you want to pass it to a domU.
Good luck!

M

On Mon, Sep 28, 2020, 11:49 Éliás Tamás <et@etit.hu> wrote:

> Hi.
>
> Thank you for bringing this into my attention. I will try this one
> during the next "playtime window". :)
>
> > did you read this?
> > https://wiki.xenproject.org/wiki/Paravirtualized_SCSI
>
> >
>
> --
>
> Éliás Tamás
> Thomas Elias
>
> ETIT[nwpro] KFT, Ügyvezet?-Hálózatbiztonsági specialista
> ETIT[nwpro] Ltd, General Manager-Network security specialist
>
> Tel. HU: +36/30-497-1626
> OpenPGP pubkey: http://etit.hu/doc/et-pub.asc
>
> Okleveles mérnök-informatikus (MSC)
> Master of Science in Information Technology (MSC)
> Licenced Penetration Tester (TM15-047)
>
> Kapcsolat: http://etit.hu/index.php/hu/kapcsolat
> Jogi nyilatkozat: http://etit.hu/disclaimer-email-hu.txt
> Contact: http://etit.hu/index.php/en/contact
> Disclaimer: http://etit.hu/disclaimer-email-en.txt
>
>