Received: by 10.223.185.116 with SMTP id b49csp1572508wrg; Sun, 11 Feb 2018 15:35:45 -0800 (PST) X-Google-Smtp-Source: AH8x225qowWKWZ02YNtynrDn+mmEOPRiC6Jz8ToedzgpzIQB4S8FgZXWsZkqErO+bSomYlVd0taE X-Received: by 10.98.76.11 with SMTP id z11mr9865469pfa.114.1518392144969; Sun, 11 Feb 2018 15:35:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518392144; cv=none; d=google.com; s=arc-20160816; b=KQsHm9e2nP5/U1/Jyk0YfTI9GVWbG8g+hkURQNw6L3UfUEXaiMynM+8qKhunz584Nx d8bMiAfo++7m6d0IlHPMYCjqzZJS+9JdLEA6n13wKzqpXkk4E4cYXPxwR8XWn+oCvvBN yosyiM2unzTIJUJy1Rq3q/uQcMzYXBYbftMFe6OgBxkBJOmjrJzmAwzOPA6X30OmJw0D hPJGvw7l93EZKtDf9Xlt7+e2crZgT3Gm6YgT9H+Srk1b3fd+l5K6yqTUUkPMpB2dvElE l+BrJmnvxGQVIBAz6aeV5LEqT8wJ05uNJgyjUZOPYl8xuoYhtDOvbzvorFQlmmwr/FlM I93Q== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature:arc-authentication-results; bh=6rJjsKgXJZio8xK7UVP6i6xSZ72GxUPKwGEXLC9oo8s=; b=KQSkuaaXGFUQ6vZmhpssVvYvwGhC0gCWm4qimM4rEtOwqWri1hM+w4Ynb/B/ExK6Lw SgS6FZ+4N+QBp3A63+wnI4/o65jqfTpe6lReMbAoBqUf9VBm53wNu+SC2BK6hOm84OdY AZTBO4UGQVKTInP2+tDtnBN4/xwjwqUJNDxorL6lJW6rcd8lSt2VIUpqQDrYumdBwDwk lh4eF2g8jQGz5svHDO9DZq6LZKXFIK5OifirG7Q9T95m0IJhvrXsYf958vcL+q20rhy0 6JKQ9Uh88rhXR58dcU0stBIjhg1SFq6fJnSz5RBkQKFGvyi1gyt894hiU65WMmSUURdU t1bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=B8ckAF1F; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b89-v6si2677453plb.809.2018.02.11.15.35.30; Sun, 11 Feb 2018 15:35:44 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=B8ckAF1F; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932237AbeBKXe4 (ORCPT + 99 others); Sun, 11 Feb 2018 18:34:56 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:45663 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932193AbeBKXez (ORCPT ); Sun, 11 Feb 2018 18:34:55 -0500 Received: by mail-pg0-f66.google.com with SMTP id e11so383714pgq.12 for ; Sun, 11 Feb 2018 15:34:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=6rJjsKgXJZio8xK7UVP6i6xSZ72GxUPKwGEXLC9oo8s=; b=B8ckAF1F4r3K+Yt+N5EYj1PxGzrI8mteWzzj3T5EXQvl0deLCXo72qDOPSGTV3XYxI XkYYyqQZSyE+cpxDw6WX394oqI6SXwbHkcHDHtmShKMKHPY3xWqyMfnXgs/Rhmx0/ptZ 3TFogjx0ZmrLlkbhc/fFbD/MKZETLuXjobr725kwieXUndH4timfahYjin2oU6pNTdMO 3rvHCz+isVmzrtdyDaX/sjV2mfnXK4B52xla2cSkaL/XMPBGghTRzLqwv9AIAQoQH0Q2 lTYEMsAzaAYJn5lWHn7D9wXf07hDo8G1FGsqcaYhJeaVRtSC110UKDlx1keE6oVbIa+s iRXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=6rJjsKgXJZio8xK7UVP6i6xSZ72GxUPKwGEXLC9oo8s=; b=Oy1md/2Dbmor91HY7HXEUXLQJjGp7n8rL9TNd32POCdgKL/V61b+lh9UxLN6TsDfos UjXckmrRO4NANhJH3Z6s4KqMcDEztt2ekjrPkVA+O818PPYGngbQO/2RhOT3B9PS+eg+ zymfcraD6L/pbFQWzfJWrNJojO1y4mj/JhOdud+uRrQF0EOgWXkZ6Ht/OW2uR7V/8B46 czoHyunnNXktOIsG4kZj66HX/fTDn8ZQT7BfARSC7Ji5qIH/p7VtQpvxearTMAYOs9Nl HNRNoIRuS6uqPCGOXm5febQxKEfQLWLnwzE2fMWYyKi1RPDPMlKiavAbQBv1MTaV3sp7 0rPA== X-Gm-Message-State: APf1xPAowekW8MFW6yZrQSUNSe67RNXPHvttovs+IC48YGbJh3VZlJxj 0bKSvACWNiaXGsAQslVflHMoZA== X-Received: by 10.101.92.77 with SMTP id v13mr8056034pgr.341.1518392095009; Sun, 11 Feb 2018 15:34:55 -0800 (PST) Received: from roar.ozlabs.ibm.com ([202.7.219.42]) by smtp.gmail.com with ESMTPSA id g9sm19666972pgr.60.2018.02.11.15.34.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 11 Feb 2018 15:34:53 -0800 (PST) Date: Mon, 12 Feb 2018 09:34:35 +1000 From: Nicholas Piggin To: "Aneesh Kumar K.V" Cc: Christophe Leroy , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Scott Wood , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v4 2/5] powerpc/mm/slice: Enhance for supporting PPC32 Message-ID: <20180212093435.20200712@roar.ozlabs.ibm.com> In-Reply-To: References: <01e8f783db8f4d4d41df91e0400a8634272b326f.1518226173.git.christophe.leroy@c-s.fr> <0ac518636ae1e601ea0732dd69b48dcd0f347285.1518226173.git.christophe.leroy@c-s.fr> <20180211235944.14c2be39@roar.ozlabs.ibm.com> Organization: IBM X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks, Nick