Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5813181imb; Fri, 8 Mar 2019 02:57:48 -0800 (PST) X-Google-Smtp-Source: APXvYqwOqYrS/xE94y6XRuG8aAxL4MSP5V4v/Rb5fvai8wO+gTY24jgLe9Gi8rcRZmd6pUHkOG92 X-Received: by 2002:a63:c5c:: with SMTP id 28mr3481306pgm.353.1552042668788; Fri, 08 Mar 2019 02:57:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552042668; cv=none; d=google.com; s=arc-20160816; b=PX6b9bWd3GjfqOjSujyzCPzMlaCM74X4Ge25JjXaUiXS80zXE4WkCDirBVO2MC3isO S6LuNXEHMDYPJnvg40x9nHnLLbwDaffob7G4pRpwKEXIjpQ1cdWU7Q1IzmIwFQ/TqBsc HuaTrfl5klhPOzWhZ9+X7+hhB73UELWKXU8YBcBbJJMQAaaJ8XQpvS+TCGhTh9c2SDtj OPI1lIN16lQLRIUgjLAM0V7R4gpoRxwXOoMGj2i4wSq6divxyACKge/RW9V8Wzrg7FJE bQ91e4B3SFRK54oHlKAc5L8ZuxwIvP6XPrbvr242Kq+ss6b3HnUGDnku1j6z4Q8/XYoG 5Nag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=nKhtdcpBUx715tzr3wFOrwPIyWvXa3p08QZ3QuuO/EI=; b=N+4/WNvHMBqaVzIJT4UHXYbUDdCOni6iydkYb8m4Px4KJjom35wHKEGSBKgIZsN2KP Knzrz0Apjq2Mg3MflzUKrE8LMoKfdw58GIZIhbKZy+hk4tfgfN2d6oDkT+81m2mitH1j EEVpB+vnZLs5QlNR5W2RiWgX/sfsa5ZPXs0qpc5mXkoese6o7HqFONxeErPkhIjWLxgD s2VX0sZdJhJgXog7bOPq4q+TrizuiP3JmM/DgXkbaljjGJ+E5gs5doSV+EZ78JPFRYxt d3CnOAsBrpc29QnGWeG7DJtE7RJtNoppPj+HgzirOAh6xFUy6NWOii7HC0ka7dGjEzfD Qbqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f132si6185750pgc.538.2019.03.08.02.57.32; Fri, 08 Mar 2019 02:57:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726305AbfCHKyR (ORCPT + 99 others); Fri, 8 Mar 2019 05:54:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52140 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726249AbfCHKyR (ORCPT ); Fri, 8 Mar 2019 05:54:17 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 21AF059476; Fri, 8 Mar 2019 10:54:17 +0000 (UTC) Received: from thinkpad.redhat.com (ovpn-204-24.brq.redhat.com [10.40.204.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id CDC0560141; Fri, 8 Mar 2019 10:54:14 +0000 (UTC) From: Laurent Vivier To: linux-kernel@vger.kernel.org Cc: Michael Ellerman , linuxppc-dev@lists.ozlabs.org, David Gibson , Christophe Leroy , Laurent Vivier Subject: [PATCH v2] powerpc/mm: move warning from resize_hpt_for_hotplug() Date: Fri, 8 Mar 2019 11:54:13 +0100 Message-Id: <20190308105413.4302-1-lvivier@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 08 Mar 2019 10:54:17 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Laurent Vivier --- arch/powerpc/include/asm/sparsemem.h | 4 ++-- arch/powerpc/mm/hash_utils_64.c | 17 ++++++----------- arch/powerpc/mm/mem.c | 3 ++- arch/powerpc/platforms/pseries/lpar.c | 3 ++- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/arch/powerpc/include/asm/sparsemem.h b/arch/powerpc/include/asm/sparsemem.h index 68da49320592..3192d454a733 100644 --- a/arch/powerpc/include/asm/sparsemem.h +++ b/arch/powerpc/include/asm/sparsemem.h @@ -17,9 +17,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); #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) { return 0; } #endif #ifdef CONFIG_NUMA diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c index 0cc7fbc3bd1c..40bb2a8326bb 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c @@ -755,12 +755,12 @@ static unsigned long __init htab_get_table_size(void) } #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; if (!mmu_hash_ops.resize_hpt) - return; + return 0; target_hpt_shift = htab_shift_for_mem_size(new_mem_size); @@ -773,15 +773,10 @@ void resize_hpt_for_hotplug(unsigned long new_mem_size) * current shift */ if ((target_hpt_shift > ppc64_pft_size) - || (target_hpt_shift < (ppc64_pft_size - 1))) { - int rc; - - rc = mmu_hash_ops.resize_hpt(target_hpt_shift); - if (rc && (rc != -ENODEV)) - printk(KERN_WARNING - "Unable to resize hash page table to target order %d: %d\n", - target_hpt_shift, rc); - } + || (target_hpt_shift < (ppc64_pft_size - 1))) + return mmu_hash_ops.resize_hpt(target_hpt_shift); + + return 0; } 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 33cc6f676fa6..0d40d970cf4a 100644 --- a/arch/powerpc/mm/mem.c +++ b/arch/powerpc/mm/mem.c @@ -169,7 +169,8 @@ int __meminit arch_remove_memory(int nid, u64 start, u64 size, */ vm_unmap_aliases(); - resize_hpt_for_hotplug(memblock_phys_mem_size()); + if (resize_hpt_for_hotplug(memblock_phys_mem_size()) == -ENOSPC) + pr_warn("Hash collision while resizing HPT\n"); return ret; } diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index f2a9f0adc2d3..1034ef1fe2b4 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c @@ -901,8 +901,10 @@ static int pseries_lpar_resize_hpt(unsigned long shift) break; 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); @@ -918,7 +920,6 @@ static int pseries_lpar_resize_hpt(unsigned long shift) if (rc != 0) { switch (state.commit_rc) { case H_PTEG_FULL: - pr_warn("Hash collision while resizing HPT\n"); return -ENOSPC; default: -- 2.20.1