Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3110972pxk; Tue, 15 Sep 2020 10:17:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxa1A0w17XF0JmQmKj4q6860ZJPkSphuI8O0bmzQe6NT5WjD6hGZ68S7cAeF9+cLXb/bWlZ X-Received: by 2002:a17:907:417c:: with SMTP id oe20mr20616647ejb.322.1600190219946; Tue, 15 Sep 2020 10:16:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600190219; cv=none; d=google.com; s=arc-20160816; b=XCMLKYwTCsnfWVvQpXSeRcfwGbar7AO3nzZw9eZli0pkt7EB5cc3PQaSDzWobHAuEd p/uV1DOGhh5WUHLgClX28/X4b+xD6ewm85X2yM3VLcY7Y+t1spwwS9A7sRUSi5GGPOb6 cl2v0uphdR1P22AteOT9UXsnnf4vR9RLH3iC8jwfQ2m+xVA3VX9Ibx5GteZu4KrbSkM3 sIPP8IxJx/HhrPPTHkUSVWdTRrKgnPkESFQcAGKkgi/RFdKrEqYYXOYcqnLuV7+jI6D+ 693EaWPKbnUxvie6f987aDsQ0mK+T+0KP/DAvcdzlZpTkXDBGP5hswpYilfTdK+uQBki n5wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=HH4K2Ik+9z0TLk55NCkKu0S9yy4lgkJGUwLdhLpq5Hc=; b=ifeiU1Y/P50SwCj0svhNdthYwVIq5hrj1lVgeJfhkmnX2OfpfzRZxvnfbMFxvG5suL W1CVkBnPdWlunbzPv57vxH/U4NiT71p0oVreo3KyVLxAXBHRQleRU3Qpobn0FNaEbO7y IbMcVtcyxYJhEGZpWG0U1TT+xnAe+NZI6c+Va/zZJzOwkKN+4t989Maqasifd6DSaJVh SwuVa4/96TR6I2ihIwCC8YC3CcPqRucq2ba7U/vq8eAeZqV6QXRE4Wky86PCVKTx6h9Q acxozM4oNRllotQa5z6HGOprh8jYfVwx8Jf8OzvDJT9JsRv0QoWvgPs5+5iuvUGmfq1S 0ZoA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d3si9425846ejw.357.2020.09.15.10.16.36; Tue, 15 Sep 2020 10:16:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727716AbgIORPu (ORCPT + 99 others); Tue, 15 Sep 2020 13:15:50 -0400 Received: from mail-oi1-f195.google.com ([209.85.167.195]:35379 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727591AbgIOQ1E (ORCPT ); Tue, 15 Sep 2020 12:27:04 -0400 Received: by mail-oi1-f195.google.com with SMTP id w16so4575291oia.2; Tue, 15 Sep 2020 09:27:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HH4K2Ik+9z0TLk55NCkKu0S9yy4lgkJGUwLdhLpq5Hc=; b=iTEXLqnXeagXjxAnXSMcAcbfnrTW6Cp+h++5LIUSkc+9hUiXhchoLnumuj4Wu8NaES kt7RIyFB2cn+YJoEG4nJz1xgspSUuluf+lE6xJ1V30KdJS7UqHcw6EN+0cIMdNkfYBkg 9RGD1uZsmYwP9BX5QT/A5EgKOH12FvDUxcuDCjN+x8bsTPNfhgsBrbBFLolL8F6Gbrc2 lX+oHY8pVa6DkYYdieu3qroWwMypK/1G3JKO6DB5BaW8cyKs2Haz1A73AUfNogr8uQTf 2kltuCe2RWErB5Y7XdHmiNoLkzYd+Vl9C46riN+IwCt7eygspoHCDRRiGTzzazVYjCoi uhDA== X-Gm-Message-State: AOAM5322ZqWr8ztgEtl/vyR19Weer1maUOUVwLaqughb4y9fVsImfM21 tToUugLZN57FVYZPIbpfISiOnUYef/8Ar7ldTUTyRf4q X-Received: by 2002:aca:fd95:: with SMTP id b143mr170257oii.68.1600187223051; Tue, 15 Sep 2020 09:27:03 -0700 (PDT) MIME-Version: 1.0 References: <20200915103157.345404192@infradead.org> <20200915103806.280265587@infradead.org> In-Reply-To: <20200915103806.280265587@infradead.org> From: "Rafael J. Wysocki" Date: Tue, 15 Sep 2020 18:26:52 +0200 Message-ID: Subject: Re: [RFC][PATCH 1/4] acpi: Use CPUIDLE_FLAG_TIMER_STOP To: Peter Zijlstra Cc: "Rafael J. Wysocki" , Borislav Petkov , "the arch/x86 maintainers" , Tony Luck , Len Brown , Daniel Lezcano , Linux Kernel Mailing List , ACPI Devel Maling List , Linux PM , Ulf Hansson , "Paul E. McKenney" , Thomas Gleixner , Naresh Kamboju Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 15, 2020 at 12:44 PM Peter Zijlstra wrote: > > Make acpi_processor_idle use the common broadcast code, there's no > reason not to. This also removes some RCU usage after > rcu_idle_enter(). > > Signed-off-by: Peter Zijlstra (Intel) The whole series looks good to me, so please feel free to add Acked-by: Rafael J. Wysocki to all of the four patches. Alternatively, please let me know if you want me to take the patches. > --- > drivers/acpi/processor_idle.c | 49 +++++++++++++----------------------------- > 1 file changed, 16 insertions(+), 33 deletions(-) > > --- a/drivers/acpi/processor_idle.c > +++ b/drivers/acpi/processor_idle.c > @@ -161,18 +161,10 @@ static void lapic_timer_propagate_broadc > } > > /* Power(C) State timer broadcast control */ > -static void lapic_timer_state_broadcast(struct acpi_processor *pr, > - struct acpi_processor_cx *cx, > - int broadcast) > -{ > - int state = cx - pr->power.states; > - > - if (state >= pr->power.timer_broadcast_on_state) { > - if (broadcast) > - tick_broadcast_enter(); > - else > - tick_broadcast_exit(); > - } > +static bool lapic_timer_needs_broadcast(struct acpi_processor *pr, > + struct acpi_processor_cx *cx) > +{ > + return cx - pr->power.states >= pr->power.timer_broadcast_on_state; > } > > #else > @@ -180,9 +172,9 @@ static void lapic_timer_state_broadcast( > static void lapic_timer_check_state(int state, struct acpi_processor *pr, > struct acpi_processor_cx *cstate) { } > static void lapic_timer_propagate_broadcast(struct acpi_processor *pr) { } > -static void lapic_timer_state_broadcast(struct acpi_processor *pr, > - struct acpi_processor_cx *cx, > - int broadcast) > + > +static bool lapic_timer_needs_broadcast(struct acpi_processor *pr, > + struct acpi_processor_cx *cx) > { > } > > @@ -568,21 +560,13 @@ static DEFINE_RAW_SPINLOCK(c3_lock); > * acpi_idle_enter_bm - enters C3 with proper BM handling > * @pr: Target processor > * @cx: Target state context > - * @timer_bc: Whether or not to change timer mode to broadcast > */ > static void acpi_idle_enter_bm(struct acpi_processor *pr, > - struct acpi_processor_cx *cx, bool timer_bc) > + struct acpi_processor_cx *cx) > { > acpi_unlazy_tlb(smp_processor_id()); > > /* > - * Must be done before busmaster disable as we might need to > - * access HPET ! > - */ > - if (timer_bc) > - lapic_timer_state_broadcast(pr, cx, 1); > - > - /* > * disable bus master > * bm_check implies we need ARB_DIS > * bm_control implies whether we can do ARB_DIS > @@ -609,9 +593,6 @@ static void acpi_idle_enter_bm(struct ac > c3_cpu_count--; > raw_spin_unlock(&c3_lock); > } > - > - if (timer_bc) > - lapic_timer_state_broadcast(pr, cx, 0); > } > > static int acpi_idle_enter(struct cpuidle_device *dev, > @@ -630,7 +611,7 @@ static int acpi_idle_enter(struct cpuidl > cx = per_cpu(acpi_cstate[index], dev->cpu); > } else if (cx->type == ACPI_STATE_C3 && pr->flags.bm_check) { > if (cx->bm_sts_skip || !acpi_idle_bm_check()) { > - acpi_idle_enter_bm(pr, cx, true); > + acpi_idle_enter_bm(pr, cx); > return index; > } else if (drv->safe_state_index >= 0) { > index = drv->safe_state_index; > @@ -642,15 +623,11 @@ static int acpi_idle_enter(struct cpuidl > } > } > > - lapic_timer_state_broadcast(pr, cx, 1); > - > if (cx->type == ACPI_STATE_C3) > ACPI_FLUSH_CPU_CACHE(); > > acpi_idle_do_entry(cx); > > - lapic_timer_state_broadcast(pr, cx, 0); > - > return index; > } > > @@ -666,7 +643,7 @@ static int acpi_idle_enter_s2idle(struct > return 0; > > if (pr->flags.bm_check) { > - acpi_idle_enter_bm(pr, cx, false); > + acpi_idle_enter_bm(pr, cx); > return 0; > } else { > ACPI_FLUSH_CPU_CACHE(); > @@ -682,6 +659,7 @@ static int acpi_processor_setup_cpuidle_ > { > int i, count = ACPI_IDLE_STATE_START; > struct acpi_processor_cx *cx; > + struct cpuidle_state *state; > > if (max_cstate == 0) > max_cstate = 1; > @@ -694,6 +672,11 @@ static int acpi_processor_setup_cpuidle_ > > per_cpu(acpi_cstate[count], dev->cpu) = cx; > > + if (lapic_timer_needs_broadcast(pr, cx)) { > + state = &acpi_idle_driver.states[count]; > + state->flags |= CPUIDLE_FLAG_TIMER_STOP; > + } > + > count++; > if (count == CPUIDLE_STATE_MAX) > break; > >