bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yonghong Song <yhs@fb.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@fb.com>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	Kernel Team <Kernel-team@fb.com>
Subject: Re: [PATCH bpf-next 2/2] tools/bpf: add a selftest for bpf_send_signal_thread()
Date: Tue, 14 Jan 2020 01:22:33 +0000	[thread overview]
Message-ID: <0fdac3e7-6457-8145-a3c9-b9f3e7dcf0ea@fb.com> (raw)
In-Reply-To: <CAEf4Bzagfmx1H3DgQ9ZjxKwbGdRGHAy7=qHt5S0Pqf0vV7PB4w@mail.gmail.com>



On 1/13/20 5:19 PM, Andrii Nakryiko wrote:
> On Thu, Jan 9, 2020 at 5:16 PM Yonghong Song <yhs@fb.com> wrote:
>>
>> The test_progs send_signal() is amended to test
>> bpf_send_signal_thread() as well.
>>
>>    $ ./test_progs -n 40
>>    #40/1 send_signal_tracepoint:OK
>>    #40/2 send_signal_perf:OK
>>    #40/3 send_signal_nmi:OK
>>    #40/4 send_signal_tracepoint_thread:OK
>>    #40/5 send_signal_perf_thread:OK
>>    #40/6 send_signal_nmi_thread:OK
>>    #40 send_signal:OK
>>    Summary: 1/6 PASSED, 0 SKIPPED, 0 FAILED
>>
>> Signed-off-by: Yonghong Song <yhs@fb.com>
>> ---
>>   tools/include/uapi/linux/bpf.h                | 18 +++++++++--
> 
> maybe do tools/uapi header sync in a first patch, along the original change?

Will do.

> 
>>   .../selftests/bpf/prog_tests/send_signal.c    | 30 ++++++++++++-------
>>   .../bpf/progs/test_send_signal_kern.c         |  9 ++++--
>>   3 files changed, 42 insertions(+), 15 deletions(-)
>>
> 
> [...]
> 
>> diff --git a/tools/testing/selftests/bpf/progs/test_send_signal_kern.c b/tools/testing/selftests/bpf/progs/test_send_signal_kern.c
>> index 0e6be01157e6..4a722024c32b 100644
>> --- a/tools/testing/selftests/bpf/progs/test_send_signal_kern.c
>> +++ b/tools/testing/selftests/bpf/progs/test_send_signal_kern.c
>> @@ -23,6 +23,7 @@ int bpf_send_signal_test(void *ctx)
>>   {
>>          __u64 *info_val, *status_val;
>>          __u32 key = 0, pid, sig;
>> +       int use_signal_thread;
>>          int ret;
>>
>>          status_val = bpf_map_lookup_elem(&status_map, &key);
>> @@ -33,11 +34,15 @@ int bpf_send_signal_test(void *ctx)
>>          if (!info_val || *info_val == 0)
>>                  return 0;
>>
>> -       sig = *info_val >> 32;
>> +       use_signal_thread = *info_val >> 48;
>> +       sig = *info_val >> 32 & 0xFFFF;
>>          pid = *info_val & 0xffffFFFF;
> 
> Would you mind rewriting this test w/ BPF skeleton and global data? It
> would make it cleaner without all this masking stuff?

Previously I made the change to minimize the number of changed lines.
But since you are mentioning rewriting here, I will do it in v2.

> 
>>
>>          if ((bpf_get_current_pid_tgid() >> 32) == pid) {
>> -               ret = bpf_send_signal(sig);
>> +               if (use_signal_thread)
>> +                       ret = bpf_send_signal_thread(sig);
>> +               else
>> +                       ret = bpf_send_signal(sig);
>>                  if (ret == 0)
>>                          *status_val = 1;
>>          }
>> --
>> 2.17.1
>>

      reply	other threads:[~2020-01-14  1:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-10  1:15 [PATCH bpf-next 0/2] bpf: add bpf_send_signal_thread() helper Yonghong Song
2020-01-10  1:15 ` [PATCH bpf-next 1/2] " Yonghong Song
2020-01-14  0:58   ` Andrii Nakryiko
2020-01-14  1:15     ` Yonghong Song
2020-01-10  1:15 ` [PATCH bpf-next 2/2] tools/bpf: add a selftest for bpf_send_signal_thread() Yonghong Song
2020-01-14  1:19   ` Andrii Nakryiko
2020-01-14  1:22     ` 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=0fdac3e7-6457-8145-a3c9-b9f3e7dcf0ea@fb.com \
    --to=yhs@fb.com \
    --cc=Kernel-team@fb.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    /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;
as well as URLs for NNTP newsgroup(s).