mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"Eugenio Pérez" <eperezma@redhat.com>,
	"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
	"Jonathan Corbet" <corbet@lwn.net>,
	kvm@vger.kernel.org, virtualization@lists.linux.dev,
	linux-doc@vger.kernel.org
Subject: Re: [PATCH 1/3] virtio: dwords->qwords
Date: Thu, 9 Oct 2025 14:31:04 +0200	[thread overview]
Message-ID: <26d7d26e-dd45-47bb-885b-45c6d44900bb@lunn.ch> (raw)
In-Reply-To: <350d0abfaa2dcdb44678098f9119ba41166f375f.1760008798.git.mst@redhat.com>

On Thu, Oct 09, 2025 at 07:24:08AM -0400, Michael S. Tsirkin wrote:
> A "word" is 16 bit. 64 bit integers like virtio uses are not dwords,
> they are actually qwords.

I'm having trouble with this....

This bit makes sense. 4x 16bits = 64 bits.

> -static const u64 vhost_net_features[VIRTIO_FEATURES_DWORDS] = {
> +static const u64 vhost_net_features[VIRTIO_FEATURES_QWORDS] = {

If this was u16, and VIRTIO_FEATURES_QWORDS was 4, which the Q would
imply, than i would agree with what you are saying. But this is a u64
type.  It is already a QWORD, and this is an array of two of them.

I think the real issue here is not D vs Q, but WORD. We have a default
meaning of a u16 for a word, especially in C. But that is not the
actual definition of a word a computer scientist would use. Wikipedia
has:

  In computing, a word is any processor design's natural unit of
  data. A word is a fixed-sized datum handled as a unit by the
  instruction set or the hardware of the processor.

A word can be any size. In this context, virtio is not referring to
the instruction set, but a protocol. Are all fields in this protocol
u64? Hence word is u64? And this is an array of two words? That would
make DWORD correct, it is two words.

If you want to change anything here, i would actually change WORD to
something else, maybe FIELD?

And i could be wrong here, i've not looked at the actual protocol, so
i've no idea if all fields in the protocol are u64. There are
protocols like this, IPv6 uses u32, not octets, and the length field
in the headers refer to the number of u32s in the header.

	Andrew

  reply	other threads:[~2025-10-09 12:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-09 11:24 [PATCH 0/3] feature related cleanups Michael S. Tsirkin
2025-10-09 11:24 ` [PATCH 1/3] virtio: dwords->qwords Michael S. Tsirkin
2025-10-09 12:31   ` Andrew Lunn [this message]
2025-10-09 13:37     ` Michael S. Tsirkin
2025-10-11 17:25       ` Andrew Lunn
2025-10-11 17:42         ` Michael S. Tsirkin
2025-10-11 18:52           ` Andrew Lunn
2025-10-12  7:26             ` Michael S. Tsirkin
2025-10-12 14:39               ` Andrew Lunn
2025-10-12 19:17                 ` Michael S. Tsirkin
2025-10-09 11:24 ` [PATCH 2/3] virtio: words->dwords Michael S. Tsirkin
2025-10-09 11:24 ` [PATCH 3/3] vhost: use checked versions of VIRTIO_BIT Michael S. Tsirkin
2025-10-09 12:47   ` Andrew Lunn
2025-10-09 12:54     ` 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=26d7d26e-dd45-47bb-885b-45c6d44900bb@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=corbet@lwn.net \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=virtualization@lists.linux.dev \
    --cc=xuanzhuo@linux.alibaba.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

all inboxes | Powered by JetHome®