Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2356529rda; Tue, 24 Oct 2023 23:28:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHfrA67YY3ZkJK8R2OSS9TXXQy4NdXVGhtWB+hwu2/gc6HAxYKlsj3b8OGo1uSYt0viUrcl X-Received: by 2002:a25:9745:0:b0:da0:4990:c1b9 with SMTP id h5-20020a259745000000b00da04990c1b9mr3775062ybo.60.1698215329374; Tue, 24 Oct 2023 23:28:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698215329; cv=none; d=google.com; s=arc-20160816; b=V2Xnq3E86H3fIuYbkuYfoDqIP9PvyhxNwdyDNuumkkg8N5UjTGaG9mZzb/mOSUrTm8 IOAZ1IVwOOX/LSOjxhqNj9CInxZXdWXJol5WmsmpIMF/7buN6UrblPgspsZiAeQF3jze nMF+MnGFBIsj1KML8KWjPtWbOlPKW0Q+Y7WGxMSdaxu/mbr8XWJpC2MlC9AGb0Q/FadG psIdbHS6XlsZo6zw/0roPnstXPdvizI9nAw+Nw0YgHMwaClxUNeQWOsErVsSvnMug+FP cMaoMrZW0bTNF+U/0q/5wVvjUnmSzltER/BkNJgHSVStcXm5VgACq6Q6/qQgM/+lMLRS HTlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Q9jCFIsMsjZFmGFYNfM4RR2lKvyPikF8JXB1Zc0Mk7U=; fh=p7ekuMuBKYy6HfUq8fyIfc2tMYhRoZsUjTVXFIuLfSY=; b=s/KG0uZKfo5VmXV0+Luak1CPnYyEtie1IyXt+cXN9MPqyPB6N3z5ctKMMnAMtq8YZ5 iv800LgS7C4mOjlD1GpICFymebDHd10SDDAn4K9cIf6DsGa4IqZlS7x96a607XVq2Q+c 4sG5NxFwuDeKzC/Sadl2Xyr97l5agZ2tC61nDR9wFRuCE7Z7/1lBaGg4dnb4ZEMoswNR PyZfahvP9BiZLJoHiS/8Q9cHLe4BKsLEQloNv+3lRBeLdwhT1l6B/oT8x012jDqxEPiU BxqlzgBEjLr85Jg1IpmT7uqeIxKKsgca+6vCAqNyLcoCjnF5ODXaagVms8mtebUx/1Oy NLvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AgdNuZG1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id t7-20020a056902124700b00d9bc6346797si11374463ybu.692.2023.10.24.23.28.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 23:28:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AgdNuZG1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 8FFE380C59A2; Tue, 24 Oct 2023 23:28:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232082AbjJYG2d (ORCPT + 99 others); Wed, 25 Oct 2023 02:28:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229688AbjJYG2b (ORCPT ); Wed, 25 Oct 2023 02:28:31 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BEEDA6; Tue, 24 Oct 2023 23:28:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698215309; x=1729751309; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Ol0KZSi6E4ERi8CEDy5vWciPU4wKT9ya2YUVp9DIyQs=; b=AgdNuZG1ZvugE4E+MKT2QaAr3g4xvRnRB6RRV8W+QuqDBa8Qt+Gkx/QR WCnrcdfA73gWkve/2kBtlOybhaFrHaEUPyVrVlyHezmOw4DsfdcPbTE4h qGYOr4PWylTcNYvPzglN620aP1nsL4mPxF+0KCngQ6do+2T6TWSRvzIW6 USrPOrAWqlXvUN4icW73Jw0tSoID1N0ynqBsiHeDB/ADRlUJUeWg/zkcw avil9zJknnCFuPfrT8DMExbywFg9+s03TsTsYdY9AJ9Nylxt5kXsLa4Dg Ddq1TAw+s7r6kzMEzhoMx385P9DHMY7qyKoISoucOf7byRvlWgZwsP5l4 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10873"; a="418370679" X-IronPort-AV: E=Sophos;i="6.03,249,1694761200"; d="scan'208";a="418370679" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2023 23:28:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10873"; a="735287170" X-IronPort-AV: E=Sophos;i="6.03,249,1694761200"; d="scan'208";a="735287170" Received: from mhans-mobl3.amr.corp.intel.com (HELO desk) ([10.252.132.200]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2023 23:28:27 -0700 Date: Tue, 24 Oct 2023 23:28:18 -0700 From: Pawan Gupta To: Andrew Cooper Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Peter Zijlstra , Josh Poimboeuf , Andy Lutomirski , Jonathan Corbet , Sean Christopherson , Paolo Bonzini , tony.luck@intel.com, ak@linux.intel.com, tim.c.chen@linux.intel.com, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kvm@vger.kernel.org, Alyssa Milburn , Daniel Sneddon , antonio.gomez.iglesias@linux.intel.com, Alyssa Milburn Subject: Re: [RESEND][PATCH 1/6] x86/bugs: Add asm helpers for executing VERW Message-ID: <20231025062818.7kaerqklaut7dg5r@desk> References: <20231020-delay-verw-v1-0-cff54096326d@linux.intel.com> <20231020-delay-verw-v1-1-cff54096326d@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 24 Oct 2023 23:28:43 -0700 (PDT) On Sat, Oct 21, 2023 at 12:55:45AM +0100, Andrew Cooper wrote: > On 20/10/2023 9:44 pm, Pawan Gupta wrote: > > +#define EXEC_VERW \ > > + __EXEC_VERW(551f); \ > > + /* nopl __KERNEL_DS(%rax) */ \ > > + .byte 0x0f, 0x1f, 0x80, 0x00, 0x00; \ > > +551: .word __KERNEL_DS; \ > > Is this actually wise from a perf point of view? > > You're causing a data access to the instruction stream, and not only > that, the immediate next instruction. Some parts don't take kindly to > snoops hitting L1I. > > A better option would be to simply have > > .section .text.entry > .align CACHELINE > mds_verw_sel: > .word __KERNEL_DS > int3 > .align CACHELINE > > > And then just have EXEC_VERW be > > verw mds_verw_sel(%rip) > > in the fastpaths. That keeps the memory operand in .text.entry it works > on Meltdown-vulnerable CPUs, but creates effectively a data cacheline > that isn't mixed into anywhere in the frontend, which also gets far > better locality of reference. With .text.entry section I am getting getting below warnings and an error: ----------------------------------------------------------------- LD vmlinux.o vmlinux.o: warning: objtool: .text.entry+0x0: unreachable instruction vmlinux.o: warning: objtool: .text.entry+0x40: unreachable instruction vmlinux.o: warning: objtool: .text.entry+0x80: unreachable instruction vmlinux.o: warning: objtool: .text.entry+0xc0: unreachable instruction vmlinux.o: warning: objtool: .text.entry+0x100: unreachable instruction vmlinux.o: warning: objtool: .text.entry+0x140: unreachable instruction vmlinux.o: warning: objtool: .text.entry+0x180: unreachable instruction vmlinux.o: warning: objtool: .text.entry+0x1c0: unreachable instruction vmlinux.o: warning: objtool: .text.entry+0x200: unreachable instruction vmlinux.o: warning: objtool: .text.entry+0x240: unreachable instruction vmlinux.o: warning: objtool: .text.entry+0x280: unreachable instruction vmlinux.o: warning: objtool: .text.entry+0x2c0: unreachable instruction vmlinux.o: warning: objtool: .text.entry+0x300: unreachable instruction vmlinux.o: warning: objtool: .altinstr_replacement+0x2c: relocation to !ENDBR: .text.entry+0x0 vmlinux.o: warning: objtool: .altinstr_replacement+0x1c4: relocation to !ENDBR: .text.entry+0x0 vmlinux.o: warning: objtool: .altinstr_replacement+0x1d0: relocation to !ENDBR: .text.entry+0x0 vmlinux.o: warning: objtool: .altinstr_replacement+0x2d2: relocation to !ENDBR: .text.entry+0x80 vmlinux.o: warning: objtool: .altinstr_replacement+0x5d5: relocation to !ENDBR: .text.entry+0xc0 OBJCOPY modules.builtin.modinfo GEN modules.builtin MODPOST vmlinux.symvers UPD include/generated/utsversion.h CC init/version-timestamp.o LD .tmp_vmlinux.kallsyms1 ld: error: unplaced orphan section `.text.entry' from `vmlinux.o' make[2]: *** [scripts/Makefile.vmlinux:36: vmlinux] Error 1 ----------------------------------------------------------------- ... because my config has CONFIG_LD_ORPHAN_WARN_LEVEL="error" and objtool needs to be told about this entry. Do you think its worth fighting these warnings and error, or simply use .rodata section for verw memory operand?