From: Stefano Brivio <sbrivio@redhat.com>
To: Florian Westphal <fw@strlen.de>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
kernel test robot <lkp@intel.com>,
stable@vger.kernel.org, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nf] nft_set_pipapo: Disable preemption before getting per-CPU pointer
Date: Mon, 8 Jun 2020 11:05:00 +0200 [thread overview]
Message-ID: <20200608110500.3cb1edc6@redhat.com> (raw)
In-Reply-To: <20200608085652.GP28263@breakpoint.cc>
On Mon, 8 Jun 2020 10:56:52 +0200
Florian Westphal <fw@strlen.de> wrote:
> Stefano Brivio <sbrivio@redhat.com> wrote:
> > The lkp kernel test robot reports, with CONFIG_DEBUG_PREEMPT enabled:
> [..]
>
> > diff --git a/net/netfilter/nft_set_pipapo.c b/net/netfilter/nft_set_pipapo.c
> > index 8b5acc6910fd..8c04388296b0 100644
> > --- a/net/netfilter/nft_set_pipapo.c
> > +++ b/net/netfilter/nft_set_pipapo.c
> > @@ -1242,7 +1242,9 @@ static int nft_pipapo_insert(const struct net *net, const struct nft_set *set,
> > end += NFT_PIPAPO_GROUPS_PADDED_SIZE(f);
> > }
> >
> > - if (!*this_cpu_ptr(m->scratch) || bsize_max > m->bsize_max) {
> > + if (!*get_cpu_ptr(m->scratch) || bsize_max > m->bsize_max) {
> > + put_cpu_ptr(m->scratch);
> > +
> > err = pipapo_realloc_scratch(m, bsize_max);
> > if (err)
> > return err;
> > @@ -1250,6 +1252,8 @@ static int nft_pipapo_insert(const struct net *net, const struct nft_set *set,
> > this_cpu_write(nft_pipapo_scratch_index, false);
>
> Won't that mean that this_cpu_write() can occur on a different CPU than
> the get_cpu_ptr() ptr check was done on?
Yes, but that's okay, because get_cpu_ptr(m->scratch) can be done on
any CPU: it's just used as a flag to detect that scratch maps were
never allocated for this matching data.
The write to nft_pipapo_scratch_index is not needed: in this path we
always call pipapo_realloc_scratch() so we're supplying two fresh
scratch maps, we can start from either one for the next lookup
operation. But dropping it doesn't fix anything, so I'd do that in a
separate patch for nf-next.
--
Stefano
next prev parent reply other threads:[~2020-06-08 9:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-08 8:50 [PATCH nf] nft_set_pipapo: Disable preemption before getting per-CPU pointer Stefano Brivio
2020-06-08 8:56 ` Florian Westphal
2020-06-08 9:05 ` Stefano Brivio [this message]
2020-06-09 21:48 ` Pablo Neira Ayuso
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=20200608110500.3cb1edc6@redhat.com \
--to=sbrivio@redhat.com \
--cc=fw@strlen.de \
--cc=lkp@intel.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=stable@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.