From: "Timo Teräs" <timo.teras@iki.fi>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] xfrm: cache bundle lookup results in flow cache
Date: Fri, 19 Mar 2010 11:12:21 +0200 [thread overview]
Message-ID: <4BA33FF5.8010104@iki.fi> (raw)
In-Reply-To: <20100319084717.GA23567@gondor.apana.org.au>
Herbert Xu wrote:
> On Fri, Mar 19, 2010 at 10:37:58AM +0200, Timo Teräs wrote:
>> But I changed that. the flow cache now does *not* call local_bh_enable
>> if it returns something. This is deferred until corresponding _put
>> call. So bh's are disable while we are touching the lookup results.
>
> I'm sorry but making a function like flow_cache_lookup return with
> BH disabled is just wrong!
>
>> It'd probably make sense to remove that. And require _lookup to
>> be called with bh disabled so it's more obvious that bh's are
>> disabled when touching the cache entry.
>
> That would be better but it's still hacky. Proper reference
> counting like we had before would be my preference.
Well, the cache entry is still referenced only very shortly,
I don't see why keeping bh disabled why doing it is considered
a hack. Refcounting the cache entries is trickier. Though,
it could be used to optimize the update process: we could safely
update it instead of doing now lookup later.
>> Not a race. We need to keep bh's disabled while touching fce
>> for various reasons.
>
> What are those reasons (apart from this race)?
This. And that the cache is synchronized by flow_cache_flush
executing stuff on other cpu's, ensuring that it's not running
any protected cache accessing code. See below.
>
>> Noone. When policy and dst is on cache there's no reference.
>> The cache generation id's ensure that the object exists when
>> they are in cache. It might make sense to add references to
>> both objects and do a BUG_ON if the flow cache flusher would
>> need to delete an object. I guess this would be the proper
>> way, since that's how the dst stuff works too.
>
> The cache genid is not enough:
>
> CPU1 CPU2
> check genid == OK
> update genid
> kill policy
> kfree on policy
> use policy == BOOM
The sequence goes currently.
CPU1 CPU2
disable_bh
check genid == OK
update genid
call cache_flush
blocks
use policy == OK
and take refcount
enable_bh
cache_flush smpcall executes and ublocks cpu2
returns from cache_flush
kill policy
kfree on policy
- Timo
next prev parent reply other threads:[~2010-03-19 9:12 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-15 12:20 [PATCH] xfrm: cache bundle lookup results in flow cache Timo Teras
2010-03-17 13:07 ` Herbert Xu
2010-03-17 14:16 ` Timo Teräs
2010-03-17 14:58 ` Herbert Xu
2010-03-17 15:56 ` Timo Teräs
2010-03-17 16:32 ` Timo Teräs
2010-03-18 19:30 ` Timo Teräs
2010-03-19 0:31 ` Herbert Xu
2010-03-19 5:48 ` Timo Teräs
2010-03-19 6:03 ` Herbert Xu
2010-03-19 6:21 ` Timo Teräs
2010-03-19 7:17 ` Herbert Xu
2010-03-19 7:27 ` Timo Teräs
2010-03-19 0:32 ` Herbert Xu
2010-03-19 7:20 ` Herbert Xu
2010-03-19 7:48 ` Timo Teräs
2010-03-19 8:29 ` Herbert Xu
2010-03-19 8:37 ` Timo Teräs
2010-03-19 8:47 ` Herbert Xu
2010-03-19 9:12 ` Timo Teräs [this message]
2010-03-19 9:32 ` Herbert Xu
2010-03-19 9:53 ` Timo Teräs
2010-03-20 15:17 ` Herbert Xu
2010-03-20 16:26 ` Timo Teräs
2010-03-21 0:46 ` Herbert Xu
2010-03-21 7:34 ` Timo Teräs
2010-03-21 8:31 ` Timo Teräs
2010-03-22 3:52 ` Herbert Xu
2010-03-22 18:03 ` Timo Teräs
2010-03-23 7:28 ` Timo Teräs
2010-03-23 7:42 ` Herbert Xu
2010-03-23 9:19 ` Timo Teräs
2010-03-23 9:41 ` Herbert Xu
2010-03-22 1:26 ` David Miller
2010-03-22 1:28 ` David Miller
2010-03-22 1:32 ` Herbert Xu
2010-03-22 1:36 ` David Miller
2010-03-22 1:40 ` Herbert Xu
2010-03-22 3:12 ` David Miller
2010-03-22 3:52 ` Herbert Xu
2010-03-22 18:31 ` Timo Teräs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BA33FF5.8010104@iki.fi \
--to=timo.teras@iki.fi \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.