All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Olivier Delande <olivier.delande@gmail.com>
Cc: virtio-comment@lists.oasis-open.org
Subject: Re: [virtio-comment] Writes to the Device Status field race with DEVICE_NEEDS_RESET
Date: Wed, 25 Nov 2020 06:48:20 -0500	[thread overview]
Message-ID: <20201125045623-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CANkLV9gRR_EkrCK4czwWiH6toffKN12vSd6M9FFrtvQwU3bmHQ@mail.gmail.com>

On Wed, Nov 18, 2020 at 01:45:13PM +0100, Olivier Delande wrote:
> As far as I understand the Virtio 1.1 spec, a driver must not clear
> any bit in the Device Status field when it writes a non-zero value.
> How can it comply with this requirement, when the device may be
> concurrently setting DEVICE_NEEDS_RESET? There does not seem to be any
> facility to atomically set some bits and leave the others unchanged.

Good point! I guess one way to actually make it race-free is for
the device to have the DEVICE_NEEDS_RESET bit read-only, that is
unaffected by driver writes.

We can't make it a MUST since there are lots of devices out there
but we can make it a SHOULD. Luckily it is unusual for drivers to
change status after initialization and unusual for devices to
fail during initialization.

One other thing we should probably suggest is that devices that set NEED_RESET before
FEATURES_OK is set, also fail setting of FEATURES_OK.
This way at least drivers will detect the failure.
That seems like a good idea even irrespective of the races,
since lots of drivers don't handle NEED_RESET.

-- 
MST


This publicly archived list offers a means to provide input to the
OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and
to minimize spam in the list archive, subscription is required
before posting.

Subscribe: virtio-comment-subscribe@lists.oasis-open.org
Unsubscribe: virtio-comment-unsubscribe@lists.oasis-open.org
List help: virtio-comment-help@lists.oasis-open.org
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/


      reply	other threads:[~2020-11-25 11:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18 12:45 [virtio-comment] Writes to the Device Status field race with DEVICE_NEEDS_RESET Olivier Delande
2020-11-25 11:48 ` Michael S. Tsirkin [this message]

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=20201125045623-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=olivier.delande@gmail.com \
    --cc=virtio-comment@lists.oasis-open.org \
    /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 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.