From patchwork Mon Feb 10 12:30:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 231712 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham 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 C1071C352A5 for ; Mon, 10 Feb 2020 13:23:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8EB4A2467D for ; Mon, 10 Feb 2020 13:23:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581341013; bh=q22MECh2tbBpJ6O/Km/c9blaEVhuPo3h4WR8kE/HIIo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Dt8v71vGoKUNzm8YpnJzPw73t8wx1kbOTaJVJrZZSnKgiuB6oVJr5edIDYnpJKu8K dYv0Lp4pa0p1RQ0+JyBxAIdp3NpDdfX0/5xn1jyXInhObcd8hQelqBeA8A2X0w4t1T GLtZlSQzbnw0PRe9hhiF62j1OsnweqeJwj4327iY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728740AbgBJNXd (ORCPT ); Mon, 10 Feb 2020 08:23:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:58380 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728111AbgBJMhN (ORCPT ); Mon, 10 Feb 2020 07:37:13 -0500 Received: from localhost (unknown [209.37.97.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CCD7320838; Mon, 10 Feb 2020 12:37:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338232; bh=q22MECh2tbBpJ6O/Km/c9blaEVhuPo3h4WR8kE/HIIo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c14hH678yhh9tEGrt80V8mzaWONM07EaXUlAxHi+B5b4fiOT0bPsbn5/zP9B2+TPx 4mZj6pM/T4MtcUdryD8ByWy29CnL2nUZHanyz73ntQt1OOAX0ifRSBjczYA74hOJic Sj34XnGp45MLqwmaPfOhJtmLgG5AfldOpnMN7R4o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pingfan Liu , Michael Ellerman Subject: [PATCH 5.4 077/309] powerpc/pseries: Advance pfn if section is not present in lmb_is_removable() Date: Mon, 10 Feb 2020 04:30:33 -0800 Message-Id: <20200210122413.245865485@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122406.106356946@linuxfoundation.org> References: <20200210122406.106356946@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Pingfan Liu commit fbee6ba2dca30d302efe6bddb3a886f5e964a257 upstream. In lmb_is_removable(), if a section is not present, it should continue to test the rest of the sections in the block. But the current code fails to do so. Fixes: 51925fb3c5c9 ("powerpc/pseries: Implement memory hotplug remove in the kernel") Cc: stable@vger.kernel.org # v4.1+ Signed-off-by: Pingfan Liu Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/1578632042-12415-1-git-send-email-kernelfans@gmail.com Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/platforms/pseries/hotplug-memory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/arch/powerpc/platforms/pseries/hotplug-memory.c +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c @@ -360,8 +360,10 @@ static bool lmb_is_removable(struct drme for (i = 0; i < scns_per_block; i++) { pfn = PFN_DOWN(phys_addr); - if (!pfn_present(pfn)) + if (!pfn_present(pfn)) { + phys_addr += MIN_MEMORY_BLOCK_SIZE; continue; + } rc &= is_mem_section_removable(pfn, PAGES_PER_SECTION); phys_addr += MIN_MEMORY_BLOCK_SIZE;