From patchwork Sat Jan 14 10:50:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 63191 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9EEB3383FB88 for ; Sat, 14 Jan 2023 10:51:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9EEB3383FB88 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673693480; bh=e/k74FfaA+GvEL+yM7Tvu/Rx9Lrrq0pG6kR0KZkaip0=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=t+Ex6GS3ZzZmI7XThxv6llr9Qh+PzH1oX+DuR0ZBR9BusaZ7lkTjqrRPsxId6l+v2 +ySnlWiqd1TDLeEEulywI6WhnfhzXIla7ibHtI6pfB5yDy1UFH7/DwJtyXjmcVlyoL 8AkoCyZa9zPfHDaZgCV8gZEtfu4SAeTke2LtwQ6E= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id 1BA973858D39 for ; Sat, 14 Jan 2023 10:50:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1BA973858D39 Received: by mail-wm1-x32a.google.com with SMTP id k22-20020a05600c1c9600b003d1ee3a6289so18919421wms.2 for ; Sat, 14 Jan 2023 02:50:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=e/k74FfaA+GvEL+yM7Tvu/Rx9Lrrq0pG6kR0KZkaip0=; b=wOlVV2e0iROqE3r04kNo4agF7tP5LcPbFT6Pt7JoSa3Opt9S+uqp7X1ou4Mxlthaug FHMF3xH+qGCKnyTws1po+L0k4kwE2dI/XBlz5fZV8GvJMcYqWDn9j5y6rz+Z87phffEm HdH4ajU+Z/6YpjdHLwzuvlKt6VME2GRje6wk9yQ4OXFNPJvtGHaNdNBjemuzpMbTslmy Z32HIEZI7SU12g1sCioH0mkHPdoIdF5OcPbcouyyV+HN+zdNKKa1DEoEyB5Qni4B4bQD wND77AlxvvtgcvEyHmjmYKe4Rrglf+i0ZTW/g2RhneMtSWlpDWBbWChSwQGssFaAz+2M TTuQ== X-Gm-Message-State: AFqh2kpk2Br4xRVyQ81Y+KdhVDOAj4o6j5Vl2kIFjIVRtoClAgCEJlsW RvVBUZX8z1Y/wt88Gj8khFvy1T8yBCg= X-Google-Smtp-Source: AMrXdXv7zcygoq7jsxZhDseNgcpg/tw9mXU7CoVveJUcbE3A8EHOup2+jWxBakKrBUSAAbDimS2hXg== X-Received: by 2002:a05:600c:3b22:b0:3c6:e63e:814b with SMTP id m34-20020a05600c3b2200b003c6e63e814bmr60106782wms.2.1673693447514; Sat, 14 Jan 2023 02:50:47 -0800 (PST) Received: from localhost.localdomain (host81-138-1-83.in-addr.btopenworld.com. [81.138.1.83]) by smtp.gmail.com with ESMTPSA id j15-20020a5d452f000000b0028f9132e9ddsm21064159wra.39.2023.01.14.02.50.46 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 14 Jan 2023 02:50:47 -0800 (PST) X-Google-Original-From: Iain Sandoe To: gcc-patches@gcc.gnu.org Subject: [PATCH] modula-2: Fix stack size request in initPreemptive [PR108405] Date: Sat, 14 Jan 2023 10:50:46 +0000 Message-Id: <20230114105046.35020-1-iain@sandoe.co.uk> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) MIME-Version: 1.0 X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Iain Sandoe via Gcc-patches From: Iain Sandoe Reply-To: iain@sandoe.co.uk Cc: Iain Sandoe , gaiusmod2@gmail.com Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Given that, currently, this value is not configurable per target the short-term solution is to avoid a bad request. Tested on x86_64-darwin21, OK for trunk? thanks Iain --- 8< --- As noted in the PR, the problem is that we make a request for additional stack that violates the constraints on some systems. This patch chooses a value that is divisible by common OS page sizes. TODO: the user value should be checked and then an exception thrown if it is not suitable. Signed-off-by: Iain Sandoe PR modula2/108405 gcc/m2/ChangeLog: * gm2-libs-iso/Preemptive.mod (initPreemptive): Use a value for extra space that is divisible by common OS pagesizes. --- gcc/m2/gm2-libs-iso/Preemptive.mod | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/m2/gm2-libs-iso/Preemptive.mod b/gcc/m2/gm2-libs-iso/Preemptive.mod index 59940b6bae8..e747028d5be 100644 --- a/gcc/m2/gm2-libs-iso/Preemptive.mod +++ b/gcc/m2/gm2-libs-iso/Preemptive.mod @@ -33,6 +33,9 @@ FROM libc IMPORT printf ; CONST debugging = FALSE ; + (* The space we request becomes part of a stack request, which generally + has constraints on size and alignment. *) + extraWorkSpace = 10 * 1024 * 1024 ; (* timer - the timer process which runs at maximum scheduling priority with @@ -107,7 +110,7 @@ BEGIN IF NOT init THEN init := TRUE ; - Create (timer, 10000000, MAX (Urgency), NIL, timerId) ; + Create (timer, extraWorkSpace, MAX (Urgency), NIL, timerId) ; Activate (timerId) END END initPreemptive ;