Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2520811rwd; Fri, 2 Jun 2023 10:30:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5QkTgeJa5lBKljMXRuCxUeKlBpWW/4tKjxVmBE3Y9UseIA9b+ZfNRASB3P5L5B16xh5hfv X-Received: by 2002:a05:6a20:7346:b0:111:5017:8cb8 with SMTP id v6-20020a056a20734600b0011150178cb8mr6351170pzc.4.1685727005903; Fri, 02 Jun 2023 10:30:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685727005; cv=none; d=google.com; s=arc-20160816; b=IzZTaFIsHv5y7AyDi6znV7IOR0AAzq9mOxB/lG5hW6/PdHh8SLaK8rYScipGFIoXVB E1BTyNGrft01aRFf0peWPpLG1WS5uc79mAFrp/ooz/UbLa2NVTPI+LY9GFkJSupCnsBO YEAhiwvORJePjBf0mLa/yhUD55Dofe3UzXb0MarxWg2a2VNb2LdSvPmTCfrk7tPAsdY+ e82vR46AtV+4i7NlL0uIc2LkqYkKD7acG2yw1sNsFXP9BJdDupZ3RpVXY3NKh79pZtSI eyCV4tjybMwhgePE4yCF9O//pXTDw0m0t4hmMUx1dCSoWlc+a5cUE2eLJmW4NiHvTYC2 /y7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=WXAH3oG3aygh8gSV+sBdgExe9m1djSWFS1Ogib5FMXQ=; b=0QdfmwEQNuIStMSloe83rB8yeXgAGVi0ZGqNtki8/rHTAr1vhYunNFbOm8SesqBURb +IGbvDOOi7RuxdYQqv/48D8VmaLC7W7Hpe0eZm5ySNqBDU6/fYh/HrWgYwM0nSipihmT 75kWXRcW5kH1pqpbhGLk+AFI+DrYLp00wPDp5dUBQYvcspmwgYkOoYSu0eKgJpEJxxPV abuSkRx4IDNv6INZ2VNRjVM9gqqb9HNFGgIP8fLEODVw/RGhZ/mf0VmxX7KuqxRRK8iS bbCTmnqGfilcofoBOyhdQzyYwLNEurqWWSgJrvhQJ41GWXEteNB+Z1HzQTGumF5e7lV9 LFsg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e26-20020aa7981a000000b0063b82909b1esi1068746pfl.0.2023.06.02.10.29.50; Fri, 02 Jun 2023 10:30:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235751AbjFBQz3 convert rfc822-to-8bit (ORCPT + 99 others); Fri, 2 Jun 2023 12:55:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230430AbjFBQz1 (ORCPT ); Fri, 2 Jun 2023 12:55:27 -0400 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE9E4196; Fri, 2 Jun 2023 09:55:25 -0700 (PDT) Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-974604c1394so23398066b.0; Fri, 02 Jun 2023 09:55:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685724924; x=1688316924; h=content-transfer-encoding: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=pt9VNTeJlFVEV3sIod8cHGTAKd0dmJxzfE9EV8gLQWE=; b=HodPOyJNhYxQ60vwtp4RyfBXr7UskTIgCAEk2wJ/1jYVuesor3MJal4KF6yB1W1FKZ 1XSWy5JpREK+undDIkqOfukU154VpavJIkbBV829y5FraqDksaIG/N0h2VaBvRPJkA/l wd4Z0vPSEtP14aV3zkJK3IHFRHT/DGM09zo1v1JgH0aA9uuygUBJ34e+Oeap8yNX6DG8 X5/DemQxNHz2zm6bxH9tfTUTv0CR7Xm1Mxebeh89qQ0YJypkmkMroWBHIQ73hTSXtcCG b8dy/eiAMn1TB3hQAFlGTCWHDAeivrJSJ/TOsgiHdSLjAfCHHAMQgXgbS9qww8Y4SGmL Hf6w== X-Gm-Message-State: AC+VfDzuSNA53YZ6xGqDvdGgYHjY6wzWRCkyGiMGw9CGUD0FXAI/xnHx UKY30P7Imf8ufjgIU6co7yHXbSD/CfxqDijaFInIxyqfTLE= X-Received: by 2002:a17:906:145:b0:94a:5f0d:d9d6 with SMTP id 5-20020a170906014500b0094a5f0dd9d6mr10572995ejh.4.1685724924056; Fri, 02 Jun 2023 09:55:24 -0700 (PDT) MIME-Version: 1.0 References: <20230601213246.3271412-1-arnd@kernel.org> <0d627109-483d-42c2-86c7-337c2d38fadb@app.fastmail.com> In-Reply-To: <0d627109-483d-42c2-86c7-337c2d38fadb@app.fastmail.com> From: "Rafael J. Wysocki" Date: Fri, 2 Jun 2023 18:55:12 +0200 Message-ID: Subject: Re: [PATCH] powercap: intel_rapl: fix CONFIG_IOSF_MBI dependency To: Arnd Bergmann Cc: Zhang Rui , Arnd Bergmann , "Rafael J . Wysocki" , Sudeep Holla , "lukasz.luba@arm.com" , "linux-pm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Cristian Marussi Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 2, 2023 at 11:11 AM Arnd Bergmann wrote: > > On Fri, Jun 2, 2023, at 10:04, Zhang, Rui wrote: > > On Thu, 2023-06-01 at 23:32 +0200, Arnd Bergmann wrote: > >> From: Arnd Bergmann > >> > >> When the intel_rapl driver is built-in, but iosf_mbi is a loadable > >> module, > >> the kernel fails to link: > >> > >> x86_64-linux-ld: vmlinux.o: in function `set_floor_freq_atom': > >> intel_rapl_common.c:(.text+0x2dac9b8): undefined reference to > >> `iosf_mbi_write' > >> x86_64-linux-ld: intel_rapl_common.c:(.text+0x2daca66): undefined > >> reference to `iosf_mbi_read' > >> > > > > IMO, it is the intel_rapl_common.c that calls IOSF APIs without > > specifying the dependency. Thus it should be fixed by something like > > below, > > > > --- a/drivers/powercap/Kconfig > > +++ b/drivers/powercap/Kconfig > > @@ -18,10 +18,11 @@ if POWERCAP > > # Client driver configurations go here. > > config INTEL_RAPL_CORE > > tristate > > + select IOSF_MBI > > > > config INTEL_RAPL > > tristate "Intel RAPL Support via MSR Interface" > > - depends on X86 && IOSF_MBI > > + depends on X86 > > select INTEL_RAPL_CORE > > help > > This enables support for the Intel Running Average Power Limit > > I think that has the logic slightly backwards from a usability point > of view: The way I read the arch/x86/Kconfig description, IOSF_MBI > is a feature of specific Intel hardware implementations, which > gets enabled when any of these SoC platforms are enabled in > the build, and the INTEL_RAPL driver specifically only works > on those, while the new INTEL_RAPL_TPMI driver works on other > hardware. > > More generally speaking, I think it is a mistake for a device > driver in one subsystem to use 'select' to enforce a build > dependency on a driver in another subsystem when the other > symbol is user-visible. IOSF_MBI is already selected from multiple places and while you can argue that they are all mistakes, this particular new one would not be worse than any of them. IMO it would be better if IOSF_MBI were not user-visible (and interestingly enough, whoever selects it should also select PCI or depend on it - I'm not really sure if that dependency is taken care of in all cases).