netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuniyu@amazon.co.jp>
To: <yhs@fb.com>
Cc: <andrii@kernel.org>, <ast@kernel.org>, <benh@amazon.com>,
	<bpf@vger.kernel.org>, <daniel@iogearbox.net>,
	<davem@davemloft.net>, <john.fastabend@gmail.com>, <kafai@fb.com>,
	<kpsingh@kernel.org>, <kuba@kernel.org>, <kuni1840@gmail.com>,
	<kuniyu@amazon.co.jp>, <netdev@vger.kernel.org>,
	<songliubraving@fb.com>
Subject: Re: [PATCH v3 bpf-next 2/2] selftest/bpf: Implement sample UNIX domain socket iterator program.
Date: Fri, 6 Aug 2021 09:24:28 +0900	[thread overview]
Message-ID: <20210806002428.12154-1-kuniyu@amazon.co.jp> (raw)
In-Reply-To: <25688602-6151-d8f0-17ef-1661110ed26e@fb.com>

From:   Yonghong Song <yhs@fb.com>
Date:   Thu, 5 Aug 2021 09:59:40 -0700
> On 8/4/21 12:08 AM, Kuniyuki Iwashima wrote:
> > If there are no abstract sockets, this prog can output the same result
> > compared to /proc/net/unix.
> > 
> >    # cat /sys/fs/bpf/unix | head -n 2
> >    Num       RefCount Protocol Flags    Type St Inode Path
> >    ffff9ab7122db000: 00000002 00000000 00010000 0001 01 10623 private/defer
> > 
> >    # cat /proc/net/unix | head -n 2
> >    Num       RefCount Protocol Flags    Type St Inode Path
> >    ffff9ab7122db000: 00000002 00000000 00010000 0001 01 10623 private/defer
> > 
> > According to the analysis by Yonghong Song (See the link), the BPF verifier
> > cannot load the code in the comment to print the name of the abstract UNIX
> > domain socket due to LLVM optimisation.  It can be uncommented once the
> > LLVM code gen is improved.
> 
> I have pushed the llvm fix to llvm14 trunk 
> (https://reviews.llvm.org/D107483), and filed a request to backport to 
> llvm13 (https://bugs.llvm.org/show_bug.cgi?id=51363), could you in the 
> next revision uncomment the "for" loop code and tested it with latest 
> llvm trunk compiler? Please also add an entry in selftests/bpf/README.rst
> to mention the llvm commit https://reviews.llvm.org/D107483 is needed
> for bpf_iter unix_socket selftest, otherwise, they will see an error
> like ...

Thank you for nice fixing so quickly!

I confirmed that the uncommented code can be loaded properly with the
latest LLVM master tree. :)

---8<---
$ sudo ./test_progs -t iter
...
#7/14 unix:OK
...
$ clang --version
clang version 14.0.0 (https://github.com/llvm/llvm-project.git 8a557d8311593627efd08d03178889971d5ae02b)
...
$ llvm-objdump -S bpf_iter_unix.o
...
; 				 for (i = 1 ; i < len; i++)
     110:	07 09 00 00 01 00 00 00	r9 += 1
     111:	ad 89 09 00 00 00 00 00	if r9 < r8 goto +9 <LBB0_18>
---8<---

In the next revision, I'll uncomment the code and add a note in README.rst
about your fix.

  reply	other threads:[~2021-08-06  0:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-04  7:08 [PATCH v3 bpf-next 0/2] BPF iterator for UNIX domain socket Kuniyuki Iwashima
2021-08-04  7:08 ` [PATCH v3 bpf-next 1/2] bpf: af_unix: Implement " Kuniyuki Iwashima
2021-08-05 16:53   ` Yonghong Song
2021-08-06  0:21     ` Kuniyuki Iwashima
2021-08-06  0:41   ` Martin KaFai Lau
2021-08-06  1:05     ` Kuniyuki Iwashima
2021-08-04  7:08 ` [PATCH v3 bpf-next 2/2] selftest/bpf: Implement sample UNIX domain socket iterator program Kuniyuki Iwashima
2021-08-05 16:59   ` Yonghong Song
2021-08-06  0:24     ` Kuniyuki Iwashima [this message]
2021-08-06 23:33   ` Andrii Nakryiko
2021-08-07  0:09     ` Kuniyuki Iwashima

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=20210806002428.12154-1-kuniyu@amazon.co.jp \
    --to=kuniyu@amazon.co.jp \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=benh@amazon.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuni1840@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@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;
as well as URLs for NNTP newsgroup(s).