From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-x112c.google.com (mail-yw1-x112c.google.com [IPv6:2607:f8b0:4864:20::112c]) by sourceware.org (Postfix) with ESMTPS id 920D03858C5F for ; Wed, 17 May 2023 23:09:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 920D03858C5F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-yw1-x112c.google.com with SMTP id 00721157ae682-561da492bcbso13242827b3.3 for ; Wed, 17 May 2023 16:09:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684364984; x=1686956984; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=+Io+rqb0bxnfONER0Qj+eLFx61+65+J1N/luGcAIojQ=; b=AGCu3eKJiK15up1g4hmBBVKxtYLZW4zZcoUH0wYcfBjzVjUXP73OFP/Ndh7kuVn4dU tg1+SIxuC8IxXCLBjgwlT0KaDrflQ+v30eYvtns/bVO4qHwV4tYMO2x7iHcc+cH9Bmc2 ewtyDVa69suu1hypAm8n52EDpzI3v3c++1S5CV+OAa5hAP/ueVw6FScYwwdKQoI6gIcE g0Oj7HRYZjitmo8Fk+0EhABNYjgcIaSuJw7Vdy0/rgt29vyrLPkeogplLHso/2lMY/cz boYQAsS18SINxclNm3/z/A6oA07MTGVd1qRW75PY3XkGH4BEwU/Rlh6HNI9dARySHIns AwCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684364984; x=1686956984; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+Io+rqb0bxnfONER0Qj+eLFx61+65+J1N/luGcAIojQ=; b=ez4YOLLwNtKk5L0auWLGPydSy5DiTga3Xu0NjahG8EjlU697eGtqVMsWsM3ayi23S0 hLTEiU2geZ2CMX1kY9CvvdWOu66lCZwG5K3TEP3sf5RwqzKgy+H2gXElMfU2Y50hhOra e85ZqzD44zRgu1fsIWugzu14lWhf0COoEGOBCuCC+SXCKl6a9+dwreN13sA9mlLYEnQm plC+QTjEdaFM0ORC6pcwUOSdlZ8SbCyzcJF8Xu4Y7wpotbLihoF825oAYCMCTD22EuQI ok/uWS12znN53LWqq/EEEN/19Ud5kU0+9OgTPfxWKEyAQpv1r/v9MeYwk8TpasuNh3KD UARA== X-Gm-Message-State: AC+VfDwW6v7uA4rLkaeEHnB/HeNPsuseHIuIetpT9IBDwVM4Sb87/7nX VNHi9JuAwALI9Letie5OokbE3L6TaOViIL88UfdKL4pHa4M= X-Google-Smtp-Source: ACHHUZ49c8MlaoZZhNz3S+vnlxH3dcA0i7D2sVVNvEYXpsuxMpaYgdHFvFQI/pc/LnX+7y+R4FTj2G6juXLSahNqzc0= X-Received: by 2002:a0d:ca90:0:b0:561:c1ae:1dfb with SMTP id m138-20020a0dca90000000b00561c1ae1dfbmr2736271ywd.34.1684364983805; Wed, 17 May 2023 16:09:43 -0700 (PDT) MIME-Version: 1.0 References: <20230424105208.301614-1-mmatti@linux.ibm.com> <874jozevbl.fsf@ascii.art.br> <7620a9b1-fe92-0764-6011-81d3a19e5590@linux.vnet.ibm.com> <871qjxe26c.fsf@ascii.art.br> <87wn1mdfwl.fsf@ascii.art.br> <47ceecd1-1abd-383f-b4d6-0fd47b1969fc@linux.vnet.ibm.com> <87sfc5o1f3.fsf@ascii.art.br> <7a0c60f8-092c-b6d7-9e93-0a157511b8dd@linux.vnet.ibm.com> In-Reply-To: From: "H.J. Lu" Date: Wed, 17 May 2023 16:09:07 -0700 Message-ID: Subject: Re: [PATCH] powerpc: Use sysconf (_SC_SIGSTKSZ) to set SIGSTKSZ and MINSIGSTKSZ. To: Rajalakshmi Srinivasaraghavan Cc: Manjunath S Matti , Tulio Magno Quites Machado Filho , Manjunath Matti via Libc-alpha Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3015.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, May 17, 2023 at 3:18=E2=80=AFPM Rajalakshmi Srinivasaraghavan wrote: > > > On 5/11/23 11:50 AM, Manjunath S Matti wrote: > > > On 09/05/23 11:03 pm, Tulio Magno Quites Machado Filho wrote: > > Manjunath S Matti writes: > > Am I missing some thing, please help me understand the file > > No. You're right. > The issue I hypothesized can't happen. > > Thanks for confirming. > > The patch looks good. > > I will definitely add a testcases just to check what value are we getting > > from the kernel. > > I'm sorry, I'm not sure this test is needed anymore. > While it doesn't hurt to have it, it would add little value. > > Thanks again! > > I have one last thing that I fail to understand, in x86 > > file: sysdeps/unix/sysv/linux/bits/sigstksz.h > > 26 /* Default stack size for a signal handler: sysconf (SC_SIGSTKSZ). *= / > 27 # undef SIGSTKSZ > 28 # define SIGSTKSZ sysconf (_SC_SIGSTKSZ) > 29 > 30 /* Minimum stack size for a signal handler: SIGSTKSZ. */ > 31 # undef MINSIGSTKSZ > 32 # define MINSIGSTKSZ SIGSTKSZ > > line number 32, both MINSIGSTKSZ and SIGSTKSZ are intentionally set to th= e same value. > > Do you know why, I just wanted to know the reason behind this. > > > This was added by commit 6c57d320484988e87e446e2e60ce42816bf51d53. > > @H.J. Lu Do you have any comments on this question? > There are @item _SC_MINSIGSTKSZ @standards{GNU, unistd.h} Inquire about the minimum number of bytes of free stack space required in order to guarantee successful, non-nested handling of a single signal whose handler is an empty function. @item _SC_SIGSTKSZ @standards{GNU, unistd.h} Inquire about the suggested minimum number of bytes of stack space required for a signal stack. This is not guaranteed to be enough for any specific purpose other than the invocation of a single, non-nested, empty handler, but nonetheless should be enough for basic scenarios involving simple signal handlers and very low levels of signal nesting (say, 2 or 3 levels at the very most). This value is provided for developer convenience and to ease migration from the legacy @code{SIGSTKSZ} constant. Programs requiring stronger guarantees should avoid using it if at all possible. @vtable @code @item SIGSTKSZ This is the canonical size for a signal stack. It is judged to be sufficient for normal uses. @item MINSIGSTKSZ This is the amount of signal stack space the operating system needs just to implement signal delivery. The size of a signal stack @strong{must} be greater than this. For most cases, just using @code{SIGSTKSZ} for @code{ss_size} is sufficient. But if you know how much stack space your program's signal handlers will need, you may want to use a different size. In this case, you should allocate @code{MINSIGSTKSZ} additional bytes for the signal stack and increase @code{ss_size} accordingly. Since sysconf (_SC_SIGSTKSZ) is the suggested minimum signal stack size, it is used for both SIGSTKSZ and MINSIGSTKSZ. --=20 H.J.