From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52072) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c7ShD-0000BX-Mb for qemu-devel@nongnu.org; Thu, 17 Nov 2016 14:50:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c7Sh9-0004Rf-Cg for qemu-devel@nongnu.org; Thu, 17 Nov 2016 14:50:07 -0500 Received: from mx3-phx2.redhat.com ([209.132.183.24]:54185) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c7Sh9-0004RT-4x for qemu-devel@nongnu.org; Thu, 17 Nov 2016 14:50:03 -0500 Date: Thu, 17 Nov 2016 14:49:58 -0500 (EST) From: Paolo Bonzini Message-ID: <28571590.170644.1479412198176.JavaMail.zimbra@redhat.com> In-Reply-To: <20161117195511-mutt-send-email-mst@kernel.org> References: <20161116180551.9611-1-pbonzini@redhat.com> <20161116180551.9611-3-pbonzini@redhat.com> <20161117195511-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/3] virtio: access ISR atomically List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org, alex williamson , borntraeger@de.ibm.com, felipe@nutanix.com ----- Original Message ----- > From: "Michael S. Tsirkin" > To: "Paolo Bonzini" > Cc: qemu-devel@nongnu.org, "alex williamson" , borntraeger@de.ibm.com, felipe@nutanix.com > Sent: Thursday, November 17, 2016 6:55:50 PM > Subject: Re: [PATCH 2/3] virtio: access ISR atomically > > On Wed, Nov 16, 2016 at 07:05:50PM +0100, Paolo Bonzini wrote: > > @@ -1318,10 +1318,18 @@ void virtio_del_queue(VirtIODevice *vdev, int n) > > vdev->vq[n].vring.num_default = 0; > > } > > > > +static void virtio_set_isr(VirtIODevice *vdev, int value) > > +{ > > + uint8_t old = atomic_read(&vdev->isr); > > + if ((old & value) != value) { > > + atomic_or(&vdev->isr, value); > > + } > > +} > > + > > Paolo, can you pls comment on why is it done like this, > as opposed to a single atomic_or? To avoid cacheline bouncing in the common case where MSI is active but the host doesn't read ISR. Paolo