From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757605AbXELFgV (ORCPT ); Sat, 12 May 2007 01:36:21 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754752AbXELFgG (ORCPT ); Sat, 12 May 2007 01:36:06 -0400 Received: from terminus.zytor.com ([192.83.249.54]:34737 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756504AbXELFgF (ORCPT ); Sat, 12 May 2007 01:36:05 -0400 Message-ID: <464551D5.2050709@zytor.com> Date: Fri, 11 May 2007 22:34:13 -0700 From: "H. Peter Anvin" User-Agent: Thunderbird 2.0.0.0 (X11/20070419) MIME-Version: 1.0 To: Satyam Sharma CC: Jonathan Corbet , akpm@linux-foundation.org, linux-kernel@vger.kernel.org, Johannes Stezenbach , Jesper Juhl , Randy Dunlap , Heikki Orsila , jimmy bahuleyan , Stefan Richter Subject: Re: [PATCH] "volatile considered harmful", take 3 References: <12700.1178905000@lwn.net> In-Reply-To: X-Enigmail-Version: 0.95.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Satyam Sharma wrote: > >> + - Pointers to data structures in coherent memory which might be >> modified >> + by I/O devices can, sometimes, legitimately be volatile. A ring >> buffer >> + used by a network adapter, where that adapter changes pointers to >> + indicate which descriptors have been processed, is an example of >> this >> + type of situation. > > is a legitimate use case for volatile is still not clear to me (I > agree with Alan's > comment in a previous thread that this seems to be a case where a memory > barrier would be applicable^Wbetter, actually). I could be wrong here, so > would be nice if Peter explains why volatile is legitimate here. > > Otherwise, it's fine with me. > I don't see why Alan's way is necessarily better; it should work but is more heavy-handed as it's disabling *all* optimization such as loop invariants across the barrier. -hpa