Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753809AbeAFRJI (ORCPT + 1 other); Sat, 6 Jan 2018 12:09:08 -0500 Received: from foss.arm.com ([217.140.101.70]:54332 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753689AbeAFRJG (ORCPT ); Sat, 6 Jan 2018 12:09:06 -0500 Date: Sat, 6 Jan 2018 17:08:58 +0000 From: Mark Rutland To: Dan Williams Cc: Linus Torvalds , Linux Kernel Mailing List , linux-arch@vger.kernel.org, Peter Zijlstra , Network Development , Will Deacon , Greg Kroah-Hartman , Thomas Gleixner , Alan Cox Subject: Re: [PATCH 01/18] asm-generic/barrier: add generic nospec helpers Message-ID: <20180106170855.y44vu3bkiqwliykx@salmiak> References: <151520099201.32271.4677179499894422956.stgit@dwillia2-desk3.amr.corp.intel.com> <151520099810.32271.11023910901471332353.stgit@dwillia2-desk3.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Fri, Jan 05, 2018 at 09:23:06PM -0800, Dan Williams wrote: > On Fri, Jan 5, 2018 at 6:55 PM, Linus Torvalds > wrote: > > On Fri, Jan 5, 2018 at 5:09 PM, Dan Williams wrote: > >> +#ifndef nospec_ptr > >> +#define nospec_ptr(ptr, lo, hi) \ > > > > Do we actually want this horrible interface? > > > > It just causes the compiler - or inline asm - to generate worse code, > > because it needs to compare against both high and low limits. > > > > Basically all users are arrays that are zero-based, and where a > > comparison against the high _index_ limit would be sufficient. > > > > But the way this is all designed, it's literally designed for bad code > > generation for the unusual case, and the usual array case is written > > in the form of the unusual and wrong non-array case. That really seems > > excessively stupid. > > Yes, it appears we can kill nospec_ptr() and move nospec_array_ptr() > to assume 0 based arrays rather than use nospec_ptr. Sounds good to me; I can respin the arm/arm64 implementations accordingly. We can always revisit that if we have non-array cases that need to be covered. Thanks, Mark.