Message ID | 4b9385fbcd4b2a93c27f8fb5b5d7e4bca120b190.1727624528.git.fweimer@redhat.com |
---|---|
State | Under Review |
Delegated to: | Adhemerval Zanella Netto |
Headers |
Return-Path: <libc-alpha-bounces~patchwork=sourceware.org@sourceware.org> 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 893D5385E44D for <patchwork@sourceware.org>; Sun, 29 Sep 2024 15:57:05 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 68B45385841E for <libc-alpha@sourceware.org>; Sun, 29 Sep 2024 15:56:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 68B45385841E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 68B45385841E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727625405; cv=none; b=VsOSlLXRIUmGGJxXG4NTS6ClOTSVr9t+bX3A0W8eTPQjSoXv+SoF9NF399F6hnBFT3RUGhJFQ3YTc/p2YSnGGPDVCVM4C+Gzc9nZeUeCkDmXWu+GQdGZJ9EuVYTPLxFtLbaI6TTL9IUn6YVLP+t+8X+IqMAyxtCI7CMo6WVQ+1M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727625405; c=relaxed/simple; bh=WVwrky3djyKLONBPRgxfYfldRBRkAPWfOkSvGFxvnI4=; h=DKIM-Signature:From:To:Subject:Message-ID:Date:MIME-Version; b=QC2Ni17kajSz2+DpjN71xX8a+QAs+wXbiAJqAmy6qITXo4cddTq6M3o3Kwi8Cxy+k/UQSgJmx0Vvo/7KnynmHaxQyegmRNbkOx3KuuB7g2sBkbJa9fsSPyAf16yNWdaXlFm1cbVZdvzknIXIgV5I177uqKA88DPgmtVLVJWkhuM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727625404; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0D/j+10jXvfrBE4zTFyha45RMobI8A6tWeCKxdwFWbA=; b=ap69W2bH08NM8z8EZluSb4/zgluU1EvW6QOhmc2gG+C4JpHCy5xr/nybeXwVD2hjWpX8cI IbcaWbw1EW5vYAFCW+NLgR+u0IjVKf1ZhpQ1+Xbka6BPUw1b4FxFyWp8Vfz9qXuu4CIQ3Q fZweqc83WOBVZrUw4j9iDxBcEpEavfc= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-225-zZu7GKaEO_q760tIauVgHg-1; Sun, 29 Sep 2024 11:56:40 -0400 X-MC-Unique: zZu7GKaEO_q760tIauVgHg-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (unknown [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EC288195FE22; Sun, 29 Sep 2024 15:56:39 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.45.224.151]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B1A8A1955DC7; Sun, 29 Sep 2024 15:56:38 +0000 (UTC) From: Florian Weimer <fweimer@redhat.com> To: libc-alpha@sourceware.org Cc: Richard Henderson <richard.henderson@linaro.org> Subject: [PATCH v3 04/29] alpha: Add <bits/pagesize.h> In-Reply-To: <cover.1727624528.git.fweimer@redhat.com> Message-ID: <4b9385fbcd4b2a93c27f8fb5b5d7e4bca120b190.1727624528.git.fweimer@redhat.com> References: <cover.1727624528.git.fweimer@redhat.com> X-From-Line: 4b9385fbcd4b2a93c27f8fb5b5d7e4bca120b190 Mon Sep 17 00:00:00 2001 Date: Sun, 29 Sep 2024 17:56:35 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org |
Series |
Teach glibc about possible page sizes and handle gaps in ld.so
|
|
Checks
Context | Check | Description |
---|---|---|
redhat-pt-bot/TryBot-apply_patch | success | Patch applied to master at the time it was sent |
Commit Message
Florian Weimer
Sept. 29, 2024, 3:56 p.m. UTC
According to arch/alpha/Kconfig, alpha always has a page size of 8 KiB (only HAVE_PAGE_SIZE_8KB is used). However, the toolchain defaults support a maximum page size of 64 KiB, so adjust the maximum accordingly. (Note: We could XFAIL the gaps test added later and fix the page size at 8 KiB, despite what binutils does today.) --- sysdeps/alpha/bits/pagesize.h | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 sysdeps/alpha/bits/pagesize.h
Comments
On 9/29/24 08:56, Florian Weimer wrote: > According to arch/alpha/Kconfig, alpha always has a page size of > 8 KiB (only HAVE_PAGE_SIZE_8KB is used). However, the toolchain > defaults support a maximum page size of 64 KiB, so adjust the > maximum accordingly. The ev6 hardware can support 8k, 64k, 512k, and 4G page sizes, but we never got around to supporting them within the kernel. When doing the toolchain support, I always assumed we'd get around to at least 64k. :-/ > (Note: We could XFAIL the gaps test added later and fix the page size at > 8 KiB, despite what binutils does today.) > > --- > sysdeps/alpha/bits/pagesize.h | 2 ++ > 1 file changed, 2 insertions(+) > create mode 100644 sysdeps/alpha/bits/pagesize.h > > diff --git a/sysdeps/alpha/bits/pagesize.h b/sysdeps/alpha/bits/pagesize.h > new file mode 100644 > index 0000000000..81824b5ab6 > --- /dev/null > +++ b/sysdeps/alpha/bits/pagesize.h > @@ -0,0 +1,2 @@ > +#define __GLIBC_PAGE_SHIFT_MIN 13 > +#define __GLIBC_PAGE_SHIFT_MAX 16 FWIW, qemu 9.1 supports aligning the guest page size to the host page size, for a subset of guests: alpha, aarch64, ppc*. This fixes a number of edge cases with mmap that cannot be properly emulated otherwise (especially wrt SIGBUS within the final guest page beyond the end of a file). I intend to extend this to other guests as and when I have time, but have not done the legwork you have done to identify which guests need attention. We allow Alpha page size to float down to 4k to aid emulation on x86 hosts, despite this not being a page size supported by real hardware. This works in practice because Alpha applications do not hard-code a particular page size. As long as the program respects AT_PAGESIZE or getpagesize(2), all is well. I only bring this up to let you know that the test case may fail when run on qemu-alpha. r~
* Richard Henderson: >> (Note: We could XFAIL the gaps test added later and fix the page size at >> 8 KiB, despite what binutils does today.) >> --- >> sysdeps/alpha/bits/pagesize.h | 2 ++ >> 1 file changed, 2 insertions(+) >> create mode 100644 sysdeps/alpha/bits/pagesize.h >> diff --git a/sysdeps/alpha/bits/pagesize.h >> b/sysdeps/alpha/bits/pagesize.h >> new file mode 100644 >> index 0000000000..81824b5ab6 >> --- /dev/null >> +++ b/sysdeps/alpha/bits/pagesize.h >> @@ -0,0 +1,2 @@ >> +#define __GLIBC_PAGE_SHIFT_MIN 13 >> +#define __GLIBC_PAGE_SHIFT_MAX 16 > > FWIW, qemu 9.1 supports aligning the guest page size to the host page > size, for a subset of guests: alpha, aarch64, ppc*. This fixes a > number of edge cases with mmap that cannot be properly emulated > otherwise (especially wrt SIGBUS within the final guest page beyond > the end of a file). I intend to extend this to other guests as and > when I have time, but have not done the legwork you have done to > identify which guests need attention. Hmm, I'm surprised that a smaller page size isn't compatible. I suppose there could be an issue regarding the tail if the file is subsequently resized. The end of the tail might not be writable with 4K pages, but is writable with 8K pages. Do you suggest to lower PAGE_SIZE_MIN to 4096 for QEMU compatibility? It's not clear to me based on your message. I should probably update the documentation in the manual that PAGE_SIZE_MIN is not a suitable boundary for over-reading because it's incompatible with (future introduction of) pointer tagging. The alpha memchr in glibc uses cache line boundaries for overreading, so it's fine with 4K pages at least. Thanks, Florian
diff --git a/sysdeps/alpha/bits/pagesize.h b/sysdeps/alpha/bits/pagesize.h new file mode 100644 index 0000000000..81824b5ab6 --- /dev/null +++ b/sysdeps/alpha/bits/pagesize.h @@ -0,0 +1,2 @@ +#define __GLIBC_PAGE_SHIFT_MIN 13 +#define __GLIBC_PAGE_SHIFT_MAX 16