lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 12 Mar 2014 09:41:35 -0700
From:	John Fastabend <john.fastabend@...il.com>
To:	Eric Dumazet <eric.dumazet@...il.com>
CC:	xiyou.wangcong@...il.com, jhs@...atatu.com, netdev@...r.kernel.org,
	davem@...emloft.net
Subject: Re: [RCU PATCH 06/14] net: sched: fw use RCU

On 03/10/2014 10:41 AM, Eric Dumazet wrote:
> On Mon, 2014-03-10 at 10:05 -0700, John Fastabend wrote:
>> RCU'ify fw classifier.
>>
>> Signed-off-by: John Fastabend <john.r.fastabend@...el.com>
>> ---
>>   net/sched/cls_fw.c |  110 ++++++++++++++++++++++++++++++++++++----------------
>>   1 file changed, 76 insertions(+), 34 deletions(-)
>>
>> diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c
>> index a366537..ff392f1 100644
>> --- a/net/sched/cls_fw.c
>> +++ b/net/sched/cls_fw.c
>> @@ -32,18 +32,21 @@
>>   #define HTSIZE (PAGE_SIZE/sizeof(struct fw_filter *))
>>
>>   struct fw_head {
>> -	struct fw_filter *ht[HTSIZE];
>> +	struct rcu_head	rcu;
>
> Try to put 'rcu' at the end of structures, we do not need it in fast
> path.
>
>> +	struct fw_filter __rcu *ht[HTSIZE];
>>   	u32 mask;
>>   };
>>
>>   struct fw_filter {
>> -	struct fw_filter	*next;
>> +	struct fw_filter __rcu	*next;
>> +	struct rcu_head		rcu;
>
> same remark
>

[...]

>>
>> @@ -150,29 +159,32 @@ static void fw_destroy(struct tcf_proto *tp)
>>   		return;
>>
>>   	for (h = 0; h < HTSIZE; h++) {
>> -		while ((f = head->ht[h]) != NULL) {
>> -			head->ht[h] = f->next;
>> -			fw_delete_filter(tp, f);
>> +		while ((f = rtnl_dereference(head->ht[h])) != NULL) {
>> +			rcu_assign_pointer(head->ht[h],
>> +					   rtnl_dereference(f->next));
>> +			call_rcu(&f->rcu, fw_delete_filter);
>>   		}
>>   	}
>> -	kfree(head);
>> +	rcu_assign_pointer(tp->root, NULL);
>
> RCU_INIT_POINTER
>
>> +	kfree_rcu(head, rcu);

Rearranging the rcu_head placement above results in this error:

net/sched/cls_fw.c: In function ‘fw_destroy’:
net/sched/cls_fw.c:169:279: error: call to ‘__compiletime_assert_169’ 
declared with attribute error: BUILD_BUG_ON failed: 
!__is_kfree_rcu_offset(__builtin_offsetof(typeof(*(head)),rcu))


However it seems best to have the rcu_head at the end of the struct
so I'll just convert the kfree_rcu() to call_rcu().

Thanks,
John

-- 
John Fastabend         Intel Corporation
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ