From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D829AC43334 for ; Mon, 18 Jul 2022 18:55:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234065AbiGRSzH (ORCPT ); Mon, 18 Jul 2022 14:55:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231264AbiGRSzG (ORCPT ); Mon, 18 Jul 2022 14:55:06 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F20327B36 for ; Mon, 18 Jul 2022 11:55:05 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1658170503; 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=afKbqenpGLounXqvR8fEhHYYL4+7diHe5lEv1lZPTA8=; b=NYcM9YKA6ztrzNJFJAB2E0DhOrCQF1m6NLFmvva5ImQsdDl91CYn4nAPuanFY/bVMIH5V8 gszeECVVfpHSLZgjPG+QLtiz0iHABwLhcD7uuqwgr9nyolLZOTHE/RkrsiMG9/s3l35dbD DoZRQbNydVXkXw3NNlzw1VO0yKGeFKo9uzrv9f3Nvb6eOVwHEdlUMvu904XDHAHV+P5sbl gTylX0qEmLFpKyIcljGK7eICc/AlilWJaOVHaSm1ctAF4b4ds5BbreeqUf8Fj2xkwOEYhh CgtvpMUCsyXz+zOfo8YAlJrqBTyhAkbiHGZvWsjRTJvh5x7teSzJmJeq/m4Cxw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1658170503; 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=afKbqenpGLounXqvR8fEhHYYL4+7diHe5lEv1lZPTA8=; b=Swrn6KgVrXgbbqduXGxdrj5SIsphMNn2+gX+sIqXieSwZxNfItJkERHAogQ7iAWkA7wgqX RAUQYCsRVkxcw/Aw== To: Linus Torvalds Cc: LKML , the arch/x86 maintainers , Tim Chen , Josh Poimboeuf , Andrew Cooper , Pawan Gupta , Johannes Wikner , Alyssa Milburn , Jann Horn , "H.J. Lu" , Joao Moreira , Joseph Nuzman , Steven Rostedt , Juergen Gross , "Peter Zijlstra (Intel)" , Masami Hiramatsu , Alexei Starovoitov , Daniel Borkmann Subject: Re: [patch 1/3] x86/cpu: Remove segment load from switch_to_new_gdt() In-Reply-To: References: <20220716230952.787452088@linutronix.de> <20220718173923.891284477@linutronix.de> Date: Mon, 18 Jul 2022 20:55:03 +0200 Message-ID: <874jzew8s8.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 18 2022 at 11:43, Linus Torvalds wrote: > So I appreciate the added big comments in this code, but looking at this patch: > On Mon, Jul 18, 2022 at 10:52 AM Thomas Gleixner wrote: >> + * For secondary CPUs this is not a problem because they start >> + * already with the direct GDT and the real GSBASE. This invocation >> + * is pointless and will be removed in a subsequent step. >> + */ >> + if (IS_ENABLED(CONFIG_X86_64)) >> + wrmsrl(MSR_GS_BASE, cpu_kernelmode_gs_base(cpu)); >> } > > ... while those comments are nice and all, I do think this retains the > basic insanity of having "switch_to_new_gdt()" do magical things on > x86-64 that don't really match the name. > > So honestly, I'd be happier of that whole > > if (IS_ENABLED(CONFIG_X86_64)) > wrmsrl(MSR_GS_BASE, cpu_kernelmode_gs_base(cpu)); > > was migrated to the callers instead. There aren't *that* many callers. > > I expect that it is then quite possible that several of the call-sites > would go "GS_BASE is already correct here, I can remove this". With the next patch we have only two left. The SMP and the UP case. Let me look whether the UP needs it at all. > But even if every single caller keeps that wrmsrl() around, at least > it wouldn't be hidden behind a function call that has a name that > implies something completely different is happening. > > And no, I don't care *that* deeply, so this is just a suggestion. > > But wouldn't it be nice if this function was actually named by what it > does, rather than by what it used to do back in the i386 days when the > GDT affected the segment bases? Yes. Let me come up with a sensible name. Thanks, tglx