From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F96EEB64D8 for ; Tue, 13 Jun 2023 20:19:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 19C286B008A; Tue, 13 Jun 2023 16:19:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 14DBE6B008C; Tue, 13 Jun 2023 16:19:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0157A8E0002; Tue, 13 Jun 2023 16:19:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id E3E616B008A for ; Tue, 13 Jun 2023 16:19:43 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id BE801A05EC for ; Tue, 13 Jun 2023 20:19:43 +0000 (UTC) X-FDA: 80898840246.12.FEFDCA3 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf07.hostedemail.com (Postfix) with ESMTP id DD7354000F for ; Tue, 13 Jun 2023 20:19:41 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=Tf3UoS9L; dkim=pass header.d=linutronix.de header.s=2020e header.b=Xp05f34x; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf07.hostedemail.com: domain of tglx@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=tglx@linutronix.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686687582; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=HE1N4P0d/WhniObXa5GtYC4fEZuwmn5LLuL6Wr0ZtK4=; b=yLcHFthaq82YUXc8Fft4dLR+EKzrjiBe/0r62DOUvR/PlCgOShRxbdmt8utTJKvdBPdK9o FunIHduyBbH0lKo6Rluwc0MQZnqpzlmBGLNWMyogvkL6Nj37uwGR9Smmruxp4d1Dy7LwnF 3fbCsvYSnhnZCKYEx1Aj+jZYPkKLC0s= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=Tf3UoS9L; dkim=pass header.d=linutronix.de header.s=2020e header.b=Xp05f34x; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf07.hostedemail.com: domain of tglx@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=tglx@linutronix.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686687582; a=rsa-sha256; cv=none; b=ZQoKR8PsEnSl0W8r99g++kVtCCmLdYgYFp2S00DlDe2YXHpCO3ui7zG8TvHGbFTjL0AXgi OyZoprRO3a0ScXi9xTDGIX7butt2NBs90CC2DE1psHcn/ZH6qS2aZ12fdy922uDc0oFexj UCEtE1gf9hOofqmGjvfPcZWadLv6+8U= From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1686687579; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HE1N4P0d/WhniObXa5GtYC4fEZuwmn5LLuL6Wr0ZtK4=; b=Tf3UoS9LopV2MoDkt6mREw6JQ1H92mYf8JJR87y9KFj/g9Y6BCa1QsYyoSYpqQU8Kv513J pN4kb9E9e4kjmxzWqS2LDHP3scrieeSc067Bh5mzIcuZNGGRyI6Y3UbzyynDyXRmWCDwC/ UTYLoIx7oveMp/6/NRRZXvvmsZPcCraBbhAPPeZy7w7QMifJcu7iOfGhCbl81K5+EANJqT B3IteW2VL5AvNnkNiS9WdZxIaX7WJQgq/vOtVU9GM3RuqBZKiYvYUssYiwiHsZHBZH5JOJ o32Xzk/Q71EPi97vaNCjxCLPhuCVLdS9Xhe8Y95dAsEYHGaFSiuPSqBA+HhiSw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1686687579; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=HE1N4P0d/WhniObXa5GtYC4fEZuwmn5LLuL6Wr0ZtK4=; b=Xp05f34xzTJaqdiVBn9l6bLgZ93PE8JGwnfn3n5pwFY//ykipWNnG09cAq9lqdTQfkJHHL 3z+xTe5HLaRIWgCA== To: Eric DeVolder , Greg KH Cc: linux-kernel@vger.kernel.org, david@redhat.com, osalvador@suse.de, corbet@lwn.net, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, bhe@redhat.com, ebiederm@xmission.com, kexec@lists.infradead.org, hpa@zytor.com, rafael@kernel.org, vgoyal@redhat.com, dyoung@redhat.com, lf32.dev@gmail.com, akpm@linux-foundation.org, naveen.n.rao@linux.vnet.ibm.com, zohar@linux.ibm.com, bhelgaas@google.com, vbabka@suse.cz, tiwai@suse.de, seanjc@google.com, linux@weissschuh.net, vschneid@redhat.com, linux-mm@kvack.org, linux-doc@vger.kernel.org, sourabhjain@linux.ibm.com, konrad.wilk@oracle.com, boris.ostrovsky@oracle.com Subject: Re: [PATCH v23 4/8] crash: memory and CPU hotplug sysfs attributes In-Reply-To: <40cacc6b-c3d1-c63b-e307-d95b2c53e399@oracle.com> References: <20230612210712.683175-1-eric.devolder@oracle.com> <20230612210712.683175-5-eric.devolder@oracle.com> <2023061320-vindicate-usual-6643@gregkh> <13118eaa-6fae-7b45-9f3e-ab95e7d34729@oracle.com> <40cacc6b-c3d1-c63b-e307-d95b2c53e399@oracle.com> Date: Tue, 13 Jun 2023 22:19:39 +0200 Message-ID: <87h6rb6rok.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Rspamd-Queue-Id: DD7354000F X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: orbabqcixjus5wtr3h89nd4qz6zuhtpd X-HE-Tag: 1686687581-413979 X-HE-Meta: U2FsdGVkX19PvHQBKF9C5o09njucQjte260w8/wKAfHCY4WugjQuoRlJFErci7vUHoxmx6J3GYl6jUXGepUzrbk+M/3es3vJ6l7mBpKcCA6SlCqRV4VQxvylUPGynytmZYVi/pRDJl1S8ODHZQUQuAFQxKtPLdg0qn7o3F0wBVzoupiWHnhSVLld3pxayqwy1wLEM4usXtZGiw5oyI/UX1mD2rJ4lrqe7q7Etk1EkDxh6j4X7UpHYr2VUk+3aKXZN5Q0vJSA997dKNLabEGDU2pTi8UnQzP6P9U0U+uctA0iE8klYHvOmW8cRbW+dZ5Q8BBmYMEokwTdl8rVji0dxa7vGiI4MqSHdNDRqkBfPzqW6ctQ973AdQ7XxVeQTvxhVh/kpickbRgN1bhg3B2Yb5hCnnx2yMprpcVWhSYJEijBUIMU0RfIqIEnFBrAswZB+2YOv42V+hxRUjTttcQ4CxbBTfKQVM6V2Dpmxrwa/dtKYvQm4uDbxPNxiFbzi9G670K5r4Zr7DpfiWxdtxxw0h01yxluQYsyAOj0h0UbD9C/pUxU6wB+2jDqluz/NKMiMala9yMKOBQ6DWWb1Is0GXO3pc5/kCA49CnpbK2OUClNKF1+WgMJuarJprYiTbYwYKF5ZdguAyYRbCkxDFx7OaoWGU0qm38iYJ9/lo2IhqkLIM3xjxGzxom+Fkyq+9IBiyRb8qWd7Hs3C1t1fkgRM8NKmvy47hy11J0GrEM2r4hPVoPTQasP5W5NH8rb7DMwMBRy0yGYMsXwq8+9KZaYGhTSBgZN931/o0lHvhXT4/u6sKLIbG3PInjgNGAyJr0y6gPe4tdgY8ivVIwooaJMF9tRuIa9y9T9Py3ktu6yDOTduvHiefecYZG5U9E4hfDg4rjBFYX/fghIAtWOrdQ5q6jHE99IVkHh9Y880JkQPAYZGiMmkcnaVCow3pxb2UW+9zgYD+FR/p8sw3hg2RP GGfOVmvx aSU/yBV7IDqWw5pUsTVBe+8pwLJcs0S69GuyV7jpxzKHvGkgz0hkSYvYMC23RyhFznQBZx94ocYkDGva3G03+TCsqO33EKi0c5skphWjqN8VU2ZMd5JT0BtNyzg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Jun 13 2023 at 14:58, Eric DeVolder wrote: > On 6/13/23 10:24, Eric DeVolder wrote: >> On 6/13/23 03:03, Greg KH wrote: >>> All of these #ifdefs should all be removed and instead use the >>> is_visible() callback to determine if the attribute is shown or not, >>> using the IS_ENABLED() test in the function. >> >> ok, I'll correct this. > > I've been examining drivers/base/cacheinfo.c as a template for how to remove the > #ifdefs and use the is_visible() callback for the drivers/base/cpu|memory.c files. > > I'm attempting to apply this technique to drivers/base/cpu.c. In this file, there > are features that are compiled in/out based on the CONFIG settings, for example > CONFIG_ARCH_CPU_PROBE_RELEASE. My attempts at applying the technique thus far have > resulted in link-time errors for missing symbols, ie. arch_cpu_probe() and > arch_cpu_release(). > > As I understand it, to use IS_ENABLED(XYZ) to guard-band conditional code, the contents > of that code still needs to be compile-able (eg. no references to struct members with > surrounding #ifdef CONFIG_XYZ) and link-able (eg. any called functions must also be > compiled). You can't obviously reference anything which is #ifdeffed out in a data structure. But functions is a different story. All you needs is a declaration. void foo(void); if (IS_ENABLED(FOO)) foo(); Builds correctly if FOO=n and foo() is not built in. The wonders of dead code elimination. Thanks, tglx