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 X-Spam-Level: X-Spam-Status: No, score=-12.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 489BFC4363D for ; Wed, 30 Sep 2020 23:58:47 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E0C802071E for ; Wed, 30 Sep 2020 23:58:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qQV6iB5q"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Bmt1CkiI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E0C802071E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:Reply-To:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HJ0QDPhFc837Nnm82OdS0LZrX/Jm6/OQZsubV3F/bfw=; b=qQV6iB5qXm6WYO beGPf+cfj2tU+WABL8qveTh4DlHH6UdOM5pzLJ+IxqI5TP+s1wbWBpokn6SSObrhJEVaWRFfzXVdS 6k4IiwzPOS307PeqVceu3A1IsgqKrgq6DebBxh7jzrHDLmwqUKINblh+ZGJamT9gOqOZ0bySDhDxC l3U9VZKV+B3GSkwJkLDtw6DBPH64UijQIchIuMaPozx1iwGPj2tEf9p2BKEfra41P9agamqiN+unp t5lYf5dNDdR6hleceAM4cSNOm+BwEJiSrngB9bNEwy/leyPqXOruUVeYsDom6zlLH+J3yBTdhJL+D QhvpKO4+XjESOJv9DU8Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNlyL-0002tg-Kf; Wed, 30 Sep 2020 23:57:21 +0000 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNlyH-0002t5-N6 for linux-arm-kernel@lists.infradead.org; Wed, 30 Sep 2020 23:57:19 +0000 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601510235; h=from:from:reply-to: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MqeVbgO+69UtQ2bq/YXHdjvaVDsQdVwLEYXLr3MlZpM=; b=Bmt1CkiISV8B7C+iugjgGyU3aJzkcIfOna4DZS8Te1/1CPRtMGbLvHdaLBgJsTYe1sIN0r SO1ywUdEZQd2aOqfiK6MOGVHHRrjzkd9kga6rU2sl6n3sfvLIdT3YLBqOottxZPiBhIzh4 +lwx72DJ/5gTtQA9JPGcoBRjF3unpHA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-179-rhfhO-T1PEiTVQZMdag88A-1; Wed, 30 Sep 2020 19:57:12 -0400 X-MC-Unique: rhfhO-T1PEiTVQZMdag88A-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C691B8030B6; Wed, 30 Sep 2020 23:57:10 +0000 (UTC) Received: from [10.64.54.133] (vpn2-54-133.bne.redhat.com [10.64.54.133]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5408E5578D; Wed, 30 Sep 2020 23:57:08 +0000 (UTC) Subject: Re: [PATCH V4 2/3] arm64/mm/hotplug: Enable MEM_OFFLINE event handling To: Anshuman Khandual , linux-arm-kernel@lists.infradead.org References: <1601387687-6077-1-git-send-email-anshuman.khandual@arm.com> <1601387687-6077-3-git-send-email-anshuman.khandual@arm.com> From: Gavin Shan Message-ID: Date: Thu, 1 Oct 2020 09:57:04 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <1601387687-6077-3-git-send-email-anshuman.khandual@arm.com> Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200930_195717_878927_1485B196 X-CRM114-Status: GOOD ( 27.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Gavin Shan Cc: Mark Rutland , Steve Capper , catalin.marinas@arm.com, linux-kernel@vger.kernel.org, Mark Brown , Marc Zyngier , will@kernel.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Anshuman, On 9/29/20 11:54 PM, Anshuman Khandual wrote: > This enables MEM_OFFLINE memory event handling. It will help intercept any > possible error condition such as if boot memory some how still got offlined > even after an explicit notifier failure, potentially by a future change in > generic hot plug framework. This would help detect such scenarios and help > debug further. While here, also call out the first section being attempted > for offline or got offlined. > > Cc: Catalin Marinas > Cc: Will Deacon > Cc: Mark Rutland > Cc: Marc Zyngier > Cc: Steve Capper > Cc: Mark Brown > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Anshuman Khandual > --- > arch/arm64/mm/mmu.c | 29 +++++++++++++++++++++++++++-- > 1 file changed, 27 insertions(+), 2 deletions(-) > This looks good to me except a nit and it can be improved if that looks reasonable and only when you get a chance for respin. Reviewed-by: Gavin Shan > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > index 4e70f4fea06c..90a30f5ebfc0 100644 > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c > @@ -1482,13 +1482,38 @@ static int prevent_bootmem_remove_notifier(struct notifier_block *nb, > unsigned long end_pfn = arg->start_pfn + arg->nr_pages; > unsigned long pfn = arg->start_pfn; > > - if (action != MEM_GOING_OFFLINE) > + if ((action != MEM_GOING_OFFLINE) && (action != MEM_OFFLINE)) > return NOTIFY_OK; > > for (; pfn < end_pfn; pfn += PAGES_PER_SECTION) { > + unsigned long start = PFN_PHYS(pfn); > + unsigned long end = start + (1UL << PA_SECTION_SHIFT); > + > ms = __pfn_to_section(pfn); > - if (early_section(ms)) > + if (!early_section(ms)) > + continue; > + The discussion here is irrelevant to this patch itself. It seems early_section() is coarse, which means all memory detected during boot time won't be hotpluggable? > + if (action == MEM_GOING_OFFLINE) { > + pr_warn("Boot memory [%lx %lx] offlining attempted\n", start, end); > return NOTIFY_BAD; > + } else if (action == MEM_OFFLINE) { > + /* > + * This should have never happened. Boot memory > + * offlining should have been prevented by this > + * very notifier. Probably some memory removal > + * procedure might have changed which would then > + * require further debug. > + */ > + pr_err("Boot memory [%lx %lx] offlined\n", start, end); > + > + /* > + * Core memory hotplug does not process a return > + * code from the notifier for MEM_OFFLINE event. > + * Error condition has been reported. Report as > + * ignored. > + */ > + return NOTIFY_DONE; > + } > } > return NOTIFY_OK; > } > I think NOTIFY_BAD is returned for MEM_OFFLINE wouldn't be a bad idea, even the core isn't handling the errno. With this, the code can be simplified. However, it's not a big deal and you probably evaluate and change when you need another respin: pr_warn("Boot memory [%lx %lx] %s\n", (action == MEM_GOING_OFFLINE) ? "offlining attempted" : "offlined", start, end); return NOTIFY_BAD; Cheers, Gavin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel