Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933392AbbBJOEA (ORCPT ); Tue, 10 Feb 2015 09:04:00 -0500 Received: from mail-qc0-f172.google.com ([209.85.216.172]:42880 "EHLO mail-qc0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754938AbbBJOD6 (ORCPT ); Tue, 10 Feb 2015 09:03:58 -0500 Message-ID: <54DA0FC6.3090204@hurleysoftware.com> Date: Tue, 10 Feb 2015 09:03:50 -0500 From: Peter Hurley User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Pranith Kumar CC: Mathieu Desnoyers , Huang Ying , linux-kernel@vger.kernel.org, Paul McKenney , David Howells , stable@vger.kernel.org Subject: Re: [PATCH] llist: Fix missing lockless_dereference() References: <1423274934-10625-1-git-send-email-mathieu.desnoyers@efficios.com> In-Reply-To: <1423274934-10625-1-git-send-email-mathieu.desnoyers@efficios.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1830 Lines: 59 On 02/06/2015 09:08 PM, Mathieu Desnoyers wrote: > A lockless_dereference() appears to be missing in llist_del_first(). > It should only matter for Alpha in practice. > > Signed-off-by: Mathieu Desnoyers > CC: Huang Ying > CC: Paul McKenney > CC: David Howells > CC: Pranith Kumar > CC: stable@vger.kernel.org # v3.1+ > --- > lib/llist.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/lib/llist.c b/lib/llist.c > index f76196d..f34e176 100644 > --- a/lib/llist.c > +++ b/lib/llist.c > @@ -26,6 +26,7 @@ > #include > #include > #include > +#include Pranith, I didn't realize you put lockless_dereference() in rcupdate.h If the point of lockless_reference() is to provide a utility function for situations _not_ involving RCU, then it doesn't make sense to provide it in an RCU header file. Regards, Peter Hurley PS - That's not an objection to this patch, though. > /** > @@ -67,7 +68,12 @@ struct llist_node *llist_del_first(struct llist_head *head) > { > struct llist_node *entry, *old_entry, *next; > > - entry = head->first; > + /* > + * Load entry before entry->next. Matches the implicit > + * memory barrier before the cmpxchg in llist_add_batch(), > + * which ensures entry->next is stored before entry. > + */ > + entry = lockless_dereference(head->first); > for (;;) { > if (entry == NULL) > return NULL; > -- 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/