Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2813774imc; Wed, 13 Mar 2019 01:51:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqxNy2aAGpy5EOTnpLofR51ytPadaEVon+vDEyWJpllO9dHYuyk8tkbQQvDIpOcX8tXX+8y+ X-Received: by 2002:a65:538e:: with SMTP id x14mr9045475pgq.79.1552467085871; Wed, 13 Mar 2019 01:51:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552467085; cv=none; d=google.com; s=arc-20160816; b=nI2tNxBkJICVUqDb6PwCooOqfu3bEZqH+BtOoxTA0oWSpFN2dBmn9GtPa7l3MfDdUO fdtgxwumwXbbpVVU2bXMP2TGoZKoYfbgsUH/fQKostLR09a6JEV6NynI0D3NKV/I2K7h lQidmSwH6PQfSdWFKFZYNmE3HceyYjVyA1Z257uEoirniMlpzQPOuDSAFFVLM4W6g2Kl wGXb0gIsTu3EpiL1UTRvOc0ZpPtV62UhFpET+B/HA40HDPd0lsLuHLutchg/waFBcnuu iilh7ZQ98deJTHSupg3AB9ePzmhxfymSE/YIzaHoIud/9D0mndQACi53QkYLn1hbubFD YYRQ== 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=wIlC8Qe3joBYFDGVrVtv6Kyx/XUfuMmMl4M9Rn7GZEk=; b=vjx58TwnI4Nnhx12YoUvwxDoupuXVgbjx8bLW8hgbU8VrbdePwBk7HnHUbaRvO3sCv TSVXsi62RvLjb9aEWWAFj9bp8Ty92vwpUOzkRv1qEpTj+u5PyU15kSCJpaApvHMzCuEo CQ6lqO6MmSF4W28pBVyZeA7qr12Bh6ZtDeuEfaWz3FLpJc2kI9FdFCpNqFhX0yMH4CJx RtdczsRS2nXlwSIs50Glz+OJWXYpi4C8fmYY1NX65lSYt7c56DB7B92O+2NIP86OyZvb dvEoliCLLKr4+ZIxfWK9mkouSn7+WjQQAjrNQn9TmsbJYmnjF+TCh9+5adAuijklE3NE IF1A== 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 l9si10691897plb.216.2019.03.13.01.51.09; Wed, 13 Mar 2019 01:51:25 -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 S1726951AbfCMIuu (ORCPT + 99 others); Wed, 13 Mar 2019 04:50:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44216 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726692AbfCMIut (ORCPT ); Wed, 13 Mar 2019 04:50:49 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 161A944835; Wed, 13 Mar 2019 08:50:49 +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 A3E931B428; Wed, 13 Mar 2019 08:50:47 +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> <1dfe1a2e-f6f9-2d5d-a38e-ba4517794bad@redhat.com> <6f089371-29e6-6fa9-379d-76d3a87e2b8b@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 CQoLBBYCAwECHgECF4AAC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<8a22d3a7-f574-19f1-46d0-a54a5343dec8@redhat.com> Date: Wed, 13 Mar 2019 09:50:46 +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: <6f089371-29e6-6fa9-379d-76d3a87e2b8b@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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 13 Mar 2019 08:50:49 +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 09:28, Christophe Leroy wrote: > > > Le 13/03/2019 à 09:01, Laurent Vivier a écrit : >> 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? > > No, and that's the reason why I said it could be done in another > (future) patch. > > Anyway, your patch should be clean regarding checkpatch > > See https://patchwork.ozlabs.org/patch/1052984/ > And > https://openpower.xyz/job/snowpatch/job/snowpatch-linux-checkpatch/3298//artifact/linux/checkpatch.log > > > CHECK:AVOID_EXTERNS: extern prototypes should be avoided in .h files > #31: FILE: arch/powerpc/include/asm/sparsemem.h:20: > +extern int resize_hpt_for_hotplug(unsigned long new_mem_size); > > CHECK:LOGICAL_CONTINUATIONS: Logical continuations should be on the > previous line > #70: FILE: arch/powerpc/mm/hash_utils_64.c:776: >      if ((target_hpt_shift > ppc64_pft_size) > +        || (target_hpt_shift < (ppc64_pft_size - 1))) > It's really strange, from linux directory: ./scripts/checkpatch.pl 0001-powerpc-mm-move-warning-from-resize_hpt_for_hotplug.patch doesn't output this error [1]. Why linux-ppc doesn't use the same script as in the kernel directory? Anyway, I send a v3. Thanks, Laurent [1] only: WARNING: line over 80 characters #34: FILE: arch/powerpc/include/asm/sparsemem.h:22: +static inline int resize_hpt_for_hotplug(unsigned long new_mem_size) { return 0; } total: 0 errors, 1 warnings, 70 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. 0001-powerpc-mm-move-warning-from-resize_hpt_for_hotplug.patch has style problems, please review. NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. But I think it's cleaner to keep the over 80 characters line for the inline.