OS-7614: viona should use proper barriers

Details

Issue Type:Bug
Priority:4 - Normal
Status:Resolved
Created at:2019-02-25T22:51:42.450Z
Updated at:2019-02-27T21:57:14.981Z

People

Created by:Former user
Reported by:Former user
Assigned to:Former user

Resolution

Fixed: A fix for this issue is checked into the tree and tested.
(Resolution Date: 2019-02-27T21:57:00.039Z)

Fix Versions

2019-02-28 Mind Grapes (Release Date: 2019-02-28)

Labels

bhyve

Description

While investigating the use of memory barriers in bhyve virtio, I looked into how viona handles those situations.  It too seems to be missing barriers between used-ring updates and the checks against avail_flags. It is possible that any triggering of this race is masked by the frequent event traffic on NICs and lack of strict ordering when compared to block device IO.

In addition to the used_idx > avail_flags race, I also looked at the used_flags > avail_idx race. Here viona is using atomics to update used_flags, which comes with its own implicit barrier, thanks to the LOCK prefix. It makes sense to convert the flag manipulations to normal memory access with an accompanying barrier when notification suppression is disabled prior to checking avail_idx.

Comments

Comment by Jira Bot
Created at 2019-02-27T21:57:14.981Z

illumos-joyent commit e393062f0aebf8081aed83fd67670d9094d2a2a3 (branch master, by Patrick Mooney)

OS-7613 bhyve virtio needs barriers
OS-7614 viona should use proper barriers
Reviewed by: John Levon <john.levon@joyent.com>
Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com>
Approved by: Dan McDonald <danmcd@joyent.com>