Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3194678img; Mon, 25 Mar 2019 05:47:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqxU3WCDnclGzF3j55mk89uuCDY5qPCbkZ0Ao6192LYp3TOCHQFjORUuH++rCv7g+jkSZcPa X-Received: by 2002:a63:2403:: with SMTP id k3mr22924602pgk.200.1553518066383; Mon, 25 Mar 2019 05:47:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553518066; cv=none; d=google.com; s=arc-20160816; b=WBND2gTcDY2451/JFwRqvgAJeBuhp+O++mnyRGvn/KGmXQNniTUuyVGF/tkkvVrhSu bwXmGmgKeEU0kG9x2A/GMojz/EhcV1ijzGnHkNqQ41hMv3GUNNSn0o+qvViNhEZ4os4f meN0jKaGEAu19v4pun2GQ/RK5zYZ6CKvQa17LdAYA9rS2AND0mfUQF7smVetDQ4T/JxO ZC6uST7JsKwrp285oorDELn3fMWOImCMscULBu21FDVOoDsaoNUOjzbeuNierRVoy/aG eLLIkOmXnTaX+uFLa99LZj9U9fJhHfwYMW4JFI7zRtzlk1aWmvSAR590BaqTtv1d2YIJ bzBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=aKQXa5YkFWHmzvdNZz0a/ECpXIm6ywTQ5AlT/nevErY=; b=KJoyNHrIrg9RhwRH8ibRBueB44X/7IkoW0kLXOumATvI01tXiMzwarxJ3W4gN0GOZg xYAVfjonGiLQMMf9JOVLcvDpNJijq/S+aMmtWRU97UmYD8+S++8Nw8xJJUSSEp0vH/px VklxjhM+QmnEL/dQMpqPsQpj0rLLRPmh/ielzwdsy/zdzZzegVNH8EGvEPBAUJWYXBSs yjdhyu9zuYvPjp4DI5IhsCnK08I7gLh4MhF/JbmaVJP8Cvweu2WoOqDZGjyy9WZ6Xshv VxnDfzmZwjyer7cqExOv93IsBwRkre1+sH7GvQWh1HrUkVOWVf56dZ/Ha23z0LNTQr1g WlWQ== 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 t19si13895170plr.402.2019.03.25.05.47.30; Mon, 25 Mar 2019 05:47:46 -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; 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 S1731134AbfCYMqu (ORCPT + 99 others); Mon, 25 Mar 2019 08:46:50 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:45757 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731043AbfCYMqu (ORCPT ); Mon, 25 Mar 2019 08:46:50 -0400 Received: from [5.158.153.52] (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 1h8Ozt-0003k0-NC; Mon, 25 Mar 2019 13:46:37 +0100 Date: Mon, 25 Mar 2019 13:46:32 +0100 (CET) From: Thomas Gleixner To: "Chang S. Bae" cc: Ingo Molnar , Andy Lutomirski , "H . Peter Anvin" , Andi Kleen , Ravi Shankar , LKML , Andrew Cooper , x86@kernel.org Subject: Re: [RESEND PATCH v6 04/12] x86/fsgsbase/64: Enable FSGSBASE instructions in the helper functions In-Reply-To: Message-ID: References: <1552680405-5265-1-git-send-email-chang.seok.bae@intel.com> <1552680405-5265-5-git-send-email-chang.seok.bae@intel.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 25 Mar 2019, Thomas Gleixner wrote: > The whole point of FSGSBASE support is performance, right? > > So can please someone explain why having the following in the context > switch path when it can be completely avoided is enhancing performance: > > - 4 x SWAPGS > - 1 x RDMSR > - 1 x WRMSR Corrrecting myself. That should be: RDGSBASE WRGSBASE obviously. Still the point remains. > - 2 x local_irq_save() > - 2 x local_irq_restore() > > Of course the local_irq_save/restore() pairs are utterly pointless because > switch_to() runs with interrupts disabled already. > > SWAPGS instead needs: > > 1 x WRMSR > > and nothing else. > > So trading the single WRMSR against the above in the context switch path is > gaining performance, right? > > The only thing which gains performance is user space switching GS. And this > user space performance gain is achieved by: > > - Inconsistent and fragile code with a guarantee for subtle and hard to > diagnose bugs > > - Pointless overhead in the context switch code > > Sorry, not going to happen ever. > > Get your act together and make this consistent. Either SWAPGS or FSGSBASE, > but not a mix of it. > > Thanks, > > tglx >