Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3249732iob; Mon, 16 May 2022 17:07:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/zOXzzjOllBNnt5CvrxuqYNJUwsVMyg+FLOwwVwvY3xOMHy+0s1mP/h038C7mDdWrd83T X-Received: by 2002:a17:906:544e:b0:6f3:bd59:1a93 with SMTP id d14-20020a170906544e00b006f3bd591a93mr17292871ejp.421.1652746078456; Mon, 16 May 2022 17:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652746078; cv=none; d=google.com; s=arc-20160816; b=0hUqwBFGDXBlHl1x1VwTxLqOayCimOyseoQSwqRiiRn2UdE/O+d7mNUv/qaEea8eO0 cGUjx88JPKlmdUP7LUF3xuhW3JUpNhu/xO0H5toufVDWG7A7PlDwVXzuvrt7JVurSc3i ME8KQH19E5eL++PlWpItdpSgTh9nGjkxCjhVO5UySkn4var9BNs7AOeV0LqiVVguiutq RzYo5yRZSQQeTTAPvBbWMbhtfK+4nODtfQLXJd7S12oNBdDXjj5pe35L5EEgG1NKMfL9 OB3LB7ibt0AvmyMgUWcuRXhG5CjY/Hh5aDytqX0uSBQFhVmMX4Fl112KH5i6LubyFdd1 PKUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=+5LCsW8k7IMBIoubQ8rXPA9GnJrMZKFQzAkQTlILy9g=; b=Hx1H6DOoFZ40cxQLRu7rxGJUTl4oZBo6yYvnYLa2Z8CT52NvhRjvurIh6dSyTiRAt+ PFJa3/HHEu23w+2d1Rlqhhr2GacfOmvQw7FzhJAwapPTMVBsxM7oS+p1OcBGDFiiq1cd IEsklU+O0utpBUGdnXAZMvG0/DzqOS00olR2P59UBIMkJmCVy4nYATlmSKx2zjW73clD NJm9/pcYVXySOrpPkq2d6awatlRoZdjIKVHx9FKD3CL/bba7jpy0BkOq0eJybE0fo2JZ gY2b8CPbv0NirXcHohRa79Wb4qG6SJc2jU5dWvxixK319uWKxuyIzDg++l1y3emNP/yi lBWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=FldEA02i; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id br14-20020a170906d14e00b006f3891fe17fsi717327ejb.838.2022.05.16.17.07.32; Mon, 16 May 2022 17:07:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=FldEA02i; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235689AbiEOTiQ (ORCPT + 99 others); Sun, 15 May 2022 15:38:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229587AbiEOTiM (ORCPT ); Sun, 15 May 2022 15:38:12 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9DFF2A723 for ; Sun, 15 May 2022 12:38:11 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1652643489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+5LCsW8k7IMBIoubQ8rXPA9GnJrMZKFQzAkQTlILy9g=; b=FldEA02iAWFSLvS9H+hHyYfFA9ud0FV7oPLk+g7hDSj8oxQiPEX1hLAxn+AfidjhgMCwJ3 mobJFKKzvWnUg8imAqqVxCt4cuirIKf1ZeQvr81b664kPA31aROreeQt0WMV/20wompYKH 3Pb1aVgmlSV8LLrjLqN7/oNBdFPj8Ioe7G1sfwZ5g2kPHB1ScBFd/gn5xSa62oVbFaMUYb Fty5/uYikAg4yCyW2nz+o3PmCFBtNndpyXOb/8S+Zg8pDv/wDtxU5w0SXLN7UCMfvq3P+W fbPctagAzNFNmIMb0ZoTrq+UQDgctfKpQmG8+yx1i1clnaVL76/VnngPh+BRjA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1652643489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+5LCsW8k7IMBIoubQ8rXPA9GnJrMZKFQzAkQTlILy9g=; b=t0slTWbY4t8OnN7SBKS0xeJTT4TAWF5Ik5fODcSiFhvNSMnWKvW7AqqA3DXciGMvfww3Zy KCqcCoLTZrts9+DQ== To: "Edgecombe, Rick P" , "kirill.shutemov@linux.intel.com" Cc: "linux-kernel@vger.kernel.org" , "peterz@infradead.org" , "hjl.tools@gmail.com" , "linux-mm@kvack.org" , "dave.hansen@linux.intel.com" , "aryabinin@virtuozzo.com" , "dvyukov@google.com" , "x86@kernel.org" , "ak@linux.intel.com" , "Lutomirski, Andy" , "glider@google.com" Subject: Re: [RFCv2 03/10] x86: Introduce userspace API to handle per-thread features In-Reply-To: <95efb5ae85a96914fff3939d4924e46686196cc7.camel@intel.com> References: <20220511022751.65540-1-kirill.shutemov@linux.intel.com> <20220511022751.65540-5-kirill.shutemov@linux.intel.com> <20220513230958.dbxp6m3y3lnq74qb@black.fi.intel.com> <543eb3ff98f624c6cfa1d450ac3e9ae8934c7c38.camel@intel.com> <87k0aose62.ffs@tglx> <9e59305039f2c8077ee087313d1df5ff06028cfe.camel@intel.com> <87zgjjqico.ffs@tglx> <95efb5ae85a96914fff3939d4924e46686196cc7.camel@intel.com> Date: Sun, 15 May 2022 21:38:08 +0200 Message-ID: <87lev2r3hb.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 15 2022 at 18:24, Edgecombe, Rick P wrote: > On Sun, 2022-05-15 at 11:02 +0200, Thomas Gleixner wrote: >> If it really turns out to be something which matters, then you can >> provide a batch interface later on if it makes sense to do so, but >> see >> above. > > Thanks, sounds good to me. > > Kirill, so I guess we can just change ARCH_THREAD_FEATURE_ENABLE/ > ARCH_THREAD_FEATURE_DISABLE to return EINVAL if more than one bit is > set. It returns 0 on success and whatever error code on failure. > Userspace can do whatever rollback logic it wants. What do you think? Why having this feature bit interface in the first place? It's going to be a demultiplex mechanism with incompatible arguments. Just look at LAM. What's really architecture specific about it? The mechanism per se is architecture independent: pointer tagging. What's architecture specific is whether it's supported, the address mask and the enable/disable mechanism. So having e.g. prctl(POINTER_TAGGING_GET_MASK, &mask); works on all architectures which support this. Ditto prctl(POINTER_TAGGING_ENABLE, &mask); is architecture agnostic. Both need to be backed by an architecture specific implementation of course. This makes it future proof because new CPUs could define the mask to be bit 57-61 and use bit 62 for something else. So from a user space perspective the mask retrival is useful because it's obvious and trivial to use and does not need code changes when the hardware implementation provides a different mask. See? The thread.features bitmap could still be used as an internal storage for enabled features, but having this as the primary programming interface is cumbersome and unflexible for anything which is not binary on/off. Thanks, tglx