Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3654012ybg; Fri, 25 Oct 2019 07:09:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqyWcIs8tnnVpMa9a4TtRxMq+mSAz4I49X3uVEZ5m5xXXx/xUpDgoZTJXTfwmE4en1+oOc+S X-Received: by 2002:a17:906:1c48:: with SMTP id l8mr3649120ejg.203.1572012573735; Fri, 25 Oct 2019 07:09:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572012573; cv=none; d=google.com; s=arc-20160816; b=bXQyPRhC70irzliMN57/jLijX62T3mtjQe7PflIa+BklLKec6tMAqQGUEXh9YATW26 +aIrEhnQJHMFKtLaX/Q52sRvlBY7WZ/zNx67fELuevuDxIAwU5Jz/YG38yEV/rZtepZh jElm0rm43ubs3jMNPNqyg8TS+pc1WrIcwq7wkb4NGBIXsQpT7zwx1uq/aMauJk1ttIMG j+hFnbJ0E0YDgwzTjq8KjHHwaAhv987RT4GUexRM8YV9lIAiEIVlIRl/zg1OvtDbUlf8 6YWfrXVezWg9tTadlA7Dqs1Ztf8lI6If/Co2nt3r3T+6HPxlDzrhJyDiYv3HqD8yonw4 I1Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=j31AR8mHNUnuvIl1pEuzBIEvqwKjzbbbq67t0Y+MSiA=; b=rSpQGdx7CVTIU82oGQBgDn2M03REdELwNvpPfr02rbu1Yp/IH13TuOE1UErbJZYuCU vIBBCpYX0omzmRfOPIkRpqvMHf10h8ljytYmzNbE2LhCG/5KW64w5lIwUGWmb3DXErGA Thz5S5y8jhN6cwpYNsh2DejCo8mKDQbFDV497UDpHg/Qz6owhcuzMxfun5NDwnmjQccQ AqBT5eLrRyshgOqYdicVv+G45WuQq2dDHw1SB4Xqur77pW8k8ciF7g1T0Ls5K+7di+99 Oj0JxOR6jpbZd061FOxd9u7+XIXJAKZBESIaXrVGobdacIMkdOXiw06SxFJqGTOc0ilV uwmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YuONv0zj; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q3si1403684edc.359.2019.10.25.07.09.09; Fri, 25 Oct 2019 07:09:33 -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; dkim=pass header.i=@kernel.org header.s=default header.b=YuONv0zj; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439778AbfJXQSn (ORCPT + 99 others); Thu, 24 Oct 2019 12:18:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:52920 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439771AbfJXQSn (ORCPT ); Thu, 24 Oct 2019 12:18:43 -0400 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8147E21D71 for ; Thu, 24 Oct 2019 16:18:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571933921; bh=hqVw2CfkuDpCReYQpVPUdZMTX306EhtBcgoPSJOsN8E=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=YuONv0zjyooTw5EzBFHZ+d1WPpe7ePP7JFGd9g8Xvcdxp5jB91QtALUIM9yCm1fsB WznBi7LPAE6yRdV7SPAgRFMo+++htnKc1X4n4b75Z4+jPC0G1cyubBUjwhPm9y8NM5 ScmiCywZTQeSJ94V80AJefCAUvYOXFhKspW9aDII= Received: by mail-wr1-f51.google.com with SMTP id z11so3391500wro.11 for ; Thu, 24 Oct 2019 09:18:41 -0700 (PDT) X-Gm-Message-State: APjAAAWwXk6KSPNREWw6twypQg5A3cHhgJCKRh+RH6YRk472+091R2Ja NvO8eusam/eOsBcdln5XOfO0bthwyIgusTxlC6p06Q== X-Received: by 2002:a5d:4d0f:: with SMTP id z15mr4403914wrt.195.1571933919909; Thu, 24 Oct 2019 09:18:39 -0700 (PDT) MIME-Version: 1.0 References: <20191023122705.198339581@linutronix.de> <20191023123118.296135499@linutronix.de> <20191023220618.qsmog2k5oaagj27v@treble> In-Reply-To: From: Andy Lutomirski Date: Thu, 24 Oct 2019 09:18:26 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [patch V2 07/17] x86/entry/64: Remove redundant interrupt disable To: Thomas Gleixner Cc: Josh Poimboeuf , LKML , X86 ML , Peter Zijlstra , Andy Lutomirski , Will Deacon , Paolo Bonzini , kvm list , linux-arch , Mike Rapoport , Miroslav Benes Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 23, 2019 at 4:52 PM Thomas Gleixner wrote: > > On Wed, 23 Oct 2019, Josh Poimboeuf wrote: > > > On Wed, Oct 23, 2019 at 02:27:12PM +0200, Thomas Gleixner wrote: > > > Now that the trap handlers return with interrupts disabled, the > > > unconditional disabling of interrupts in the low level entry code can be > > > removed along with the trace calls. > > > > > > Add debug checks where appropriate. > > > > This seems a little scary. Does anybody other than Andy actually run > > with CONFIG_DEBUG_ENTRY? > > I do. > > > What happens if somebody accidentally leaves irqs enabled? How do we > > know you found all the leaks? > > For the DO_ERROR() ones that's trivial: > > #define DO_ERROR(trapnr, signr, sicode, addr, str, name) \ > dotraplinkage void do_##name(struct pt_regs *regs, long error_code) \ > { \ > do_error_trap(regs, error_code, str, trapnr, signr, sicode, addr); \ > + lockdep_assert_irqs_disabled(); \ > } > > DO_ERROR(X86_TRAP_DE, SIGFPE, FPE_INTDIV, IP, "divide error", divide_error) > > Now for the rest we surely could do: > > dotraplinkage void do_bounds(struct pt_regs *regs, long error_code) > { > __do_bounds(regs, error_code); > lockdep_assert_irqs_disabled(); > } > > and move the existing body into a static function so independent of any > (future) return path there the lockdep assert will be invoked. > If we do this, can we macro-ize it: DEFINE_IDTENTRY_HANDLER(do_bounds) { ... } If you do this, please don't worry about the weird ones that take cr2 as a third argument. Once your series lands, I will send a follow-up to get rid of it. It's 2/3 written already.