Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp812578ybk; Wed, 13 May 2020 13:51:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1N42EaZy2BIdr64UtNZ7JcvgpSmjYd+OJB1BYKroOeYOlm4d02d7gvi+F+a4jNDb+hAwk X-Received: by 2002:a50:8d57:: with SMTP id t23mr1385753edt.168.1589403107811; Wed, 13 May 2020 13:51:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589403107; cv=none; d=google.com; s=arc-20160816; b=W+NZeIQVKTlLBLGy3/YNEgH5fPVhQ9mREgytKPF8zSAFkd/zs0pyQc/jQ5H9g68T50 9i2Jes+cA7FVFy8tG6RdWg5C8iHzoaURH5wWQ4a/qiTjjv03Q4QeILKGbhaebkTpljyu C4CRImxqvESixgBQQILzcIK9ylPOR6kDbaCpfUjP+fEIWOO/etkg1J10/ivkwk5LcxCP bbNsKqOvuqqXThYS/VLmtZVqgIue2fA/sr29y8BC9ElQz0427Qy2TtOd6ic35/FgDMCQ oD7WiJLveHwzIJ2q+oYtzWjnvCwco+AGgrDZ3PK2NILIlHOLiZH2VxBuqVp64CJEguCk 4DMQ== 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=JDEKpCyel5roaPHiSgoAvTPQ2LKaVUx3Of48G4Uofqo=; b=ZVuwfxPgLgBcKFckaGTL13m7fLwH8LyZ6iQUy/gyFE4+soBNdQBL4Rt9VUQt3nWxky 1mne8NSlhXak51ebG5m9wOsfKv0biR0X45rkCUEDoUHrjdSTNKP+JLFB752IgCCqfekr 6+DQRZEKH0HGi5WSsY07tBqDVesasO1UrBk5ZbAoXwQlrgOMoTQfGWpXwBDvI9wCJuqY pF1cu2jtS7J/1P2CBzyS86ozc4wJhnsM8bXXf00LPT19cNEqtV8YWlgHoZ4yPngoSQKD m+ZP+ERWjuNlEN+bGvQC1LTuN2IqSqsZV7eONFkheg0SEx+tDNDXbjJEK4AgazDxD0F7 UA1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x1si352483edr.335.2020.05.13.13.51.24; Wed, 13 May 2020 13:51:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389409AbgEMQRK (ORCPT + 99 others); Wed, 13 May 2020 12:17:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730731AbgEMQRK (ORCPT ); Wed, 13 May 2020 12:17:10 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 847E0C061A0C for ; Wed, 13 May 2020 09:17:10 -0700 (PDT) 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 1jYu42-000053-0g; Wed, 13 May 2020 18:16:58 +0200 Received: by nanos.tec.linutronix.de (Postfix, from userid 1000) id 832EC100605; Wed, 13 May 2020 18:16:56 +0200 (CEST) From: Thomas Gleixner To: Balbir Singh , linux-kernel@vger.kernel.org Cc: jpoimboe@redhat.com, tony.luck@intel.com, keescook@chromium.org, benh@kernel.crashing.org, x86@kernel.org, dave.hansen@intel.com, thomas.lendacky@amd.com, Balbir Singh Subject: Re: [PATCH v6 5/6] Optionally flush L1D on context switch In-Reply-To: <20200510014803.12190-6-sblbir@amazon.com> References: <20200510014803.12190-1-sblbir@amazon.com> <20200510014803.12190-6-sblbir@amazon.com> Date: Wed, 13 May 2020 18:16:56 +0200 Message-ID: <875zcz3j47.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 Balbir Singh writes: This part: > --- a/include/uapi/linux/prctl.h > +++ b/include/uapi/linux/prctl.h > @@ -238,4 +238,8 @@ struct prctl_mm_map { > #define PR_SET_IO_FLUSHER 57 > #define PR_GET_IO_FLUSHER 58 > > +/* Flush L1D on context switch (mm) */ > +#define PR_SET_L1D_FLUSH 59 > +#define PR_GET_L1D_FLUSH 60 ... > @@ -2514,6 +2524,16 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, > > error = (current->flags & PR_IO_FLUSHER) == PR_IO_FLUSHER; > break; > + case PR_SET_L1D_FLUSH: > + if (arg3 || arg4 || arg5) > + return -EINVAL; > + error = arch_prctl_l1d_flush_set(me, arg2); > + break; > + case PR_GET_L1D_FLUSH: > + if (arg2 || arg3 || arg4 || arg5) > + return -EINVAL; > + error = arch_prctl_l1d_flush_get(me); > + break; > default: > error = -EINVAL; > break; wants to be split into a separate patch, really. Then we get a proper subject lines with proper subsystem prefixes. This part also lacks a description in Documentation/userspace-api/ and function prototypes for the arch_prctl* functions. But looking at this deeper (yes I should have noticed earlier): Why do we need yet another PRCTL? We already have PR_SET_SPECULATION_CTRL/PR_GET_SPECULATION_CTRL. That L1D flush thingy fits into this category, right? This makes even more sense if you think about the second use case for L1D flush, i.e. the flush when a untrusted task comes in. If we ever want to support that case then this will be imposed by seccomp and then we'd need yet another interface there. And for this reason we should also name that current opt-in thingy: L1D_FLUSH_OUT in the prctl and also for the TIF bits. Hmm? Kees? I've applied the first 4 patches to: git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git x86/mm so the polishing I did gets preserved and you don't have to resend the whole pile. Thanks, tglx