Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753700AbeAFCzf (ORCPT + 1 other); Fri, 5 Jan 2018 21:55:35 -0500 Received: from mail-io0-f178.google.com ([209.85.223.178]:41249 "EHLO mail-io0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753557AbeAFCzd (ORCPT ); Fri, 5 Jan 2018 21:55:33 -0500 X-Google-Smtp-Source: ACJfBouSMNubpOTRZkEFXf0BXvMNZPVQANw2/QW1n35VL5FdEdpnMy/8KlyDp4vT3q90jAku6pgd+3Q6F0OOVsohUAA= MIME-Version: 1.0 In-Reply-To: <151520099810.32271.11023910901471332353.stgit@dwillia2-desk3.amr.corp.intel.com> References: <151520099201.32271.4677179499894422956.stgit@dwillia2-desk3.amr.corp.intel.com> <151520099810.32271.11023910901471332353.stgit@dwillia2-desk3.amr.corp.intel.com> From: Linus Torvalds Date: Fri, 5 Jan 2018 18:55:32 -0800 X-Google-Sender-Auth: Jb0wGd4jmuoGCTh3VMWIxpJ_h84 Message-ID: Subject: Re: [PATCH 01/18] asm-generic/barrier: add generic nospec helpers To: Dan Williams Cc: Linux Kernel Mailing List , Mark Rutland , linux-arch@vger.kernel.org, Peter Zijlstra , Network Development , Will Deacon , Greg Kroah-Hartman , Thomas Gleixner , Alan Cox Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: 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. Linus