From nobody Tue Sep 10 18:04:59 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 4X3BST0skjz5WLj0 for ; Tue, 10 Sep 2024 18:05:13 +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 4X3BSS29MHz4JCZ for ; Tue, 10 Sep 2024 18:05:12 +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-374b9761eecso828659f8f.2 for ; Tue, 10 Sep 2024 11:05:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725991511; x=1726596311; 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=/J64IgkjWbr/kJNCZMf5c51l9RnjxOlWhg1G9vvpPWo=; b=b+vs8cLgfVx7L+jukux0WmOq1PwvT80L2HZ+lcSwZwLJkNpF2A4dmRSVaen8vdAomd uALbxq5EI1/5bz+h+1Rb4xaX4xaNCBV7sjcJ7QC4omuZ2EbggD7aKwSggYPPAxFoR1bP 7kmbCWnH/2ptQEO8WnWYQigtT2fO/LD/hHEEjpVVje6lajcnynkWIrADq3FOGePmayqU zLz+Sx+4ncRJSvt9pa5OsrZKJZ4/JnIhr0CRXicFhaoKu1QFshz3Na+s/DLOnMi5XHlK kBuMZyq1u6DAtvq8CKcaatOB22tjbDChkQNC9GpHkqTXvF1KGkzMxw0WSub03L89istV Lx3A== X-Forwarded-Encrypted: i=1; AJvYcCXLpAOdVdwhwCxPZ5n57uz1nWId4XHcSgdUlOqb28+IDEKudEvWBwrwTKuvCFC7nx7JZ27A5RQCleUutPgXxFoXoyVB@freebsd.org X-Gm-Message-State: AOJu0YwS9UrfjqORegd4RXBYN7R35ZotpKrAhqXuCsu6kAaYwj5H5PEb mTkupZTt9mQxU0LU1GBKmHC/oPbVNfgwIhTqsyjOA2U0wxuonkmDTXI/4+qLi5/89jm1IcI6tDT m X-Google-Smtp-Source: AGHT+IGVsf9jpByoulBIJJHj3xD0bupZxkI+CtjT+7OHVsU5JJtYnYnHFUu10C741uVgBzrTcwarXA== X-Received: by 2002:adf:e283:0:b0:374:ba2c:3028 with SMTP id ffacd0b85a97d-378b07f374fmr321879f8f.36.1725991510165; Tue, 10 Sep 2024 11:05:10 -0700 (PDT) Received: from smtpclient.apple ([131.111.5.201]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37895649733sm9526387f8f.8.2024.09.10.11.05.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Sep 2024 11:05:09 -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: <202409091605.489G5X6W041843@gitrepo.freebsd.org> Date: Tue, 10 Sep 2024 19:04:59 +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: 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:c]; MIME_GOOD(-0.10)[text/plain]; DMARC_POLICY_SOFTFAIL(0.10)[freebsd.org : SPF not aligned (relaxed), No valid DKIM,none]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; 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]; RCVD_VIA_SMTP_AUTH(0.00)[]; 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]; TO_DN_EQ_ADDR_SOME(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: 4X3BSS29MHz4JCZ 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] 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. Jess