Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754398AbaDRRR5 (ORCPT ); Fri, 18 Apr 2014 13:17:57 -0400 Received: from cantor2.suse.de ([195.135.220.15]:53659 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754319AbaDRRRv (ORCPT ); Fri, 18 Apr 2014 13:17:51 -0400 Message-ID: <1397829723.4798.5.camel@linux-fkkt.site> Subject: Re: question on read_barrier_depends From: Oliver Neukum To: Alan Stern Cc: linux-kernel@vger.kernel.org In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Date: Fri, 18 Apr 2014 16:02:03 +0200 Mime-Version: 1.0 X-Mailer: Evolution 3.10.2 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2014-04-17 at 11:50 -0400, Alan Stern wrote: > On Thu, 17 Apr 2014, Oliver Neukum wrote: > > > On Wed, 2014-04-16 at 11:26 -0400, Alan Stern wrote: > > > > > In addition, the following code in kfifo_get() does this: > > > > > > *(typeof(__tmp->type))__val = \ > > > (__is_kfifo_ptr(__tmp) ? \ > > > ((typeof(__tmp->type))__kfifo->data) : \ > > > (__tmp->buf) \ > > > )[__kfifo->out & __tmp->kfifo.mask]; \ > > > smp_wmb(); \ > > > __kfifo->out++; \ > > > > > > It looks like the smp_wmb() should really be smp_mb(), because it > > > separates the _read_ for val from the _write_ of kfifo->out. > > > > But where is kfifo->out read at all? > > It is read in kfifo_put(), inside the call to kfifo_is_full() -> > kfifo_len(). I had overlooked that. In that case kfifo_put() also needs smp_read_barrier_depends() Regards Oliver -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/