Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1272810ybf; Thu, 27 Feb 2020 07:54:57 -0800 (PST) X-Google-Smtp-Source: APXvYqxDSSum8h94CWRyEy6EKR+2hBbwC6sKuZzKjVojYG0Fy3EbGdCr2S14c09JH6QUdreXmb3y X-Received: by 2002:a9d:23b6:: with SMTP id t51mr264645otb.15.1582818896875; Thu, 27 Feb 2020 07:54:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582818896; cv=none; d=google.com; s=arc-20160816; b=fTkG4I85Cn3FHbK/5SX7/CpbgtlR563v/aFkXr+zgzVOV2llQRMfMsM4+kFz+3nya+ t6b60UciPFBO7aRWdHNAWBEbhezdVoN5o0O1yXlAaUuouf2G1v6NIjynSwVIhhwMBTlX IyVCNBA+ODhhzyt16M+skdkX2Y6+YYVa8VEZJ/n1MwzId/UAWaAdZALp+psu4Lv/PAPn Fwojlw96F634sUQIwvhQlHLRSsrcXJ+1g/GuYmYst/7kjE9R0S8LFdtnckViEEkWKai3 1SKWwirW7rqTQa+Ji3t3e3F5g0kUgdqTTZJPSK+gwTckpPae7Mz+GrItpDGpMwwAxBJn c9ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=Unn4qrzLmV10W/ajw7yjR/8lf0tXowi6PsxC6N1uHUs=; b=d1s0//wU0LbmZev9Y4jHwv/YncM2JWxgl2FyPJU/hinluiQ6+3aT26BalW01Re4GNb trvWExS9uUhEFtFfaPhuxCGCdVDRjmzH13XkYVSESQGTIMNHU1MbkoQGVhBLJRhz2CiK UOh8lu8XREf7PNf2D1PjvmzY4yjLZ4/zJxzJK8+QTxvVG1lTpJUJfdylLhDFxRASwUYV ehJm9H5r4nReu69xJ7KeSOJoXhKhYC/EwZNR4f52hG7InhdNlpgAwh/QKcHN69niFPxN 93awCAuEsSFDKWqlED6EEuwr/Zv9lq/5wAzDP6FFP6wBjPhuzO1FJPnqGCa2tIiVhwhg DpYQ== 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 y7si1951911otg.321.2020.02.27.07.54.44; Thu, 27 Feb 2020 07:54:56 -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 S1729808AbgB0PxT (ORCPT + 99 others); Thu, 27 Feb 2020 10:53:19 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:34680 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729110AbgB0PxS (ORCPT ); Thu, 27 Feb 2020 10:53:18 -0500 Received: from p5de0bf0b.dip0.t-ipconnect.de ([93.224.191.11] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1j7LTB-0000G5-Ed; Thu, 27 Feb 2020 16:53:01 +0100 Received: by nanos.tec.linutronix.de (Postfix, from userid 1000) id 27C2C1040A9; Thu, 27 Feb 2020 16:53:00 +0100 (CET) From: Thomas Gleixner To: Alexandre Chartre , LKML Cc: x86@kernel.org, Steven Rostedt , Brian Gerst , Juergen Gross , Paolo Bonzini , Arnd Bergmann Subject: Re: [patch 5/8] x86/entry/common: Provide trace/kprobe safe exit to user space functions In-Reply-To: <71271e39-1dbd-0bd6-2435-fc8a30f47b7d@oracle.com> References: <20200225220801.571835584@linutronix.de> <20200225221305.719921962@linutronix.de> <71271e39-1dbd-0bd6-2435-fc8a30f47b7d@oracle.com> Date: Thu, 27 Feb 2020 16:53:00 +0100 Message-ID: <87h7zcm3hf.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Alexandre Chartre writes: > On 2/25/20 11:08 PM, Thomas Gleixner wrote: >> Split prepare_enter_to_user_mode() and mark it notrace/noprobe so the irq >> flags tracing on return can be put into it. > > This splits prepare_exit_to_usermode() not prepare_enter_to_user_mode(). Ooops >> /* Called with IRQs disabled. */ >> -__visible inline void prepare_exit_to_usermode(struct pt_regs *regs) >> +static inline void __prepare_exit_to_usermode(struct pt_regs *regs) >> { >> struct thread_info *ti = current_thread_info(); >> u32 cached_flags; >> @@ -241,6 +241,12 @@ static void exit_to_usermode_loop(struct >> mds_user_clear_cpu_buffers(); >> } >> >> +__visible inline notrace void prepare_exit_to_usermode(struct pt_regs *regs) >> +{ >> + __prepare_exit_to_usermode(regs); >> +} >> +NOKPROBE_SYMBOL(prepare_exit_to_usermode); > > > Would it be worth grouping local_irq_disable() and prepare_exit_to_usermode() > (similarly to what was done entry with syscall_entry_fixups()) and then put > trace_hardirqs_on() there too. For example: > > static __always_inline void syscall_exit_fixups(struct pt_regs *regs) > { > local_irq_disable(); > prepare_exit_to_usermode(regs); > trace_hardirqs_on(); > } > > Or is this planned once prepare_exit_from_usermode() is not used by idtentry > anymore? This should be consolidated at the very end when all the interrupt muck is done, but maybe I forgot.