From nobody Mon May 19 15:01:55 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4b1LW7582Zz5vyNw; Mon, 19 May 2025 15:01:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4b1LW74BhRz41Cm; Mon, 19 May 2025 15:01:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1747666915; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bABTzyeH/R+Soj82su6xW3Denzm8a9VLpoZV993VHKs=; b=HIQ93xlWp7ZfLA7IwUyjGjzjyaM1HDEjC6NCZ0ECmYFdiFeiHc48+vzjeQtTm9b8ltAlBG u1HCOmV9iTgPklWXmC9BkXK8cAH1Lq0p8KJPo3vA+fyk+egcXcNHB4WlmYbpLet63lKw37 jqlAnFzp0Fc3pIqgs6S3m7RqUF58+3ovvqJ3+fO7X5K2bO7WJ+dJZvK5A9bFPbKeUGN0Vb oYQ4r4V5gUwf6leudfNuq6FAJNiVXGIsvELKou3JEMcP/E66s6uMRZRnAFj009lE6zRn5H ip0F0xrM8dHbuzk/gWch87MB362ZvrYQ2qHL2r2W4IkMsxb1q6lOug0EylfVtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1747666915; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bABTzyeH/R+Soj82su6xW3Denzm8a9VLpoZV993VHKs=; b=DhKIF4icMZPGXTEgiJ5IPnHx+xOHD+7I1LlbO/CywDC1PQBzagAA94A4PxhqiLFw065zAF TfaEJkSFEEkiccAO0R1/RGye+bYGKBQaCta7D2+X74Bj+NENUM6SkDe/LkAcrBMWIHimLK diG2l5QjxJhe5eCX5SygTmZ15PgOetR4+sA737doodoWEYG3cb+ZehsGDNYHJbmadDCBal pJ71/9SfMJRVBB2AWy0YmbzLVHRvqOwW5Rz9KUATYzcQKzhl/oU/c6mFstrSIgkjyJJ/CD jwcm3bkYrC9KejKyAdG7um6SdiRF2yO5QkFEq405lyKu+Q9HaPY/R+DeNqUkYA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1747666915; a=rsa-sha256; cv=none; b=uOX5tz1jJ5H4JNJN0LvMZw9DNacoDKXlKlaYSkZqNwR3sJRmfCJQrzSN0BBkgMShRWsP6t +EO9hMOIdQee8yw/gb94J6pT8aN0V8WDPXVq4ipjCB5MIjzfGBiTvuGaaksCIr9B5r+FLR WNgeaDg29cLoMvCDYTZ27mnFiv1F8wLgduh9SwEoGou7T7fj5NB1jaZZ1w8WrPgWKv6SH9 VZLZCqmvhk6MJpTEzc1zp2dHfvAsNRzCTw7vRVHoplPvCYjxCFmKc++XJAYlpW4Z7MYPfJ 0UnhZXcNeu74ET2j0xX67QXtfe/F5KCV4axB5NRlttxMfn+BE0oruuqUrHUwEA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4b1LW73CJKz16x5; Mon, 19 May 2025 15:01:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 54JF1tWs050613; Mon, 19 May 2025 15:01:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 54JF1tHG050610; Mon, 19 May 2025 15:01:55 GMT (envelope-from git) Date: Mon, 19 May 2025 15:01:55 GMT Message-Id: <202505191501.54JF1tHG050610@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 19419d36cf2a - main - libc: Give __thr_jtable protected visibility List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 19419d36cf2a132a325c0a66f49c3a66043072ba Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=19419d36cf2a132a325c0a66f49c3a66043072ba commit 19419d36cf2a132a325c0a66f49c3a66043072ba Author: Mark Johnston AuthorDate: 2025-05-19 14:29:12 +0000 Commit: Mark Johnston CommitDate: 2025-05-19 14:29:12 +0000 libc: Give __thr_jtable protected visibility This function pointer table is overwritten by libthr when it's loaded. libc's pthread stubs are implemented by looking up an entry in this table and invoking the function pointer contained in the entry. pthread calls are fairly expensive even when libthr is not loaded: each call involves indirection through the PLT, then through the GOT to look up __thr_jtable, then the function pointer itself. We can however eliminate one level of indirection by disallowing preemption of the __thr_jtable symbol, and since the existence table is an internal implementation detail, disabling preemption is unlikely to break anything. This gives a modest improvement in some microbenchmarks which call libc's pthread stubs. Reviewed by: kib MFC after: 1 month Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D50354 --- lib/libc/gen/_pthread_stubs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libc/gen/_pthread_stubs.c b/lib/libc/gen/_pthread_stubs.c index 2a0cebadd5fd..d867ee4db51e 100644 --- a/lib/libc/gen/_pthread_stubs.c +++ b/lib/libc/gen/_pthread_stubs.c @@ -63,6 +63,7 @@ static int stub_getname_np(pthread_t, char *, size_t); #define PJT_DUAL_ENTRY(entry) \ (pthread_func_t)entry, (pthread_func_t)entry +__attribute__((visibility("protected"))) pthread_func_entry_t __thr_jtable[PJT_MAX] = { [PJT_ATFORK] = {PJT_DUAL_ENTRY(stub_zero)}, [PJT_ATTR_DESTROY] = {PJT_DUAL_ENTRY(stub_zero)},