Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70444C433FE for ; Fri, 26 Nov 2021 17:31:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238520AbhKZRey (ORCPT ); Fri, 26 Nov 2021 12:34:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230366AbhKZRcw (ORCPT ); Fri, 26 Nov 2021 12:32:52 -0500 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71ED1C0613FC for ; Fri, 26 Nov 2021 09:08:38 -0800 (PST) Received: by mail-lj1-x232.google.com with SMTP id t11so19977514ljh.6 for ; Fri, 26 Nov 2021 09:08:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telus.net; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1Z+Aa1ZVdAmfmE1NZueegBa8Pgcv0C9VgAhOiglDc9I=; b=ZgT2rO53QWWA4T0RU51wzkspW3t6DB3im0TxMixGFFCykR6O4rf1HhVCQsm+5pyQRq NTUqJQL/9wuqXdKDACOwwdRZB6f52wftNv+I7a1B+Gs8ddnlmdAh4XkRhniBGEvblYBm h215o983fRGfRNjXtHlyihN/e0+zqE6HLCUeAJFOdBAoNkmvrkqqnOdKMJLYIH1xXlva B8uhkYmluQ229tsBL6Q0Dtqq8Nz/XSeeN5yERhlSVOUO8LPZq+MogNloXed4fKzQp5zH LwMWkhddK2F5Lsznv+w93jCSC4YiMzPsLeYaO8n3oXgjPQohK/fVvJBboWsXzjdrCXHc HiSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1Z+Aa1ZVdAmfmE1NZueegBa8Pgcv0C9VgAhOiglDc9I=; b=047E+F0/SRFxAqiU1PssUqCKtdy+9D7AG+uvaBjRzmvx+Ma/c2Oj51i+gl7o53znC9 0lkc/1VnA7leWa+maQu1QDEDGGVHitmAkajwftdo+wSe/O8s+nWcIT0sscKtEkGpQ8EE HDNCdXbDwaeryo9ahnyKlvWAHZyvNuL0zz7k+H7gGIJz+ZK1uHc4oe+9vzNqOHZHI0h5 FxqRx+3oQojm9aYFL0vKhYlJduIonPiPxte6NkenrVGd2Em6+bA9FYXwTvSVT7/EipE7 9ov1HxKP8tR6QeU7kNcjWVZ1JnZW6IVwEYAlm+f58uzxeLSpIpR8ox7/KBYq59HfVFmO Fkow== X-Gm-Message-State: AOAM531GRbiAtCc6qeLQkLIpr6lLFNnCzS/Eyo/+HGNhKmv8PGrJsRqZ p1faNARikQVm1KhvPwfxuBX5YWQH9YSx7UP9c/Px+Q== X-Google-Smtp-Source: ABdhPJxnCbmTYEOAlJ+sG03DlIEvE0POZPGX965bV4Wm9rt0oNTDOocOUUyNHGe2xNvUiK7m0R6T4BF7N3ner6BxgAQ= X-Received: by 2002:a2e:80cf:: with SMTP id r15mr32902356ljg.34.1637946516629; Fri, 26 Nov 2021 09:08:36 -0800 (PST) MIME-Version: 1.0 References: <20210401183654.27214-1-daniel.lezcano@linaro.org> <20210401183654.27214-3-daniel.lezcano@linaro.org> In-Reply-To: <20210401183654.27214-3-daniel.lezcano@linaro.org> From: Doug Smythies Date: Fri, 26 Nov 2021 09:08:25 -0800 Message-ID: Subject: Re: [PATCH v6 3/7] powercap/drivers/dtpm: Simplify the dtpm table To: Daniel Lezcano Cc: Linux PM list , Linux Kernel Mailing List , lukasz.luba@arm.com, "Rafael J. Wysocki" , gregkh@linuxfoundation.org, dsmythies Content-Type: multipart/mixed; boundary="00000000000049780205d1b424f6" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --00000000000049780205d1b424f6 Content-Type: text/plain; charset="UTF-8" Hi Daniel, This patch introduces a regression, at least on my test system. I can no longer change CPU frequency scaling drivers, for example from intel_cpufreq (A.K.A intel_pstate in passive mode) to intel_pstate (A.K.A. active mode). The task just hangs forever. I bisected the kernel and got this commit as the result. As a double check, I reverted this commit: 7a89d7eacf8e84f2afb94db5ae9d9f9faa93f01c on kernel 5.16-rc2 and the issue was resolved. While your email is fairly old, I observe that it was only included as of kernel 5.16-rc1. Command Example that never completes: $ echo passive | sudo tee /sys/devices/system/cpu/intel_pstate/status syslog excerpt attached. ... Doug On Thu, Apr 1, 2021 at 12:24 PM Daniel Lezcano wrote: > > The dtpm table is an array of pointers, that forces the user of the > table to define initdata along with the declaration of the table > entry. It is more efficient to create an array of dtpm structure, so > the declaration of the table entry can be done by initializing the > different fields. > > Signed-off-by: Daniel Lezcano > Reviewed-by: Lukasz Luba > --- > drivers/powercap/dtpm.c | 4 ++-- > drivers/powercap/dtpm_cpu.c | 4 +++- > include/linux/dtpm.h | 20 +++++++++----------- > 3 files changed, 14 insertions(+), 14 deletions(-) > > diff --git a/drivers/powercap/dtpm.c b/drivers/powercap/dtpm.c > index a707cc2965a1..d9aac107c927 100644 > --- a/drivers/powercap/dtpm.c > +++ b/drivers/powercap/dtpm.c > @@ -583,7 +583,7 @@ int dtpm_register(const char *name, struct dtpm *dtpm, struct dtpm *parent) > > static int __init dtpm_init(void) > { > - struct dtpm_descr **dtpm_descr; > + struct dtpm_descr *dtpm_descr; > > pct = powercap_register_control_type(NULL, "dtpm", NULL); > if (IS_ERR(pct)) { > @@ -592,7 +592,7 @@ static int __init dtpm_init(void) > } > > for_each_dtpm_table(dtpm_descr) > - (*dtpm_descr)->init(*dtpm_descr); > + dtpm_descr->init(); > > return 0; > } > diff --git a/drivers/powercap/dtpm_cpu.c b/drivers/powercap/dtpm_cpu.c > index 9deafd16a197..74b39a1082e5 100644 > --- a/drivers/powercap/dtpm_cpu.c > +++ b/drivers/powercap/dtpm_cpu.c > @@ -204,7 +204,7 @@ static int cpuhp_dtpm_cpu_online(unsigned int cpu) > return ret; > } > > -int dtpm_register_cpu(struct dtpm *parent) > +static int __init dtpm_cpu_init(void) > { > int ret; > > @@ -241,3 +241,5 @@ int dtpm_register_cpu(struct dtpm *parent) > > return 0; > } > + > +DTPM_DECLARE(dtpm_cpu, dtpm_cpu_init); > diff --git a/include/linux/dtpm.h b/include/linux/dtpm.h > index 577c71d4e098..2ec2821111d1 100644 > --- a/include/linux/dtpm.h > +++ b/include/linux/dtpm.h > @@ -33,25 +33,23 @@ struct dtpm_ops { > void (*release)(struct dtpm *); > }; > > -struct dtpm_descr; > - > -typedef int (*dtpm_init_t)(struct dtpm_descr *); > +typedef int (*dtpm_init_t)(void); > > struct dtpm_descr { > - struct dtpm *parent; > - const char *name; > dtpm_init_t init; > }; > > /* Init section thermal table */ > -extern struct dtpm_descr *__dtpm_table[]; > -extern struct dtpm_descr *__dtpm_table_end[]; > +extern struct dtpm_descr __dtpm_table[]; > +extern struct dtpm_descr __dtpm_table_end[]; > > -#define DTPM_TABLE_ENTRY(name) \ > - static typeof(name) *__dtpm_table_entry_##name \ > - __used __section("__dtpm_table") = &name > +#define DTPM_TABLE_ENTRY(name, __init) \ > + static struct dtpm_descr __dtpm_table_entry_##name \ > + __used __section("__dtpm_table") = { \ > + .init = __init, \ > + } > > -#define DTPM_DECLARE(name) DTPM_TABLE_ENTRY(name) > +#define DTPM_DECLARE(name, init) DTPM_TABLE_ENTRY(name, init) > > #define for_each_dtpm_table(__dtpm) \ > for (__dtpm = __dtpm_table; \ > -- > 2.17.1 > --00000000000049780205d1b424f6 Content-Type: text/plain; charset="US-ASCII"; name="syslog_example.txt" Content-Disposition: attachment; filename="syslog_example.txt" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_kwgn0tbv0 Tm92IDI2IDA3OjMxOjEzIHMx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