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=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 2AB37C33CB2 for ; Wed, 15 Jan 2020 15:34:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CA7412053B for ; Wed, 15 Jan 2020 15:34:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MRx9CLHz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CA7412053B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 49C7B8E0014; Wed, 15 Jan 2020 10:34:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 44C5F8E0003; Wed, 15 Jan 2020 10:34:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 33B178E0014; Wed, 15 Jan 2020 10:34:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0136.hostedemail.com [216.40.44.136]) by kanga.kvack.org (Postfix) with ESMTP id 2008E8E0003 for ; Wed, 15 Jan 2020 10:34:23 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id 89B98824805A for ; Wed, 15 Jan 2020 15:34:22 +0000 (UTC) X-FDA: 76380265164.14.frame34_433f2a5427532 X-HE-Tag: frame34_433f2a5427532 X-Filterd-Recvd-Size: 6804 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Wed, 15 Jan 2020 15:34:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579102461; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6teOtbquXm59JdJEc1P6I3LcG8zTWm5GuYDX9NVmUbc=; b=MRx9CLHzVfX/pYhPsjMT0ACUA9KHRDFXnG4JII2eXleNz2e9ViyJnPSeR57BO9fwtiM+Rq 5KYzNALQIAv7w6bIKxs7AiglvCEy7EFipAu82jJWr0/kgYyclr2GSmaVG3YAPTlYRV2EA1 xKkZo6mundvpd0EdmlVjRUB3hyTCj7g= 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-159-Kd3EKNLtNba2gDXN-_fF6Q-1; Wed, 15 Jan 2020 10:34:18 -0500 X-MC-Unique: Kd3EKNLtNba2gDXN-_fF6Q-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A0A388C4365; Wed, 15 Jan 2020 15:34:16 +0000 (UTC) Received: from t480s.redhat.com (unknown [10.36.118.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6FA5586CB2; Wed, 15 Jan 2020 15:34:14 +0000 (UTC) From: David Hildenbrand To: stable@vger.kernel.org Cc: linux-mm@kvack.org, Oscar Salvador , Michal Hocko , "Aneesh Kumar K . V" , Greg Kroah-Hartman , Dan Williams , Andrew Morton , Laurent Vivier , Baoquan He , David Hildenbrand Subject: [PATCH for 4.19-stable 12/25] powerpc/mm: move warning from resize_hpt_for_hotplug() Date: Wed, 15 Jan 2020 16:33:26 +0100 Message-Id: <20200115153339.36409-13-david@redhat.com> In-Reply-To: <20200115153339.36409-1-david@redhat.com> References: <20200115153339.36409-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Content-Transfer-Encoding: quoted-printable 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: commit f172acbfae1a78b1a3c775f78e8d0dcd15b9d768 upstream. resize_hpt_for_hotplug() reports a warning when it cannot resize the hash page table ("Unable to resize hash page table to target order") but in some cases it's not a problem and can make user thinks something has not worked properly. This patch moves the warning to arch_remove_memory() to only report the problem when it is needed. Reviewed-by: David Gibson Signed-off-by: Laurent Vivier Reviewed-by: Christophe Leroy Signed-off-by: Michael Ellerman Signed-off-by: David Hildenbrand --- arch/powerpc/include/asm/sparsemem.h | 4 ++-- arch/powerpc/mm/hash_utils_64.c | 19 +++++++------------ arch/powerpc/mm/mem.c | 3 ++- arch/powerpc/platforms/pseries/lpar.c | 3 ++- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/arch/powerpc/include/asm/sparsemem.h b/arch/powerpc/include/= asm/sparsemem.h index 28f5dae25db6..b37c802d669c 100644 --- a/arch/powerpc/include/asm/sparsemem.h +++ b/arch/powerpc/include/asm/sparsemem.h @@ -28,9 +28,9 @@ extern int create_section_mapping(unsigned long start, = unsigned long end, int ni extern int remove_section_mapping(unsigned long start, unsigned long end= ); =20 #ifdef CONFIG_PPC_BOOK3S_64 -extern void resize_hpt_for_hotplug(unsigned long new_mem_size); +extern int resize_hpt_for_hotplug(unsigned long new_mem_size); #else -static inline void resize_hpt_for_hotplug(unsigned long new_mem_size) { = } +static inline int resize_hpt_for_hotplug(unsigned long new_mem_size) { r= eturn 0; } #endif =20 #ifdef CONFIG_NUMA diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils= _64.c index 8894c8f300ea..a5ce7082cb5f 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c @@ -764,12 +764,12 @@ static unsigned long __init htab_get_table_size(voi= d) } =20 #ifdef CONFIG_MEMORY_HOTPLUG -void resize_hpt_for_hotplug(unsigned long new_mem_size) +int resize_hpt_for_hotplug(unsigned long new_mem_size) { unsigned target_hpt_shift; =20 if (!mmu_hash_ops.resize_hpt) - return; + return 0; =20 target_hpt_shift =3D htab_shift_for_mem_size(new_mem_size); =20 @@ -781,16 +781,11 @@ void resize_hpt_for_hotplug(unsigned long new_mem_s= ize) * reduce unless the target shift is at least 2 below the * current shift */ - if ((target_hpt_shift > ppc64_pft_size) - || (target_hpt_shift < (ppc64_pft_size - 1))) { - int rc; - - rc =3D mmu_hash_ops.resize_hpt(target_hpt_shift); - if (rc && (rc !=3D -ENODEV)) - printk(KERN_WARNING - "Unable to resize hash page table to target order %d: %d\n", - target_hpt_shift, rc); - } + if (target_hpt_shift > ppc64_pft_size || + target_hpt_shift < ppc64_pft_size - 1) + return mmu_hash_ops.resize_hpt(target_hpt_shift); + + return 0; } =20 int hash__create_section_mapping(unsigned long start, unsigned long end,= int nid) diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c index 625d78547fe7..e27e5bc958b4 100644 --- a/arch/powerpc/mm/mem.c +++ b/arch/powerpc/mm/mem.c @@ -170,7 +170,8 @@ int __ref arch_remove_memory(int nid, u64 start, u64 = size, */ vm_unmap_aliases(); =20 - resize_hpt_for_hotplug(memblock_phys_mem_size()); + if (resize_hpt_for_hotplug(memblock_phys_mem_size()) =3D=3D -ENOSPC) + pr_warn("Hash collision while resizing HPT\n"); =20 return ret; } diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platfor= ms/pseries/lpar.c index 49e3a88b6a0c..51f0107950b3 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c @@ -693,8 +693,10 @@ static int pseries_lpar_resize_hpt(unsigned long shi= ft) break; =20 case H_PARAMETER: + pr_warn("Invalid argument from H_RESIZE_HPT_PREPARE\n"); return -EINVAL; case H_RESOURCE: + pr_warn("Operation not permitted from H_RESIZE_HPT_PREPARE\n"); return -EPERM; default: pr_warn("Unexpected error %d from H_RESIZE_HPT_PREPARE\n", rc); @@ -711,7 +713,6 @@ static int pseries_lpar_resize_hpt(unsigned long shif= t) if (rc !=3D 0) { switch (state.commit_rc) { case H_PTEG_FULL: - pr_warn("Hash collision while resizing HPT\n"); return -ENOSPC; =20 default: --=20 2.24.1