Received: by 10.223.185.116 with SMTP id b49csp1982258wrg; Thu, 22 Feb 2018 06:25:19 -0800 (PST) X-Google-Smtp-Source: AH8x227stRZtf+LLp35R8swDuXigPSJpBs+HQ/ck4EiycjI29Dp+i5ibscqSjr0yKblVSrYj3/OB X-Received: by 10.101.68.202 with SMTP id g10mr6002413pgs.210.1519309518926; Thu, 22 Feb 2018 06:25:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519309518; cv=none; d=google.com; s=arc-20160816; b=g6nyeuyaX7NpRCll+AjGGJDFGpNkPNXjeZyebnKFwpAOAI1kOLPlboyJ/kp8IM4YhC flSWHAfY6X+lj/V6bpQGmp/jjKTMJpbTeUu2c1OA4grtmayTZwWenMfz50SCPeZ/UDBO Kq0fL8zblwi4bSCIshFSL4nxSVcAJ4Pbwdsh9lSQ2D1s42tMvrtWuH7srtRrDuom0NNV QcmELd+d3fweWs8PadA6BfEFyqjaEYPXkhwZUCjXt/NH48QKh7NPKqkpUT2vQh1renHS mbmw2IWQ5Emn2jeefeRbEQwhFw5djjuF6caUE1fGZrFnMCP6qVnao1Cdxo5PZtPyZNQb D+vw== 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:arc-authentication-results; bh=aBMj+y9kF1JTksEZqRwoPXHa1bR4Ap/tFCv82Kkq4Pw=; b=LOTcoDbjCm2W+edrqWkbdXEzfeDgmAe4vw3sB6qN/9kFTx0Yw7ln3JHwr7u8jIhwrQ iyKfZyLqTbr+umNPDzkH2OOSbsUs501MQfc5+AfOfjY3XJRoZJVkPtWEZn/BW+PuEYQI 2Ya7zYPXutlYF6ILpv26K3qUa+PYYkOESz4Gn3US3T586r6v27mcj4n5IWLTxfEoSi5x n+6qJHdmmFxGBhhXgjnbAuKyQzEYfCOzJ7FjPrlPnUJisAZZ8III1eV1WO4vPC9K3FeV uGyMxrapBo7MuC+uXKlL9tLB20lJ12U4buaErov8/KzPe5TZN2m4tXWDJLu6O4uZqG7v LQSQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c12-v6si111282plz.700.2018.02.22.06.25.04; Thu, 22 Feb 2018 06:25:18 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932884AbeBVOYG (ORCPT + 99 others); Thu, 22 Feb 2018 09:24:06 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:57912 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932638AbeBVOYC (ORCPT ); Thu, 22 Feb 2018 09:24:02 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 3znGn02Xk9z9twmY; Thu, 22 Feb 2018 15:23:48 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id EXy1Nwcqa8s5; Thu, 22 Feb 2018 15:23:48 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 3znGn022CMz9twm7; Thu, 22 Feb 2018 15:23:48 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 46CD38BB38; Thu, 22 Feb 2018 15:24:01 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id wYlqMUhuND_l; Thu, 22 Feb 2018 15:24:01 +0100 (CET) Received: from PO15451 (po15451.idsi0.si.c-s.fr [172.25.231.5]) by messagerie.si.c-s.fr (Postfix) with ESMTP id EE15D8BB2E; Thu, 22 Feb 2018 15:24:00 +0100 (CET) Subject: Re: [PATCH v4 2/5] powerpc/mm/slice: Enhance for supporting PPC32 To: Nicholas Piggin , "Aneesh Kumar K.V" Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Scott Wood , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org References: <01e8f783db8f4d4d41df91e0400a8634272b326f.1518226173.git.christophe.leroy@c-s.fr> <0ac518636ae1e601ea0732dd69b48dcd0f347285.1518226173.git.christophe.leroy@c-s.fr> <20180211235944.14c2be39@roar.ozlabs.ibm.com> <20180212093435.20200712@roar.ozlabs.ibm.com> From: Christophe LEROY Message-ID: Date: Thu, 22 Feb 2018 15:24:05 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180212093435.20200712@roar.ozlabs.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 12/02/2018 à 00:34, Nicholas Piggin a écrit : > On Sun, 11 Feb 2018 21:04:42 +0530 > "Aneesh Kumar K.V" wrote: > >> On 02/11/2018 07:29 PM, Nicholas Piggin wrote: >>> On Sat, 10 Feb 2018 13:54:27 +0100 (CET) >>> Christophe Leroy wrote: >>> >>>> In preparation for the following patch which will fix an issue on >>>> the 8xx by re-using the 'slices', this patch enhances the >>>> 'slices' implementation to support 32 bits CPUs. >>>> >>>> On PPC32, the address space is limited to 4Gbytes, hence only the low >>>> slices will be used. >>>> >>>> This patch moves "slices" functions prototypes from page64.h to slice.h >>>> >>>> The high slices use bitmaps. As bitmap functions are not prepared to >>>> handling bitmaps of size 0, the bitmap_xxx() calls are wrapped into >>>> slice_bitmap_xxx() functions which will void on PPC32 >>> >>> On this last point, I think it would be better to put these with the >>> existing slice bitmap functions in slice.c and just have a few #ifdefs >>> for SLICE_NUM_HIGH == 0. >>> >> >> We went back and forth with that. IMHO, we should avoid as much #ifdef >> as possible across platforms. It helps to understand the platform >> restrictions better as we have less and less access to these platforms. >> The above change indicates that nohash 32 wants to use the slice code >> and they have different restrictions. With that we now know that >> book3s64 and nohash 32 are the two different configs using slice code. > > I don't think it's the right place to put it. It's not platform dependent > so much as it just depends on whether or not you have 0 high slices as > a workaround for bitmap API not accepting 0 length. > > Another platform that uses the slice code would just have to copy and > paste either the nop or the bitmap implementation depending if it has > high slices. So I don't think it's the right abstraction. And it > implies a bitmap operation but it very specifically only works for > struct slice_mask.high_slices bitmap, which is not clear. Better to > just work with struct slice_mask. > > Some ifdefs inside .c code for small helper functions like this IMO isn't > really a big deal -- it's not worse than having it in headers. You just > want to avoid ifdef mess when looking at non-trivial logic. > > static inline void slice_or_mask(struct slice_mask *dst, struct slice_mask *src) > { > dst->low_slices |= src->low_slices; > #if SLICE_NUM_HIGH > 0 > bitmap_or(result, dst->high_slices, src->high_slices, SLICE_NUM_HIGH); > #endif > } > > I think that's pretty fine. If you have a singular hatred for ifdef in .c, > then if() works just as well. > To be honest, I tend to agree with you. Therefore, after a few words with Michael, v5 gets rid of those obscure wrappers to come back to the initial (v1) approach which was to use 'if (SLICE_NUM_HIGH)'. Behind the fact that it in my mind looks cleared in the code than using slice_bitmap_xxx() wrappers, it also has the advantage of significantly reducing the size of the patch, which is a must to be able to get it applied on stable. Christophe