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 8B2B7C54EE9 for ; Tue, 27 Sep 2022 12:54:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CA6E68E00D0; Tue, 27 Sep 2022 08:54:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C2FA48E00C1; Tue, 27 Sep 2022 08:54:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AA8D68E00D0; Tue, 27 Sep 2022 08:54:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 986D48E00C1 for ; Tue, 27 Sep 2022 08:54:01 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 65B7E1A0390 for ; Tue, 27 Sep 2022 12:54:01 +0000 (UTC) X-FDA: 79957857882.13.6E9DFA7 Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) by imf21.hostedemail.com (Postfix) with ESMTP id D30B41C0005 for ; Tue, 27 Sep 2022 12:53:59 +0000 (UTC) Date: Tue, 27 Sep 2022 21:53:50 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1664283238; 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=xlZJ/Kh6cvan+YPeLMPgG+E2Ues2lCHrz7rn9R03zos=; b=W1atcqI3NaWtFt0xWb+YaT32TTC/fiDYeOgL8A2SZV8DsySbiuZmRJAH16HMPoGeQpvoO1 DcN2TfRZxSTK7eGB2kbbrB81YuGIqFGAMjSRZ0AYS7eoeR+sT7fuqDjTnbGKSsGZF6tQ3K +oi4mf6siSvuC2qneEMcYzgNWOWyXzQ= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Naoya Horiguchi To: Hui Tang Cc: naoya.horiguchi@nec.com, linmiaohe@huawei.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/hwpoison: fix build error without CONFIG_MEMORY_FAILURE Message-ID: <20220927125350.GA500539@u2004.lan> References: <20220927102946.98622-1-tanghui20@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220927102946.98622-1-tanghui20@huawei.com> X-Migadu-Flow: FLOW_OUT ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664283240; 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=xlZJ/Kh6cvan+YPeLMPgG+E2Ues2lCHrz7rn9R03zos=; b=pGqvim0FSyComzgj/w/S+QYjOplZab1QU1vZc5Mg34jtIm2cbqxm+2YThHsFCzgmg+iw2t l+omVLXYOcvTIuvWN2H80K0A8mJEDlpXNbsWmq6GXI5IZ2vCG1oohF1oYvOD7hXXda6aKR U7xQn9NGXDOQt5VH+Oi8FDaArn9afSQ= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=W1atcqI3; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf21.hostedemail.com: domain of naoya.horiguchi@linux.dev designates 94.23.1.103 as permitted sender) smtp.mailfrom=naoya.horiguchi@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664283240; a=rsa-sha256; cv=none; b=8fH+j/4xStE+hrYVfk5gTFcJqEJeXwAAYoPDAWjtPCjw1gYkNbEfZcDQAvNy8rUCgY7iY2 XWrjdZaQV5ZaWTnMDUG0F786fyroANrD6OHqHVVylsXbHz9a0ln4zBwnXw1kIiLmZDAdNR DKnzvrMkLB4l5SeaVWBV4Im9jHbOABI= X-Rspam-User: Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=W1atcqI3; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf21.hostedemail.com: domain of naoya.horiguchi@linux.dev designates 94.23.1.103 as permitted sender) smtp.mailfrom=naoya.horiguchi@linux.dev X-Stat-Signature: qxsuriztzbo9sjtcfgpwp48fx7iej9ig X-Rspamd-Queue-Id: D30B41C0005 X-Rspamd-Server: rspam02 X-HE-Tag: 1664283239-314454 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, Sep 27, 2022 at 06:29:46PM +0800, Hui Tang wrote: > Building without CONFIG_MEMORY_FAILURE will fail: > > mm/memory-failure.o: In function `action_result': > memory-failure.c: undefined reference to `memblk_nr_poison_inc' > mm/memory-failure.o: In function `page_handle_poison': > memory-failure.c: undefined reference to `memblk_nr_poison_inc' > mm/memory-failure.o: In function `__get_huge_page_for_hwpoison': > memory-failure.c: undefined reference to `memblk_nr_poison_inc' > mm/memory-failure.o: In function `unpoison_memory': > memory-failure.c: undefined reference to `memblk_nr_poison_sub' > mm/memory-failure.o: In function `num_poisoned_pages_inc': > memory-failure.c: undefined reference to `memblk_nr_poison_inc' > > Add CONFIG_MEMORY_FAILURE wrapper for invoking memblk_nr_poison_{inc|sub}. > > Fixes: 69b496f03bb4 ("mm/hwpoison: introduce per-memory_block hwpoison counter") > Signed-off-by: Hui Tang Thank you for the patch. I have a question. If you disables CONFIG_MEMORY_FAILURE, mm/memory-failure.c should not be compiled, so I wonder why you saw the compile error. Could you share your .config file? Acutally I saw the similar report a few days ago https://lore.kernel.org/lkml/20220923095013.1151252-1-michael@walle.cc/ , where the build error happened in aarch64, so I likely missed some arch dependency. I responded to the report by updating the patch by applying "#if defined(CONFIG_MEMORY_FAILURE) && defined(CONFIG_MEMORY_HOTPLUG)" to the definition of memblk_nr_poison_{inc,sub}. https://lore.kernel.org/lkml/20220923141204.GA1484969@ik1-406-35019.vs.sakura.ne.jp/ I did not confirm that this fix is really right, because I can't reproduced the build error in my environment. So could you check that v5 patch fixes the build error you're seeing? (The current version in mm-unstable is v4, so that should be replaced with v5.) Thanks, Naoya Horiguchi > --- > mm/memory-failure.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/mm/memory-failure.c b/mm/memory-failure.c > index 03479895086d..5bb9d2d20234 100644 > --- a/mm/memory-failure.c > +++ b/mm/memory-failure.c > @@ -77,14 +77,18 @@ static bool hw_memory_failure __read_mostly = false; > void num_poisoned_pages_inc(unsigned long pfn) > { > atomic_long_inc(&num_poisoned_pages); > +#ifdef CONFIG_MEMORY_FAILURE > memblk_nr_poison_inc(pfn); > +#endif > } > > static inline void num_poisoned_pages_sub(unsigned long pfn, long i) > { > atomic_long_sub(i, &num_poisoned_pages); > +#ifdef CONFIG_MEMORY_FAILURE > if (pfn != -1UL) > memblk_nr_poison_sub(pfn, i); > +#endif > } > > /* > -- > 2.17.1 > > >