All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Benjamin Berg <benjamin@sipsolutions.net>,
	 Richard Weinberger <richard.weinberger@gmail.com>,
	 linux-um <linux-um@lists.infradead.org>
Subject: Re: [PATCH v3 04/11] um: Don't use vfprintf() for os_info()
Date: Fri, 5 Jan 2024 10:16:54 +0100 (CET)	[thread overview]
Message-ID: <206862006.201007.1704446214699.JavaMail.zimbra@nod.at> (raw)
In-Reply-To: <29561023e97b362aa81aba2a33931897bea59bdd.camel@sipsolutions.net>

----- Ursprüngliche Mail -----
> Von: "Johannes Berg" <johannes@sipsolutions.net>
> An: "Benjamin Berg" <benjamin@sipsolutions.net>, "Richard Weinberger" <richard.weinberger@gmail.com>
> CC: "linux-um" <linux-um@lists.infradead.org>
> Gesendet: Freitag, 5. Januar 2024 09:56:11
> Betreff: Re: [PATCH v3 04/11] um: Don't use vfprintf() for os_info()

> On Fri, 2024-01-05 at 09:12 +0100, Benjamin Berg wrote:
>> > Another option is giving the helper threads more memory, we don't have
>> > that many.
>> > Did you explore this option already?
>> 
>> I had not really considered that.
>> 
>> One thing though is that userspace_tramp calls os_info while working
>> with the stub stack. So that also means setting STUB_DATA_PAGES to 2.
>> But, I suspect we may want to do that anyway eventually to fit the ever
>> increasing mcontext size for all the AVX512 registers and such.
> 
> That'll probably happen eventually regardless ...
> 
>> As I said, I think that is fine to do.
> 
> But I'm not sure it's a good solution to give more stack space to the
> threads and think/hope that glibc won't make more assumptions about the
> amount of space it can use ... who knows if it uses alloca() inside
> somewhere, for example? After all, userspace stacks are multiple
> megabytes by default?

For thread stacks things are a bit different.

glibc is in general more heap than stack greedy, it uses malloc() almost everywhere.
For pthreads the minimal stack size on x86 is 16k (_SC_THREAD_STACK_MIN).
Donating four pages to each helper thread seems okay to me.
And if I understand _SC_THREAD_STACK_MIN correctly, this is the minimal stack
size the glibc library can deal with.

Thanks,
//richard


  reply	other threads:[~2024-01-05  9:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-10 11:03 [PATCH v3 00/11] General cleanups and fixes from SECCOMP patchset benjamin
2023-11-10 11:03 ` [PATCH v3 01/11] um: Drop support for hosts without SYSEMU_SINGLESTEP support benjamin
2023-11-10 11:03 ` [PATCH v3 02/11] um: Drop NULL check from start_userspace benjamin
2023-11-10 11:03 ` [PATCH v3 03/11] um: Make errors to stop ptraced child fatal during startup benjamin
2023-11-10 11:03 ` [PATCH v3 04/11] um: Don't use vfprintf() for os_info() benjamin
2024-01-04 22:37   ` Richard Weinberger
2024-01-05  8:12     ` Benjamin Berg
2024-01-05  8:56       ` Johannes Berg
2024-01-05  9:16         ` Richard Weinberger [this message]
2023-11-10 11:03 ` [PATCH v3 05/11] um: Do not use printk in SIGWINCH helper thread benjamin
2023-11-10 11:03 ` [PATCH v3 06/11] um: Reap winch thread if it fails benjamin
2023-11-10 11:03 ` [PATCH v3 07/11] um: Do not use printk in userspace trampoline benjamin
2023-11-10 11:03 ` [PATCH v3 08/11] um: Always inline stub functions benjamin
2023-11-10 11:03 ` [PATCH v3 09/11] um: Rely on PTRACE_SETREGSET to set FS/GS base registers benjamin
2024-01-04 23:05   ` Richard Weinberger
2024-01-04 23:34     ` Richard Weinberger
2024-01-05  9:54     ` Benjamin Berg
2024-01-05 13:29       ` Richard Weinberger
2023-11-10 11:03 ` [PATCH v3 10/11] um: Remove unused register save/restore functions benjamin
2023-11-10 11:03 ` [PATCH v3 11/11] um: Mark 32bit syscall helpers as clobbering memory benjamin

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=206862006.201007.1704446214699.JavaMail.zimbra@nod.at \
    --to=richard@nod.at \
    --cc=benjamin@sipsolutions.net \
    --cc=johannes@sipsolutions.net \
    --cc=linux-um@lists.infradead.org \
    --cc=richard.weinberger@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.