From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758737AbdJRDJe (ORCPT ); Tue, 17 Oct 2017 23:09:34 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:8517 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752381AbdJRDJc (ORCPT ); Tue, 17 Oct 2017 23:09:32 -0400 Subject: Re: [PATCH v5 1/2] acpi: apei: remove the unused dead-code for SEA/NMI notification type To: Borislav Petkov CC: , , , , , , , , , , , , , , , , , , , Wuquanming , Huangshaoyu References: <1508227341-15651-1-git-send-email-gengdongjiu@huawei.com> <20171017164336.cedso3f35lpeam7f@pd.tnic> From: gengdongjiu Message-ID: <642709ec-05d0-2ffd-0e2e-bcdd6b12281b@huawei.com> Date: Wed, 18 Oct 2017 11:04:28 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20171017164336.cedso3f35lpeam7f@pd.tnic> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.142.68.147] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.59E6C5D0.005F,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 00b2bbb08f0ada47a2e6641ffa76faba Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi,Borislav On 2017/10/18 0:43, Borislav Petkov wrote: >> -} >> - > So GHES NMI notification method is x86-only AFAIK and HAVE_ACPI_APEI_NMI > is selected only on x86. Why are you removing those guards? Does ARM > have ACPI_HEST_NOTIFY_NMI notification type now too? ARM does not have ACPI_HEST_NOTIFY_NMI notification, which should only used by x86. In the code, I see those guards are never used. As you see, if the 'CONFIG_HAVE_ACPI_APEI_NMI' does not defined in [1], it will print error info and goto [2], in the [2], it will return error, then the probe for GHES NMI is failed. so those guards( ghes_nmi_add() and ghes_nmi_remove()) have no chance to execute. so I redefine them to NULL for compiling[3]. static int ghes_probe(struct platform_device *ghes_dev) { struct acpi_hest_generic *generic; struct ghes *ghes = NULL; int rc = -EINVAL; switch (generic->notify.type) { ................... case ACPI_HEST_NOTIFY_NMI: [1] if (!IS_ENABLED(CONFIG_HAVE_ACPI_APEI_NMI)) { pr_warn(GHES_PFX "Generic hardware error source: %d notified via NMI interrupt is not supported!\n", generic->header.source_id); goto err; } .............. } switch (generic->notify.type) { ............... case ACPI_HEST_NOTIFY_NMI: ghes_nmi_add(ghes); break; } .......... err: [2] if (ghes) { ghes_fini(ghes); kfree(ghes); } return rc; } [3]: -static inline void ghes_nmi_add(struct ghes *ghes) -{ - pr_err(GHES_PFX "ID: %d, trying to add NMI notification which is not supported!\n", - ghes->generic->header.source_id); - BUG(); -} - -static inline void ghes_nmi_remove(struct ghes *ghes) -{ - pr_err(GHES_PFX "ID: %d, trying to remove NMI notification which is not supported!\n", - ghes->generic->header.source_id); - BUG(); -} - -static inline void ghes_nmi_init_cxt(void) -{ -} +static inline void ghes_nmi_add(struct ghes *ghes) { } +static inline void ghes_nmi_remove(struct ghes *ghes) { } +static inline void ghes_nmi_init_cxt(void) { }