Discussion of the VIRTIO specification
 help / color / mirror / Atom feed
From: "Richard W.M. Jones" <rjones@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: virtio-comment@lists.linux.dev
Subject: Re: [PATCH 1/1] device-types/blk/description.tex: Allow longer device IDs to be returned
Date: Tue, 8 Sep 2026 11:43:45 +0100	[thread overview]
Message-ID: <20260908104345.GU1436@redhat.com> (raw)
In-Reply-To: <20260908053922-mutt-send-email-mst@kernel.org>

On Tue, Sep 08, 2026 at 06:06:14AM -0400, Michael S. Tsirkin wrote:
> On Tue, Sep 08, 2026 at 10:35:34AM +0100, Richard W.M. Jones wrote:
> > On Mon, Sep 07, 2026 at 03:27:25PM -0400, Michael S. Tsirkin wrote:
> > > On Mon, Sep 07, 2026 at 03:02:24PM +0100, Richard W.M. Jones wrote:
> > > > On Mon, Sep 07, 2026 at 03:56:56AM -0400, Michael S. Tsirkin wrote:
> > > > > why 247? It feels like a lot, especially given we are padding. I'd say
> > > > > 128 maybe.  This way it fits in a single pci express packet on most
> > > > > systems.
> > > > 
> > > > virtio-scsi supports, at least in theory, 248 bytes, see:
> > > > 
> > > > https://gitlab.com/qemu/qemu/-/blob/cacd3462963a0a4f5bab4263ce79c2aa4b32692d/hw/scsi/scsi-disk.c#L708
> > > > 
> > > > This is chosen because of the maximum page size of a SCSI VPD (256)
> > > > minus the 8 bytes used for the header in VPD page 0x83.
> > > 
> > > Can I see a spec which says that is the maximum size?
> > 
> > I don't think virtio-scsi is following a spec,
> 
> 
> But you referred to SCSI VPD and said it has a limit of 256
> and an 8 byte header. I can't figure out where this is from?
> 
> > but it's clear from the
> > source code that the limit is 256-8, see the link above.
> > 
> > [...]
> 
> 
> Hmm. I see MAX_SERIAL_LEN which is 36? And  MAX_SERIAL_LEN_FOR_DEVID
> which is 20?

Indeed you're right ... and this is very confusing.

qemu lets you set both serial and device_id, eg:

$ qemu-system-x86_64 -machine accel=kvm:tcg -cpu max -m 4096 \
  -device virtio-scsi-pci,id=scsi0 \
  -drive id=hd1,file=$HOME/tmp/vms/rhel-10.qcow2,format=qcow2,if=none \
  -device scsi-hd,bus=scsi0.0,drive=hd1,device_id=ABCDEFGHIJ0123456789abcdefghij0123456789ABCDEFGHIJ0123456789abcdefghij0123456789ABCDEFGHIJ0123456789abcdefghij0123456789ABCDEFGHIJ0123456789abcdefghij0123456789ABCDEFGHIJ0123456789abcdefghij0123456789ABCDEFGHIJ0123456789abcdefghij0123456789,serial=123456789012345678901234567890 

'serial' is exposed through VPD page 0x80 and is limited to 36 chars.

'device_id' is exposed through VPD page 0x83 and is limited to 256-8
bytes.

udev seems to use page 0x80 (not 0x83) to generate symlinks.

Anyway 20 chars is < 36 chars so the need for longer serials for
virtio-blk remains.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top


  reply	other threads:[~2026-09-08 10:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-06 14:54 [PATCH 0/1] [PATCH] device-types/blk/description.tex: Allow longer device IDs to be returned Richard W.M. Jones
2026-09-06 14:54 ` [PATCH 1/1] " Richard W.M. Jones
2026-09-06 15:13   ` Michael S. Tsirkin
2026-09-06 16:06     ` Richard W.M. Jones
2026-09-07  7:33       ` Michael S. Tsirkin
2026-09-07  7:56   ` Michael S. Tsirkin
2026-09-07 14:02     ` Richard W.M. Jones
2026-09-07 19:27       ` Michael S. Tsirkin
2026-09-08  9:35         ` Richard W.M. Jones
2026-09-08 10:06           ` Michael S. Tsirkin
2026-09-08 10:43             ` Richard W.M. Jones [this message]
2026-09-08 10:57               ` Michael S. Tsirkin

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=20260908104345.GU1436@redhat.com \
    --to=rjones@redhat.com \
    --cc=mst@redhat.com \
    --cc=virtio-comment@lists.linux.dev \
    /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