mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yonghong Song <yhs@meta.com>
To: Feng Zhou <zhoufeng.zf@bytedance.com>, Hao Luo <haoluo@google.com>
Cc: martin.lau@linux.dev, ast@kernel.org, daniel@iogearbox.net,
	andrii@kernel.org, song@kernel.org, yhs@fb.com,
	john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com,
	jolsa@kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, mykolal@fb.com,
	shuah@kernel.org, bpf@vger.kernel.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	linux-kselftest@vger.kernel.org, yangzhenze@bytedance.com,
	wangdongdong.6@bytedance.com
Subject: Re: [PATCH bpf-next v6 2/2] selftests/bpf: Add testcase for bpf_task_under_cgroup
Date: Fri, 5 May 2023 11:46:34 -0700	[thread overview]
Message-ID: <d5de53ef-3303-29c0-a4ae-4bede3ef315a@meta.com> (raw)
In-Reply-To: <194f1ac1-6bb0-e3fc-5394-ad5cb95721d0@bytedance.com>



On 5/5/23 12:24 AM, Feng Zhou wrote:
> 在 2023/5/5 15:13, Hao Luo 写道:
>> On Thu, May 4, 2023 at 11:08 PM Feng zhou <zhoufeng.zf@bytedance.com> 
>> wrote:
>>>
>>> From: Feng Zhou <zhoufeng.zf@bytedance.com>
>>>
>>> test_progs:
>>> Tests new kfunc bpf_task_under_cgroup().
>>>
>>> The bpf program saves the new task's pid within a given cgroup to
>>> the remote_pid, which is convenient for the user-mode program to
>>> verify the test correctness.
>>>
>>> The user-mode program creates its own mount namespace, and mounts the
>>> cgroupsv2 hierarchy in there, call the fork syscall, then check if
>>> remote_pid and local_pid are unequal.
>>>
>>> Signed-off-by: Feng Zhou <zhoufeng.zf@bytedance.com>
>>> Acked-by: Yonghong Song <yhs@fb.com>
>>> ---
>>
>> Hi Feng,
>>
>> I have a comment about the methodology of the test, but the patch
>> looks ok to me. Why do we have to test via a tracing program? I think
>> what we need is just a task and a cgroup. Since we have the kfunc
>> bpf_task_from_pid() and bpf_cgroup_from_id(), we can write a syscall
>> program which takes a pid and a cgroup id as input and get the task
>> and cgroup objects directly in the program.
>>
>> I like testing via a syscall program because it doesn't depend on the
>> newtask tracepoint and it should be simpler. But I'm ok with the
>> current version of the patch, just have some thoughts.
>>
>> Hao
> 
> Yes, your method is also very good. The reason why I did this is because 
> of Song's suggestion before, hope that the parameter of the hook point 
> will have a task, so I chose this to test.

The motivation of this patch is:
   Trace sched related functions, such as enqueue_task_fair, it is 
necessary to
   specify a task instead of the current task which within a given cgroup.

So I think it is okay to have a test related to sched.

      reply	other threads:[~2023-05-05 18:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-05  6:08 [PATCH bpf-next v6 0/2] Introduce a new kfunc of bpf_task_under_cgroup Feng zhou
2023-05-05  6:08 ` [PATCH bpf-next v6 1/2] bpf: Add bpf_task_under_cgroup() kfunc Feng zhou
2023-05-05  6:58   ` Hao Luo
2023-05-05  7:18     ` Feng Zhou
2023-05-05 18:43       ` Yonghong Song
2023-05-05 18:48         ` Alexei Starovoitov
2023-05-05  6:08 ` [PATCH bpf-next v6 2/2] selftests/bpf: Add testcase for bpf_task_under_cgroup Feng zhou
2023-05-05  7:13   ` Hao Luo
2023-05-05  7:24     ` Feng Zhou
2023-05-05 18:46       ` Yonghong Song [this message]

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=d5de53ef-3303-29c0-a4ae-4bede3ef315a@meta.com \
    --to=yhs@meta.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mykolal@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@google.com \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=wangdongdong.6@bytedance.com \
    --cc=yangzhenze@bytedance.com \
    --cc=yhs@fb.com \
    --cc=zhoufeng.zf@bytedance.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®