public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Amery Hung <ameryhung@gmail.com>
Cc: bpf@vger.kernel.org, daniel@iogearbox.net, andrii@kernel.org,
	 alexei.starovoitov@gmail.com, martin.lau@kernel.org,
	kernel-team@meta.com
Subject: Re: [PATCH bpf-next v4 1/3] selftests/bpf: Clean up call sites of stdio_restore()
Date: Tue, 04 Mar 2025 16:14:17 -0800	[thread overview]
Message-ID: <b7450cf543a69a0192f2e9af86236ebae8eae94e.camel@gmail.com> (raw)
In-Reply-To: <CAMB2axNvqyr-vnv5WcMMqykq6sCdnNYCOP4z1wsvO1GtrwGQyQ@mail.gmail.com>

On Tue, 2025-03-04 at 15:39 -0800, Amery Hung wrote:
> On Tue, Mar 4, 2025 at 1:48 PM Eduard Zingerman <eddyz87@gmail.com> wrote:
> > 
> > On Tue, 2025-03-04 at 08:36 -0800, Amery Hung wrote:
> > > There is no need to call a bunch of stdio_restore() in test_progs if the
> > > scope of stdio redirection is reduced to what it needs to be: only
> > > hijacking tests/subtests' stdio.
> > > 
> > > Also remove an unnecessary check of env.stdout_saved in the crash handler.
> > > 
> > > Signed-off-by: Amery Hung <ameryhung@gmail.com>
> > > ---
> > 
> > If anyone else would look at this commit, here is an alternative
> > description:
> > - functions reset_affinity() and restore_netns() are only called from
> >   run_one_test();
> > - beside other places stdio_restore() is called from reset_affinity(),
> >   restore_netns() and run_one_test() itself;
> > - this commit moves stdio_restore() call in run_one_test() so that
> >   it executes before reset_affinity() and restore_netns().
> > 
> > Acked-by: Eduard Zingerman <eddyz87@gmail.com>
> > 
> 
> I can improve the commit message in the next respin.

If there would be a respin, otherwise no need to worry.

[...]

> > > @@ -1943,6 +1938,9 @@ int main(int argc, char **argv)
> > > 
> > >       sigaction(SIGSEGV, &sigact, NULL);
> > > 
> > > +     env.stdout_saved = stdout;
> > > +     env.stderr_saved = stderr;
> > > +
> > 
> > Nit: why moving these?
> 
> If we assign env.stdout_saved at the very beginning, crash_handler()
> can just call stdio_restore() without checking if env.stdout_saved is
> set or not.

Understood, thank you.

[...]


      reply	other threads:[~2025-03-05  0:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-04 16:36 [PATCH bpf-next v4 1/3] selftests/bpf: Clean up call sites of stdio_restore() Amery Hung
2025-03-04 16:36 ` [PATCH bpf-next v4 2/3] selftests/bpf: Allow assigning traffic monitor print function Amery Hung
2025-03-04 16:36 ` [PATCH bpf-next v4 3/3] selftests/bpf: Fix dangling stdout seen by traffic monitor thread Amery Hung
2025-03-05  0:12   ` Eduard Zingerman
2025-03-05 16:52     ` Amery Hung
2025-03-05  1:36   ` Martin KaFai Lau
2025-03-05 16:52     ` Amery Hung
2025-03-04 21:48 ` [PATCH bpf-next v4 1/3] selftests/bpf: Clean up call sites of stdio_restore() Eduard Zingerman
2025-03-04 23:39   ` Amery Hung
2025-03-05  0:14     ` Eduard Zingerman [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=b7450cf543a69a0192f2e9af86236ebae8eae94e.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=ameryhung@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@meta.com \
    --cc=martin.lau@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox