From nobody Tue Sep 10 18:13:03 2024 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 4X3Bdn4Gxbz5WMG9 for ; Tue, 10 Sep 2024 18:13:17 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4X3Bdm59MWz4KPX for ; Tue, 10 Sep 2024 18:13:16 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=freebsd.org (policy=none); spf=pass (mx1.freebsd.org: domain of jrtc27@jrtc27.com designates 209.85.221.43 as permitted sender) smtp.mailfrom=jrtc27@jrtc27.com Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-374c7d14191so51379f8f.0 for ; Tue, 10 Sep 2024 11:13:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725991995; x=1726596795; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Bsl5YK5ZFNSxn5oG5KWfq1A0L7QQcOY1x3cgI/dT7ys=; b=o+SiEJqVR9oPN9eHWrP4/6JjXThE+jC/v8VMWLbqQMcC6V/KQyhIfsbGR9e4TnkqRU LTXrF2ofvQ8ZAG/ZthE28rtMeevJQObBqaos+auJCarOmoxvgv1NISTNwzu4e6sObcud m/R5WaEa3KQt188y3mjHFVDH9JgTWCmneoD7k9ZFWY+fWyPzbfvaVXQsmXAVpHqbMQpd VqAbHUfK36FARE19gH84TJ5C3EPS8UbOOa222PAklhS410qxICVPRFOLAuYd/pFwqf4l B5YUpUurz+WDck9Sh4cUjxx3E028etPX3WqkBe/iMhQ4P3hzDHmOb7B/3bVlxaMSeddc yv7g== X-Forwarded-Encrypted: i=1; AJvYcCWIzgw1m949PDn3JiDTkUSoiCqjdGdNnuuqh1Odu1AwhTFwedvczZOdSORbFk/9L+Ye82TvWrcCb2NOV7gfBxOqekk1@freebsd.org X-Gm-Message-State: AOJu0Yzyzdh3y6nkUU2IbeG36V7w6A+MjWkXiPn8Qd4blLYsI6JGVKaK utZzqPDOWBXw1O1UkPjKUjS1yh+iZG+KMIIQUvmULJcGjgTce7CmzCN5j3zLDF8= X-Google-Smtp-Source: AGHT+IG6g1ogHmKYFgWUsSR5wzV4UvpGx1K4gULQlXsY2ya8tliuipfW8Mo9hBC7Q0iOSHcjpgtfUQ== X-Received: by 2002:a05:6000:1ac7:b0:374:c6b6:c656 with SMTP id ffacd0b85a97d-378a8a3de4cmr3187041f8f.21.1725991994673; Tue, 10 Sep 2024 11:13:14 -0700 (PDT) Received: from smtpclient.apple ([131.111.5.201]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-378956653f9sm9537186f8f.31.2024.09.10.11.13.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Sep 2024 11:13:14 -0700 (PDT) Content-Type: text/plain; charset=us-ascii 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 (Mac OS X Mail 16.0 \(3776.700.51\)) Subject: Re: git: f05795e3f65f - main - arm64: write PID in CONTEXTIDR_EL1 on ctx switch From: Jessica Clarke In-Reply-To: Date: Tue, 10 Sep 2024 19:13:03 +0100 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <4D1E29E6-5104-4EEC-BD60-1D880C8A2BE5@freebsd.org> References: <202409091605.489G5X6W041843@gitrepo.freebsd.org> To: Andrew Turner X-Mailer: Apple Mail (2.3776.700.51) X-Spamd-Bar: -- X-Spamd-Result: default: False [-2.90 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.998]; FORGED_SENDER(0.30)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; MIME_GOOD(-0.10)[text/plain]; DMARC_POLICY_SOFTFAIL(0.10)[freebsd.org : SPF not aligned (relaxed), No valid DKIM,none]; TO_DN_EQ_ADDR_SOME(0.00)[]; FREEFALL_USER(0.00)[jrtc27]; TO_DN_SOME(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_HAS_DN(0.00)[]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.221.43:from]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_NEQ_ENVFROM(0.00)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; R_DKIM_NA(0.00)[]; MLMMJ_DEST(0.00)[dev-commits-src-all@freebsd.org]; APPLE_MAILER_COMMON(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.221.43:from] X-Rspamd-Queue-Id: 4X3Bdm59MWz4KPX On 10 Sep 2024, at 19:04, Jessica Clarke wrote: >=20 > On 9 Sep 2024, at 17:05, Andrew Turner wrote: >>=20 >> The branch main has been updated by andrew: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3Df05795e3f65f305cb770ae91d8e9c8f0= 5d267e0d >>=20 >> commit f05795e3f65f305cb770ae91d8e9c8f05d267e0d >> Author: Zachary Leaf >> AuthorDate: 2024-07-31 08:23:24 +0000 >> Commit: Andrew Turner >> CommitDate: 2024-09-09 16:03:19 +0000 >>=20 >> arm64: write PID in CONTEXTIDR_EL1 on ctx switch >>=20 >> Debug and trace features such as Statistical Profiling Extension = (SPE) >> use the CONTEXTIDR_EL1 register to get the PID of the current = process. >>=20 >> Add a sysctl switch to toggle writing the current PID into this = register >> in the thread switcher. >>=20 >> To make use of the feature, the following sysctl switch must be = set: >>=20 >> sysctl machdep.pid_in_contextidr=3D1 >>=20 >> Kernel code can also toggle the sysctl by writing directly to the = global >> var behind the sysctl arm64_pid_in_contextidr: >>=20 >> extern bool arm64_pid_in_contextidr; >>=20 >> Reviewed by: andrew >> Sponsored by: Arm Ltd >> Differential Revision: https://reviews.freebsd.org/D46192 >> --- >> sys/arm64/arm64/genassym.c | 2 ++ >> sys/arm64/arm64/swtch.S | 17 +++++++++++++++++ >> sys/arm64/arm64/sys_machdep.c | 6 ++++++ >> 3 files changed, 25 insertions(+) >>=20 >> diff --git a/sys/arm64/arm64/genassym.c b/sys/arm64/arm64/genassym.c >> index a4db825e976c..5a20169d51c3 100644 >> --- a/sys/arm64/arm64/genassym.c >> +++ b/sys/arm64/arm64/genassym.c >> @@ -58,6 +58,8 @@ ASSYM(PCB_TPIDRRO, offsetof(struct pcb, = pcb_tpidrro_el0)); >> ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault)); >> ASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags)); >>=20 >> +ASSYM(PR_PID, offsetof(struct proc, p_pid)); >> + >> ASSYM(SF_UC, offsetof(struct sigframe, sf_uc)); >>=20 >> ASSYM(TD_PROC, offsetof(struct thread, td_proc)); >> diff --git a/sys/arm64/arm64/swtch.S b/sys/arm64/arm64/swtch.S >> index 6af70ca839a0..3a2bf2cb5a7f 100644 >> --- a/sys/arm64/arm64/swtch.S >> +++ b/sys/arm64/arm64/swtch.S >> @@ -55,6 +55,15 @@ >> 999: >> .endm >>=20 >> +.macro pid_in_context_idr label >> + adrp x9, arm64_pid_in_contextidr >> + ldr x10, [x9, :lo12:arm64_pid_in_contextidr] >=20 > This loads a 64-bit value, not an 8-bit bool as the variable is > defined. Depending on the alignment of arm64_pid_in_contextidr this = can > even fail to link, and this shows up in GitHub Actions with the > clang-12 and clang-13 jobs failing. Similarly the load of p_pid that follows is reading an int32_t with a 64-bit load. Jess