Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5786709pxb; Thu, 20 Jan 2022 04:42:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJziQZLFofylnhtyRX9en90P0SW30yIlPCyk0srt8OCiZpuVq8E+nIQnkdrPuqiMpT83H9w5 X-Received: by 2002:a63:8948:: with SMTP id v69mr28845661pgd.155.1642682547777; Thu, 20 Jan 2022 04:42:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642682547; cv=none; d=google.com; s=arc-20160816; b=hR2WuoBLH+Xby55nMPG/7zIQN1DAKwG8DH+aUbO1GNrzKJLIZFCj6ryx/bR6QXRif9 5DK01hie8QqvpWkBeGw2/rBjlFxorPHIkHbNKBegvqy6jFNKLzsjb7E5EzZAxiuiY6fr lugNeoE0l2nTMmqUpkkxwrATzGxAPjiS8EdOQLC419maKzHLuT0Z8njbPjgBmNRWsqAc BoAbtoDK1mSGKN8LgCHdJcCb3gv0KNFx/BJYNmSSqJGewInhT7Ph5hrDVi4wR1J6QiGz mldy8nlB/9jDlpNoz3SPWarwYEVwkiVYaPk45s+LF9VFnMs+lnf8g/JGHIjNK8/fekSt D9Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LbR4j55GFbJfYj1Yk0jJp8bBEo3tIt+J4yoTXBBrIJM=; b=RrPzj/G2WuY2+MgKk8exw86TCjW3UblRBZlcx0theqheDp8hPc/zXTk4r4+V9LnLNu v+zA9MtWxu0cXCg9wB5f4rvkyZZM6GZ/yhJ1YybiB/S4cZFow7ktkTN0qqDyk1rsppeT PSZFlriZtqVGV+W7jZdUfTQwEJM3vUcHh9pEYWfw6gEeSgAHosYTMAPqAeA31O8uXUw0 PkziXn8o9wzBYqGYzIBhoJL7Plvoo7dO3hRXeRZ8nP+mxVdK5qKYPazgGWLA0XnsIby4 Ff9C8osq71xTTiMmV06YjNUqeNHw26vWAAUccgTa+O2dI0dov6yHblFvkq5HXFbI39eC rRkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=khXMs8nO; 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 ip4si10150980pjb.7.2022.01.20.04.41.51; Thu, 20 Jan 2022 04:42:27 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=khXMs8nO; 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 S244918AbiAROVA (ORCPT + 99 others); Tue, 18 Jan 2022 09:21:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244543AbiAROUw (ORCPT ); Tue, 18 Jan 2022 09:20:52 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E59EFC061574 for ; Tue, 18 Jan 2022 06:20:49 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 46353CE19F2 for ; Tue, 18 Jan 2022 14:20:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60690C00446; Tue, 18 Jan 2022 14:20:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642515646; bh=LQnVNXXFkBGvBwIEYlzUC8mACRKwyF7PmpnrofVDnmE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=khXMs8nOsMDKs5MbBbUOYqR0A/rLczE6TVnUebuvjd1p/2kox9EI8UHHK3/EjV30Z ohxTVi74dxt8DMuc247yuDL7XlpUTU0Zx8h9nonZxWsId6kYqmpHC0XIVOLA3xeXAW eLxJcJWMsST1k9ztnKqcMMcgjxgmKJ1NGTpgYlI8lE/i+uFAOa1rMuu5RoDEDEz6wo SSUb1DBt8Hrs4qjX8iLFIZWLnncgw7TBwix/+xt7cI42bgjDT8OXg7e7JtRjocepJ3 oxCpVtpas1q4P4rbAkfT+tu3MbIqUJlCCTdjPERSM3/oTW+JZf6DSlaAj1WDwvVpDO ZU5KAaVkdPuvw== Date: Tue, 18 Jan 2022 22:13:03 +0800 From: Jisheng Zhang To: Baoquan He Cc: Russell King , Catalin Marinas , Will Deacon , Paul Walmsley , Palmer Dabbelt , Albert Ou , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, hpa@zytor.com, Eric Biederman , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, kexec@lists.infradead.org, Alexandre ghiti Subject: Re: [PATCH v2 0/5] kexec: use IS_ENABLED(CONFIG_KEXEC_CORE) instead of #ifdef Message-ID: References: <20211206160514.2000-1-jszhang@kernel.org> <20220116133847.GE2388@MiWiFi-R3L-srv> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220116133847.GE2388@MiWiFi-R3L-srv> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 16, 2022 at 09:38:47PM +0800, Baoquan He wrote: > Hi Jisheng, Hi Baoquan, > > On 12/07/21 at 12:05am, Jisheng Zhang wrote: > > Replace the conditional compilation using "#ifdef CONFIG_KEXEC_CORE" > > by a check for "IS_ENABLED(CONFIG_KEXEC_CORE)", to simplify the code > > and increase compile coverage. > > I go through this patchset, You mention the benefits it brings are > 1) simplity the code; > 2) increase compile coverage; > > For benefit 1), it mainly removes the dummy function in x86, arm and > arm64, right? Another benefit: remove those #ifdef #else #endif usage. Recently, I fixed a bug due to lots of "#ifdefs": http://lists.infradead.org/pipermail/linux-riscv/2021-December/010607.html > > For benefit 2), increasing compile coverage, could you tell more how it > achieves and why it matters? What if people disables CONFIG_KEXEC_CORE in > purpose? Please forgive my poor compiling knowledge. Just my humble opinion, let's compare the code:: #ifdef CONFIG_KEXEC_CORE code block A; #endif If KEXEC_CORE is disabled, code block A won't be compiled at all, the preprocessor will remove code block A; If we convert the code to: if (IS_ENABLED(CONFIG_KEXEC_CORE)) { code block A; } Even if KEXEC_CORE is disabled, code block A is still compiled. Thanks