mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yonghong Song <yhs@fb.com>
To: Song Liu <songliubraving@fb.com>, <bpf@vger.kernel.org>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <ast@kernel.org>, <daniel@iogearbox.net>, <kernel-team@fb.com>,
	<peterz@infradead.org>, kernel test robot <lkp@intel.com>,
	KP Singh <kpsingh@kernel.org>
Subject: Re: [PATCH v5 bpf-next 1/6] bpf: enable task local storage for tracing programs
Date: Tue, 23 Feb 2021 17:00:36 -0800	[thread overview]
Message-ID: <a6779ede-f077-4c15-2c31-a7610cca1ecb@fb.com> (raw)
In-Reply-To: <20210223222845.2866124-2-songliubraving@fb.com>



On 2/23/21 2:28 PM, Song Liu wrote:
> To access per-task data, BPF programs usually creates a hash table with
> pid as the key. This is not ideal because:
>   1. The user need to estimate the proper size of the hash table, which may
>      be inaccurate;
>   2. Big hash tables are slow;
>   3. To clean up the data properly during task terminations, the user need
>      to write extra logic.
> 
> Task local storage overcomes these issues and offers a better option for
> these per-task data. Task local storage is only available to BPF_LSM. Now
> enable it for tracing programs.
> 
> Unlike LSM programs, tracing programs can be called in IRQ contexts.
> Helpers that access task local storage are updated to use
> raw_spin_lock_irqsave() instead of raw_spin_lock_bh().
> 
> Tracing programs can attach to functions on the task free path, e.g.
> exit_creds(). To avoid allocating task local storage after
> bpf_task_storage_free(). bpf_task_storage_get() is updated to not allocate
> new storage when the task is not refcounted (task->usage == 0).
> 
> Reported-by: kernel test robot <lkp@intel.com>

For a patch like this, typically we do not put the above
Reported-by here as it is not really reported by the
kernel test robot. If no revision is required, maybe
maintainer can remove it before applying.

> Acked-by: KP Singh <kpsingh@kernel.org>
> Signed-off-by: Song Liu <songliubraving@fb.com>
> ---
>   include/linux/bpf.h            |  7 ++++++
>   include/linux/bpf_lsm.h        | 22 -----------------
>   include/linux/bpf_types.h      |  2 +-
>   include/linux/sched.h          |  5 ++++
>   kernel/bpf/Makefile            |  3 +--
>   kernel/bpf/bpf_local_storage.c | 28 +++++++++++++---------
>   kernel/bpf/bpf_lsm.c           |  4 ----
>   kernel/bpf/bpf_task_storage.c  | 43 +++++++++-------------------------
>   kernel/fork.c                  |  5 ++++
>   kernel/trace/bpf_trace.c       |  4 ++++
>   10 files changed, 51 insertions(+), 72 deletions(-)
> 
[...]

  reply	other threads:[~2021-02-24  1:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-23 22:28 [PATCH v5 bpf-next 0/6] " Song Liu
2021-02-23 22:28 ` [PATCH v5 bpf-next 1/6] " Song Liu
2021-02-24  1:00   ` Yonghong Song [this message]
2021-02-25 19:28   ` Martin KaFai Lau
2021-02-23 22:28 ` [PATCH v5 bpf-next 2/6] bpf: prevent deadlock from recursive bpf_task_storage_[get|delete] Song Liu
2021-02-23 22:28 ` [PATCH v5 bpf-next 3/6] selftests/bpf: add non-BPF_LSM test for task local storage Song Liu
2021-02-23 22:28 ` [PATCH v5 bpf-next 4/6] selftests/bpf: test deadlock from recursive bpf_task_storage_[get|delete] Song Liu
2021-02-23 22:28 ` [PATCH v5 bpf-next 5/6] bpf: runqslower: prefer using local vmlimux to generate vmlinux.h Song Liu
2021-02-23 22:28 ` [PATCH v5 bpf-next 6/6] bpf: runqslower: use task local storage Song Liu

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=a6779ede-f077-4c15-2c31-a7610cca1ecb@fb.com \
    --to=yhs@fb.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=songliubraving@fb.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®