Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5813458imb; Fri, 8 Mar 2019 02:58:22 -0800 (PST) X-Google-Smtp-Source: APXvYqyF9Tn16D72E2m2akP8jYp6eh9Ymd8qdQIQb/WS+1kynoNzVQjku0onctSlXhnQ36G7SbFU X-Received: by 2002:a17:902:bd96:: with SMTP id q22mr18211312pls.7.1552042702247; Fri, 08 Mar 2019 02:58:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552042702; cv=none; d=google.com; s=arc-20160816; b=EkFe3ymrthR4jwWWtFVBbQSgRL9yzV+aqS9O//j4DZx0CQ/JHBj6ZSqEXmCs+Wvn9j NmpLqS/pRUHwFgRU5IrLvBpnSJdYSqx9j0qvloArsyr+TfMXCVht58n88+PWM6CjTdEu z/E32mEFyKuV+oTG2ZC+2SphYkz3vDBBsQwe/Y8yYCNWgj0+DNKnAAbD/SqDnWFIQPvJ ivyGP+TRaIMWg/+XBNSospuI3apYgOLgyJhrHIpoRb05r5fIy+CdIwUloesj9jHMzVtu 5Z6+9va7Cmt1wB7uBLMbCCWzQt16yLcGdViangEJTsLFyEucBmM33egSz4J+syL79U7f zHoA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=3M1RbwrQWgpjKmXAGDDnkxNOV9fNCDgt2FOa9jI0kY8=; b=fSYjkjsH0srxBXRPxmU+3brpNQYVo411pr+3Gp7nkOIozWwyc3aGQVCWPMqrJX2hQF qxIP85Tvmn3uoIM8eiqVSBk4LLsLZKRDbtyMTRyKu5hwvVbO+7xpFpbFteMpXuOpbS6y qg4h1blIJCf9WwTD8CSHR2mCHFzBmBG5gq7Ljzen4S4cFf7fQ/VOmHh1AASb22e1T3Zp UApyjIokgC6TXvDSPEjTws42NORHEyZVEr7Z5rWLLbzZeEhXw4h/Hp9ELZk+zzGjRe24 6xfos5CH4Tavv8nBPZOkLY/Huf5+IBO945UWlBzOr1WajHbqN0Umx0Xocig3k9AjYMyG RWeA== 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 g8si6140856pgd.52.2019.03.08.02.58.06; Fri, 08 Mar 2019 02:58:22 -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 S1726382AbfCHK4G (ORCPT + 99 others); Fri, 8 Mar 2019 05:56:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34416 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725789AbfCHK4G (ORCPT ); Fri, 8 Mar 2019 05:56:06 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1ADB830EBE80; Fri, 8 Mar 2019 10:56:06 +0000 (UTC) Received: from [10.40.204.24] (ovpn-204-24.brq.redhat.com [10.40.204.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C3D817D61; Fri, 8 Mar 2019 10:56:04 +0000 (UTC) Subject: Re: [PATCH v2] powerpc/mm: move warning from resize_hpt_for_hotplug() To: linux-kernel@vger.kernel.org Cc: Michael Ellerman , linuxppc-dev@lists.ozlabs.org, David Gibson , Christophe Leroy References: <20190308105413.4302-1-lvivier@redhat.com> From: Laurent Vivier Message-ID: Date: Fri, 8 Mar 2019 11:56:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20190308105413.4302-1-lvivier@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Fri, 08 Mar 2019 10:56:06 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I forgot the version change note: v2: add warning messages for H_PARAMETER and H_RESOURCE Thanks, Laurent On 08/03/2019 11:54, Laurent Vivier wrote: > 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: >