Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2788639imc; Wed, 13 Mar 2019 01:04:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqwlN0YEQNvQgdfdwr6UuprqvUleHMYE4bB3Vp8vumcs2pAz6hGXNVBmiBq+QkGZ+QkiMSCH X-Received: by 2002:a17:902:e192:: with SMTP id cd18mr45200470plb.309.1552464255346; Wed, 13 Mar 2019 01:04:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552464255; cv=none; d=google.com; s=arc-20160816; b=Vxinkhb4oMuE6ijyILUMLNy46emZX+5HoKpikLyHoWNkklr0Ug4AmKCGVkkj4BDl1t jds7JrOAB2UxbWQKPsZ51DDtLTyk6EdieN/zzPbsZKQ4BUeTvxOTz9bvfFFWW8BGh23v 1rcOUNalzVAcbytsuPdHEFUiBDuyCXloRiZstXjzW1pbqADLT8NHZYKoFoBb9U4rZ64D +0BTALEZLsJUK86kDckYXlI+BHl6f7EhZWzMpsI7pFVlXpGh0jeRAqmj6nwhvGhcH6O4 m4OZTe5E0pgS6PKVOnAkILNiPUDf3eIHK68olrs+uh3bWfRMnIPmXdWOL2MUjx5XqNhf sXYw== 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:autocrypt:openpgp:from:references:cc:to:subject; bh=2MZj2t9EZUf/vgsdmCaOl4TfaZ+0Nm9gVYI2SLHjVf8=; b=MjvmOdlEgD/HqIA1oKmborsSgdvqtUySXTFsn9cvnAKm13hMvlrPbzE85TUI+Aa2rY x3xLh+DjBFEDgJEoGlGhvfRF9leO0u9gx0jRtxDMnDf+5FzSGmLl7mnpMsgcGcVWTLM/ gA7hCB+b69Mr3QVw/R/76VGCDHugtS+fcHKkH/MrrujzdkbI8HFoguS2u8ohNpBt0wlg D/J6T0zQYHrnn8ZiEZ5w45aMpc2E2utxrHld2pD10l4JgKuBfz/ZewDuMWYTfENqxnX9 QPJ2uPv9ygMMTTNitH1TOriAhgUxv35UB/OJZudYW/EKDEuiOJWXtLzlmKb947SIIXTG QswA== 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 b11si9224712pgt.234.2019.03.13.01.03.59; Wed, 13 Mar 2019 01:04:15 -0700 (PDT) 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 S1727123AbfCMICD (ORCPT + 99 others); Wed, 13 Mar 2019 04:02:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34417 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726539AbfCMICC (ORCPT ); Wed, 13 Mar 2019 04:02:02 -0400 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 3D5A6C06A7F0; Wed, 13 Mar 2019 08:02:02 +0000 (UTC) Received: from [10.36.116.28] (ovpn-116-28.ams2.redhat.com [10.36.116.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9064E4149; Wed, 13 Mar 2019 08:01:59 +0000 (UTC) Subject: Re: [PATCH v2] powerpc/mm: move warning from resize_hpt_for_hotplug() To: Christophe Leroy , linux-kernel@vger.kernel.org Cc: Michael Ellerman , linuxppc-dev@lists.ozlabs.org, David Gibson References: <20190308105413.4302-1-lvivier@redhat.com> <3db6b64d-02d3-8aa7-80ca-3e469ea743ff@c-s.fr> From: Laurent Vivier Openpgp: preference=signencrypt Autocrypt: addr=lvivier@redhat.com; prefer-encrypt=mutual; keydata= mQINBFYFJhkBEAC2me7w2+RizYOKZM+vZCx69GTewOwqzHrrHSG07MUAxJ6AY29/+HYf6EY2 WoeuLWDmXE7A3oJoIsRecD6BXHTb0OYS20lS608anr3B0xn5g0BX7es9Mw+hV/pL+63EOCVm SUVTEQwbGQN62guOKnJJJfphbbv82glIC/Ei4Ky8BwZkUuXd7d5NFJKC9/GDrbWdj75cDNQx UZ9XXbXEKY9MHX83Uy7JFoiFDMOVHn55HnncflUncO0zDzY7CxFeQFwYRbsCXOUL9yBtqLer Ky8/yjBskIlNrp0uQSt9LMoMsdSjYLYhvk1StsNPg74+s4u0Q6z45+l8RAsgLw5OLtTa+ePM JyS7OIGNYxAX6eZk1+91a6tnqfyPcMbduxyBaYXn94HUG162BeuyBkbNoIDkB7pCByed1A7q q9/FbuTDwgVGVLYthYSfTtN0Y60OgNkWCMtFwKxRaXt1WFA5ceqinN/XkgA+vf2Ch72zBkJL RBIhfOPFv5f2Hkkj0MvsUXpOWaOjatiu0fpPo6Hw14UEpywke1zN4NKubApQOlNKZZC4hu6/ 8pv2t4HRi7s0K88jQYBRPObjrN5+owtI51xMaYzvPitHQ2053LmgsOdN9EKOqZeHAYG2SmRW LOxYWKX14YkZI5j/TXfKlTpwSMvXho+efN4kgFvFmP6WT+tPnwARAQABtCNMYXVyZW50IFZp dmllciA8bHZpdmllckByZWRoYXQuY29tPokCOAQTAQIAIgUCVgVQgAIbAwYLCQgHAwIGFQgC CQoLBBYCAwECHgECF4AACgkQ8ww4vT8vvjwpgg//fSGy0Rs/t8cPFuzoY1cex4limJQfReLr SJXCANg9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09:01:51 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <3db6b64d-02d3-8aa7-80ca-3e469ea743ff@c-s.fr> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit 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.32]); Wed, 13 Mar 2019 08:02:02 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13/03/2019 07:03, Christophe Leroy wrote: > > > Le 08/03/2019 à 11:54, Laurent Vivier a écrit : >> 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))) > > The || should go on the line above and the two (target_hpt... should be > aligned, and the () after the < are superflous. > > And indeed, we should (in another patch) rename 'target_hpt_shift' with > a shorter name, this would avoid multiple lines. > > Ref > https://www.kernel.org/doc/html/latest/process/coding-style.html#naming : > > LOCAL variable names should be short, and to the point. If you have some > random integer loop counter, it should probably be called i. Calling it > loop_counter is non-productive, if there is no chance of it being > mis-understood. Similarly, tmp can be just about any type of variable > that is used to hold a temporary value. > > If you are afraid to mix up your local variable names, you have another > problem, which is called the function-growth-hormone-imbalance syndrome. > See chapter 6 (Functions). > I'm only removing a warning. Do we really need to rewrite all the code around for that? Thanks, Laurent