From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752136AbbCZFVQ (ORCPT ); Thu, 26 Mar 2015 01:21:16 -0400 Received: from mail.windriver.com ([147.11.1.11]:64172 "EHLO mail.windriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751238AbbCZFVN (ORCPT ); Thu, 26 Mar 2015 01:21:13 -0400 Message-ID: <551396EC.4010806@windriver.com> Date: Thu, 26 Mar 2015 13:19:40 +0800 From: Ying Xue User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: CC: Subject: Re: [PATCH] rculist: Fix another sparse warning References: <1427258618-32085-1-git-send-email-ying.xue@windriver.com> <20150325134929.GY5718@linux.vnet.ibm.com> In-Reply-To: <20150325134929.GY5718@linux.vnet.ibm.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [128.224.163.180] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/25/2015 09:49 PM, Paul E. McKenney wrote: > On Wed, Mar 25, 2015 at 12:43:38PM +0800, Ying Xue wrote: >> This fixes the following sparse warnings: >> >> make C=1 CF=-D__CHECK_ENDIAN__ net/tipc/name_table.o >> net/tipc/name_table.c:977:17: error: incompatible types in comparison expression (different address spaces) >> net/tipc/name_table.c:977:17: error: incompatible types in comparison expression (different address spaces) >> >> To silence these spare complaints, an RCU annotation should be added to >> "next" pointer of hlist_node structure through hlist_next_rcu() macro >> when iterating over a hlist with hlist_for_each_entry_from_rcu(). >> >> Signed-off-by: Ying Xue > > If hlist_for_each_entry_from_rcu() is to use rcu_dereference_bh(), then > it needs to be named hlist_for_each_entry_from_rcu_bh(). If we want > to retain the generic nature, rcu_dereference_raw() would work. > > (Otherwise, we would get splats if this was used under rcu_read_lock() > rather than rcu_read_lock_bh().) > Yes, you are absolutely right. Thanks to point out my mistake. I will fix it in next version. Regards, Ying > Thanx, Paul > >> --- >> include/linux/rculist.h | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/include/linux/rculist.h b/include/linux/rculist.h >> index a18b16f..18a3f15 100644 >> --- a/include/linux/rculist.h >> +++ b/include/linux/rculist.h >> @@ -549,8 +549,8 @@ static inline void hlist_add_behind_rcu(struct hlist_node *n, >> */ >> #define hlist_for_each_entry_from_rcu(pos, member) \ >> for (; pos; \ >> - pos = hlist_entry_safe(rcu_dereference((pos)->member.next),\ >> - typeof(*(pos)), member)) >> + pos = hlist_entry_safe(rcu_dereference_bh(hlist_next_rcu( \ >> + &(pos)->member)), typeof(*(pos)), member)) >> >> #endif /* __KERNEL__ */ >> #endif >> -- >> 1.7.9.5 >> > > >