From nobody Tue Oct 11 13:30:10 2022 X-Original-To: dev-commits-src-main@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 4MmxVT2dpDz4fk1w for ; Tue, 11 Oct 2022 13:30:25 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) (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 "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MmxVS54klz3hX0 for ; Tue, 11 Oct 2022 13:30:24 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-ed1-x532.google.com with SMTP id z97so20128934ede.8 for ; Tue, 11 Oct 2022 06:30:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=npji7Y9ZTZRtvObexAK6KTNawc0QgTy3rnLYChi97h4=; b=KXDSstUAFIzwnNijyfyAHCw5Z3d4mCTByT6UuT+fKmErp3BbnBGVai58XSJpU/bucL qvDhngpEFfAMs3WjeVGVZ/Kb6GIMBa2bpqxhX3UkfiJDDY8BRngUeEZp0WJ8/Afbc9iT QpqeVnrpQdBX0JgrmZGa4qQgAoGQ1uvpE9ffKAe5Tl21h44mVt2xC7xJmfMsftpZvN8C nT47iClSpSX9mpoi++U/t0kN+10vaBcCb0FgEpjUj1ozoMbbv0yRAlROAaj/7pYx7Y35 Oag14B6d3am36ptmb0tRxQu4OvdoIzyWl95udYYIyJvf55aJrXtphlsAsFAGmCX8YJ/9 yy+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=npji7Y9ZTZRtvObexAK6KTNawc0QgTy3rnLYChi97h4=; b=3BYvYlrsOP7/eS+Gz9kJfcJlNw8owYMaNPY67n3LMpZqVELHc6WfhV7EYLRBcJQ42o 8MmUJenqbvdQYUrjg4uvL281GdS4PfDdxXEcKjqV/G0tuS9OP9at2hvWI2+mwqa6hi2i vLfBLyrD6SAGQl8pnEq3jnVpHcm22ffGA2SJmW6xa07uLvuMro2MgtRdrPuvnShGvNBL 6My7X4IHx/sobRElVhbdRkuhPmGwbHYEz4CEdNvgEBya0SmDjuqaLDXx4NDLCCODAeHQ z4olQPFGCe1Lr3GAF5AGDOW2uOVydBi1zIA9Gm8TY/+ybQ5om5Q0NT2teEtqXvAWxpXk gWGg== X-Gm-Message-State: ACrzQf3qnbog+/7vCVgETLtLBT47qdvlXJCDTChoD3PnCViVL1tkmtw6 Tk22RPo+TVyLMxY9F6qHkrxSK9feiZiVEzbD9K6t/aPHXJ8= X-Google-Smtp-Source: AMsMyM6MK3eYHIw+rruKXDNgGtNslL4AiRWKmPTUgl6AzggfU+DcoCy/At/X72naoZ+0GfPe+bePS7+lHLfgvkK/XR8= X-Received: by 2002:a05:6402:5c9:b0:446:fb0:56bb with SMTP id n9-20020a05640205c900b004460fb056bbmr23481414edx.173.1665495023150; Tue, 11 Oct 2022 06:30:23 -0700 (PDT) List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 References: <202210110832.29B8WnnR003119@gitrepo.freebsd.org> In-Reply-To: <202210110832.29B8WnnR003119@gitrepo.freebsd.org> From: Warner Losh Date: Tue, 11 Oct 2022 07:30:10 -0600 Message-ID: Subject: Re: git: eee0f7aea425 - main - acpi: Put CPPC workaround behind i386/amd64 if def To: Tom Jones Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: multipart/alternative; boundary="0000000000003b42a905eac2473b" X-Rspamd-Queue-Id: 4MmxVS54klz3hX0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20210112.gappssmtp.com header.s=20210112 header.b=KXDSstUA; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2a00:1450:4864:20::532) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.00 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20210112.gappssmtp.com:s=20210112]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; MLMMJ_DEST(0.00)[dev-commits-src-main@freebsd.org]; R_SPF_NA(0.00)[no SPF record]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::532:from]; RCVD_TLS_LAST(0.00)[]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCPT_COUNT_THREE(0.00)[4]; FROM_HAS_DN(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20210112.gappssmtp.com:+]; TO_DN_SOME(0.00)[]; DMARC_NA(0.00)[bsdimp.com]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-main@freebsd.org]; RCVD_COUNT_TWO(0.00)[2] X-ThisMailContainsUnwantedMimeParts: N --0000000000003b42a905eac2473b Content-Type: text/plain; charset="UTF-8" On Tue, Oct 11, 2022 at 2:32 AM Tom Jones wrote: > The branch main has been updated by thj: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=eee0f7aea42564fe005c74f004d63f8cc170ef59 > > commit eee0f7aea42564fe005c74f004d63f8cc170ef59 > Author: Tom Jones > AuthorDate: 2022-10-11 08:30:34 +0000 > Commit: Tom Jones > CommitDate: 2022-10-11 08:31:22 +0000 > > acpi: Put CPPC workaround behind i386/amd64 if def > > While CPPC is available on arm64 platforms with ACPI we don't know if > we > need to work around issues with firmware there. > --- > sys/dev/acpica/acpi_cpu.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c > index 49d2bd11fdaa..ea99cfdeb90f 100644 > --- a/sys/dev/acpica/acpi_cpu.c > +++ b/sys/dev/acpica/acpi_cpu.c > @@ -153,7 +153,9 @@ static struct sysctl_ctx_list cpu_sysctl_ctx; > static struct sysctl_oid *cpu_sysctl_tree; > static int cpu_cx_generic; > static int cpu_cx_lowest_lim; > +#if defined(__i386__) || defined(__amd64__) > static bool cppc_notify; > +#endif > > static struct acpi_cpu_softc **cpu_softc; > ACPI_SERIAL_DECL(cpu, "ACPI CPU"); > @@ -985,11 +987,13 @@ acpi_cpu_startup(void *arg) > NULL, 0, acpi_cpu_global_cx_lowest_sysctl, "A", > "Global lowest Cx sleep state to use"); > > +#if defined(__i386__) || defined(__amd64__) > /* Add sysctl handler to control registering for CPPC notifications */ > cppc_notify = 1; > SYSCTL_ADD_BOOL(&cpu_sysctl_ctx, SYSCTL_CHILDREN(cpu_sysctl_tree), > OID_AUTO, "cppc_notify", CTLFLAG_RDTUN | CTLFLAG_MPSAFE, > &cppc_notify, 0, "Register for CPPC Notifications"); > +#endif > > /* Take over idling from cpu_idle_default(). */ > cpu_cx_lowest_lim = 0; > I'd suggest changing the #ifdef to something more like: #if defined(__i386__) || defined (__amd64__) cppc_notify=1; #else cppc_notify=0; #endif SYSCTL_ADD... instead. What do you think? I'd have done it as a one-liner, but you can't say cppc_notify=defined(__i386__) || defined(__amd64__) :) Warner --0000000000003b42a905eac2473b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Tue, Oct 11, 2022 at 2:32 AM Tom J= ones <thj@freebsd.org> wrote:<= br>
The branch main = has been updated by thj:

URL: https://cgit.= FreeBSD.org/src/commit/?id=3Deee0f7aea42564fe005c74f004d63f8cc170ef59
commit eee0f7aea42564fe005c74f004d63f8cc170ef59
Author:=C2=A0 =C2=A0 =C2=A0Tom Jones <thj@FreeBSD.org>
AuthorDate: 2022-10-11 08:30:34 +0000
Commit:=C2=A0 =C2=A0 =C2=A0Tom Jones <thj@FreeBSD.org>
CommitDate: 2022-10-11 08:31:22 +0000

=C2=A0 =C2=A0 acpi: Put CPPC workaround behind i386/amd64 if def

=C2=A0 =C2=A0 While CPPC is available on arm64 platforms with ACPI we don&#= 39;t know if we
=C2=A0 =C2=A0 need to work around issues with firmware there.
---
=C2=A0sys/dev/acpica/acpi_cpu.c | 4 ++++
=C2=A01 file changed, 4 insertions(+)

diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c
index 49d2bd11fdaa..ea99cfdeb90f 100644
--- a/sys/dev/acpica/acpi_cpu.c
+++ b/sys/dev/acpica/acpi_cpu.c
@@ -153,7 +153,9 @@ static struct sysctl_ctx_list cpu_sysctl_ctx;
=C2=A0static struct sysctl_oid *cpu_sysctl_tree;
=C2=A0static int=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 cpu_cx_gen= eric;
=C2=A0static int=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 cpu_cx_low= est_lim;
+#if defined(__i386__) || defined(__amd64__)
=C2=A0static bool=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cppc_notif= y;
+#endif

=C2=A0static struct acpi_cpu_softc **cpu_softc;
=C2=A0ACPI_SERIAL_DECL(cpu, "ACPI CPU");
@@ -985,11 +987,13 @@ acpi_cpu_startup(void *arg)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 NULL, 0, acpi_cpu_global_cx_lowest_sysctl, &quo= t;A",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 "Global lowest Cx sleep state to use"= );

+#if defined(__i386__) || defined(__amd64__)
=C2=A0 =C2=A0 =C2=A0/* Add sysctl handler to control registering for CPPC n= otifications */
=C2=A0 =C2=A0 =C2=A0cppc_notify =3D 1;
=C2=A0 =C2=A0 =C2=A0SYSCTL_ADD_BOOL(&cpu_sysctl_ctx, SYSCTL_CHILDREN(cp= u_sysctl_tree),
=C2=A0 =C2=A0 =C2=A0 =C2=A0 OID_AUTO, "cppc_notify", CTLFLAG_RDTU= N | CTLFLAG_MPSAFE,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 &cppc_notify, 0, "Register for CPPC No= tifications");
+#endif

=C2=A0 =C2=A0 =C2=A0/* Take over idling from cpu_idle_default(). */
=C2=A0 =C2=A0 =C2=A0cpu_cx_lowest_lim =3D 0;

I'd suggest changing the #ifdef to something more like:

#if defined(__i386__) || defined (__amd64__)
cppc= _notify=3D1;
#else
cppc_notify=3D0;
#endif=C2= =A0
SYSCTL_ADD...

instead. What do you t= hink? I'd have done it as a one-liner, but you can't say cppc_notif= y=3Ddefined(__i386__) || defined(__amd64__) :)

War= ner
--0000000000003b42a905eac2473b--