From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH 1/4] VT-d/qinval: make local variable used for communication with IOMMU "volatile" Date: Mon, 16 Jun 2014 13:55:31 +0100 Message-ID: <539EE943.90702@citrix.com> References: <539F025A020000780001AA25@mail.emea.novell.com> <539F038C020000780001AA34@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8783813468394073168==" Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WwWRk-000056-Gp for xen-devel@lists.xenproject.org; Mon, 16 Jun 2014 12:55:36 +0000 In-Reply-To: <539F038C020000780001AA34@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Yang Z Zhang , xen-devel , xiantao.zhang@intel.com List-Id: xen-devel@lists.xenproject.org --===============8783813468394073168== Content-Type: multipart/alternative; boundary="------------090800020403050901030009" --------------090800020403050901030009 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit On 16/06/14 13:47, Jan Beulich wrote: > Without that there is - afaict - nothing preventing the compiler from > putting the variable into a register for the duration of the wait loop. > > Signed-off-by: Jan Beulich I seem to remember Tim saying that behaviour like this is covered by -fno-strict-aliasing Either way, it is certainly correct for it to be marked as volatile. Reviewed-by: Andrew Cooper > > --- a/xen/drivers/passthrough/vtd/qinval.c > +++ b/xen/drivers/passthrough/vtd/qinval.c > @@ -196,7 +196,7 @@ static int queue_invalidate_wait(struct > u8 iflag, u8 sw, u8 fn) > { > s_time_t start_time; > - u32 poll_slot = QINVAL_STAT_INIT; > + volatile u32 poll_slot = QINVAL_STAT_INIT; > int index = -1; > int ret = -1; > unsigned long flags; > > > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel --------------090800020403050901030009 Content-Type: text/html; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit
On 16/06/14 13:47, Jan Beulich wrote:
Without that there is - afaict - nothing preventing the compiler from
putting the variable into a register for the duration of the wait loop.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

I seem to remember Tim saying that behaviour like this is covered by -fno-strict-aliasing

Either way, it is certainly correct for it to be marked as volatile.

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>


--- a/xen/drivers/passthrough/vtd/qinval.c
+++ b/xen/drivers/passthrough/vtd/qinval.c
@@ -196,7 +196,7 @@ static int queue_invalidate_wait(struct 
     u8 iflag, u8 sw, u8 fn)
 {
     s_time_t start_time;
-    u32 poll_slot = QINVAL_STAT_INIT;
+    volatile u32 poll_slot = QINVAL_STAT_INIT;
     int index = -1;
     int ret = -1;
     unsigned long flags;





_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

--------------090800020403050901030009-- --===============8783813468394073168== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============8783813468394073168==--