linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <thomas@t-8ch.de>
To: Zhangjin Wu <falcon@tinylab.org>
Cc: arnd@arndb.de, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, w@1wt.eu
Subject: Re: [PATCH v1 05/17] selftests/nolibc: stat_timestamps: remove procfs dependency
Date: Thu, 29 Jun 2023 18:56:44 +0200	[thread overview]
Message-ID: <df1f8ba1-3040-465c-804e-495f046dba7a@t-8ch.de> (raw)
In-Reply-To: <20230628135922.97298-1-falcon@tinylab.org>

Hi Zhangjin,

On 2023-06-28 21:59:22+0800, Zhangjin Wu wrote:
> I'm preparing a revision for this series, in the past days, when I was
> working on testing our new 'minimal' kernel config support for all of
> the architectures, the time cost (and wait) is really appreciable and the
> repeated develop and test is really a big pain, I can also image when you
> was working on stack-protector and Willy was working on lots of old
> features ;-)

To be honest I almost never built a kernel.
Most of the time I tested my stuff with qemu-user.
This made the dev-cycle really fast, especially with a binfmt setup that
launches foreign binaries automatically with qemu-user.

> As you explained before, I knew the idea of using '/proc/self' here is
> important to not using a fixed-time file, besides our proposed method (make
> sure it at least not fail, just skip for !procfs):
> 
>     - CASE_TEST(stat_timestamps);   EXPECT_SYSZR(1, test_stat_timestamps()); break;
>     + CASE_TEST(stat_timestamps);   EXPECT_SYSZR(proc, test_stat_timestamps()); break;
> 
> To further avoid skip it for !procfs (I don't mean relaly disable it for the
> default tinyconfig support, which need more discuss, at least provide the
> possibility to pass without procfs), do you like this change? it doesn't depend
> on 'proc' now.
> 
>     -	if (stat("/proc/self/", &st))
>     +	if (stat("/proc/self/", &st) && stat("/init", &st) && stat("/", &st))
> 
> The "/init" is compiled for 'run' target every time, so, the time stamp should
> be dynamic enough, for libc-test, the /proc/self should be always there (if
> still not enough, we can reuse the init file list here), the "/" here is only
> for the worst-case scene ;-)

Both aproaches seem fine. Just skipping on !proc seems good enough.

As for enabling proc in the test configs I just tested a plain
tinyconfig vs one with CONFIG_PROC_FS enabled:

tinyconfig:                  375.06user 53.21system 2:05.80elapsed
tinyconfig + CONFIG_PROC_FS: 397.77user 56.84system 2:09.24elapsed

The overhead seems acceptable.


Note as for disabling memfd:

It seems currently MEMFD_CREATE is hardwired to only be enabled when
either TMPFS or HUGETLBFS is enabled.

But the memfd code and syscalls seem to work perfectly fine with those
options disabled. I'll send a patch to fix up the Kconfigs to enable
that usecase.

> Thanks,
> Zhangjin
> 
> > Since it is not really necessary to use /proc/self here, instead of
> > adding a condition check, we use the always existing '/' path instead of
> > /proc/self, this eventually let it work without procfs.
> > 
> > Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
> > ---
> >  tools/testing/selftests/nolibc/nolibc-test.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
> > index ebec948ec808..2ef44176f7a9 100644
> > --- a/tools/testing/selftests/nolibc/nolibc-test.c
> > +++ b/tools/testing/selftests/nolibc/nolibc-test.c
> > @@ -520,7 +520,7 @@ static int test_stat_timestamps(void)
> >  	if (sizeof(st.st_atim.tv_sec) != sizeof(st.st_atime))
> >  		return 1;
> >  
> > -	if (stat("/proc/self/", &st))
> > +	if (stat("/", &st))
> >  		return 1;
> >  
> >  	if (st.st_atim.tv_sec != st.st_atime || st.st_atim.tv_nsec > 1000000000)
> > -- 
> > 2.25.1

  reply	other threads:[~2023-06-29 16:56 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-21 12:52 [PATCH v1 00/17] selftests/nolibc: allow run with minimal kernel config Zhangjin Wu
2023-06-21 12:53 ` [PATCH v1 01/17] selftests/nolibc: stat_fault: silence NULL argument warning with glibc Zhangjin Wu
2023-06-21 12:54 ` [PATCH v1 02/17] selftests/nolibc: gettid: restore for glibc and musl Zhangjin Wu
2023-06-21 12:56 ` [PATCH v1 03/17] selftests/nolibc: add _LARGEFILE64_SOURCE for musl Zhangjin Wu
2023-06-21 12:57 ` [PATCH v1 04/17] selftests/nolibc: fix up kernel parameters support Zhangjin Wu
2023-06-21 12:58 ` [PATCH v1 05/17] selftests/nolibc: stat_timestamps: remove procfs dependency Zhangjin Wu
2023-06-28 13:59   ` Zhangjin Wu
2023-06-29 16:56     ` Thomas Weißschuh [this message]
2023-06-29 21:23       ` Zhangjin Wu
2023-06-29 21:44         ` Thomas Weißschuh
2023-06-21 13:00 ` [PATCH v1 06/17] tools/nolibc: add rmdir() support Zhangjin Wu
2023-06-21 13:01 ` [PATCH v1 07/17] selftests/nolibc: add a new rmdir() test case Zhangjin Wu
2023-06-21 13:03 ` [PATCH v1 08/17] selftests/nolibc: fix up failures when there is no procfs Zhangjin Wu
2023-06-21 13:04 ` [PATCH v1 09/17] selftests/nolibc: rename proc variable to has_proc Zhangjin Wu
2023-06-21 13:05 ` [PATCH v1 10/17] selftests/nolibc: rename euid0 variable to is_root Zhangjin Wu
2023-06-21 13:07 ` [PATCH v1 11/17] selftests/nolibc: prepare tmpfs and hugetlbfs Zhangjin Wu
2023-06-21 13:09 ` [PATCH v1 12/17] selftests/nolibc: rename chmod_net to chmod_good Zhangjin Wu
2023-06-21 13:11 ` [PATCH v1 13/17] selftests/nolibc: link_cross: support tmpfs Zhangjin Wu
2023-06-21 13:13 ` [PATCH v1 14/17] selftests/nolibc: rename chroot_exe to chroot_file Zhangjin Wu
2023-06-21 13:17 ` [PATCH v1 15/17] selftests/nolibc: vfprintf: silence memfd_create() warning Zhangjin Wu
2023-06-21 13:18 ` [PATCH v1 16/17] selftests/nolibc: vfprintf: skip if neither tmpfs nor hugetlbfs Zhangjin Wu
2023-06-21 13:21 ` [PATCH v1 17/17] selftests/nolibc: vfprintf: support tmpfs and hugetlbfs Zhangjin Wu
2023-06-21 19:21 ` [PATCH v1 00/17] selftests/nolibc: allow run with minimal kernel config Thomas Weißschuh
2023-06-22 18:45   ` Zhangjin Wu
2023-06-24  6:52     ` Thomas Weißschuh
2023-06-24  7:29       ` Thomas Weißschuh
2023-06-24  8:39       ` Zhangjin Wu
2023-06-24  8:54     ` Zhangjin Wu

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=df1f8ba1-3040-465c-804e-495f046dba7a@t-8ch.de \
    --to=thomas@t-8ch.de \
    --cc=arnd@arndb.de \
    --cc=falcon@tinylab.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=w@1wt.eu \
    /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).