Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp150572rdb; Thu, 25 Jan 2024 10:47:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IGDZxPNpEOSuZNv0u3vnFQoiMC8v/2XNyz0TAH2GvRoj7Xr6BGUlgoCz3dZvy1QefDSDNHW X-Received: by 2002:a05:6830:44f:b0:6e0:f990:fc71 with SMTP id d15-20020a056830044f00b006e0f990fc71mr321205otc.47.1706208470980; Thu, 25 Jan 2024 10:47:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706208470; cv=pass; d=google.com; s=arc-20160816; b=Q5OE+fPWQKtn3YR6PuyIQ+s81hptV5eOdAoSF253SyRlJG2+Hl1ZqWt3PHDI+ibHWh gUVpR01PPHSkmwo9QxsjYDK4SsxJIh5eLmtn4+NBeyg+93a8FyOVdznTl3Epn7pKYJkF FEy5Z/bGpQso/yGqSfbo33TzfEH/eW59MpjzAwmPkl2dMytWj65EACOm82S8K3TENUzw EhCoa6xrMetJr8D3l0GYJO+3fydMLzJg/t37VuZ5RkCzMM8WGAkr2wO7hbTnxVqvx3fP xIqIBtMkSccmrkizgZ/rK59/aW2nj7yq7wB2wYBgA5oISZtz+8jQ4tEUnU3UAqG2IIUm piHg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=E6b90sp3mfB2mb5IrNxt6H3jM43ObffjmtEEs/qLh4E=; fh=kxOp6iCI89HA/UGEHZfqa7DCcDpg9X+mQ9laE2YYYR8=; b=CURNQzw9uF648RmVCGUtGg7DIzXGXZSeiEb8H7D7p2swwDkTZ2/ReEkfQ9tpf5c/qH q85LBBmyQlGXcuWBVL9jS6mfwoagtb492aG43ygixDsFy+3r4jLGzwoIayAzj5/TTEWS s4npmovkucIiAw70ULOk1D2/M03sE8TxDJeKtK0y4JX5bhylu7ajzD8P6C3OBwz/4ypW LfdKTXIFj7EpvCHAj53jmwPhyh6o8yp30dEjZbK5WgHZhkPQ9VkUVPAT3n2LXW7QDvWy ThcI8SFLlgHp3xFUStCSoPLH2gXkA8UbeSrazPsaldyhsX+YS/tADXsDCH49I3QyvNmy W24Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QvSn8rT8; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-38748-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38748-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id t19-20020a6564d3000000b005cdbeb97153si13606920pgv.86.2024.01.25.10.47.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 10:47:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38748-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QvSn8rT8; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-38748-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38748-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2BA9A2957C0 for ; Thu, 25 Jan 2024 14:50:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 330AA6EB6D; Thu, 25 Jan 2024 14:50:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="QvSn8rT8" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 09B346EB58 for ; Thu, 25 Jan 2024 14:50:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706194211; cv=none; b=RgDrwH3cl4NHNzsFYcb8GsBykIfA0Fhu8+bRddX/lwzbK1BwR+d1EcyvFxWaJCKZ/a843WnZr8tZEGQtMkkBAmOIhWSL2ddmwcZk17q4ubMwNc9FXkXk6jEFNdtOKoVymYh0OY5e/aB0krn+M/CHvxWrNZABrdD+LViCW6dtsaA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706194211; c=relaxed/simple; bh=vMiyI/wRBdkFwRPV4E9Wuo5tN9uCzX1dsDL3Ei771pA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pXaBV8o/Qea7Xxg1KQ7q2zXTzX9NjZNM0ye33esiHe/VOM3q10PJMvT0Wddtms3lwaq/t64jK8XM5r1jXZ/9OxNLavxcFF4XY9S7/7YgoGpsaamecrLzdEn55l5cGlQbv6DmvN2nl3u/s95sMNULL3l1CI2IFADob8JEj04+CV0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=QvSn8rT8; arc=none smtp.client-ip=198.175.65.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706194210; x=1737730210; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=vMiyI/wRBdkFwRPV4E9Wuo5tN9uCzX1dsDL3Ei771pA=; b=QvSn8rT8DHn632NHC+esWyMADAAcidMLei1IuahJjD3F5dT2HNvhbigD oTTTl7eXmnNzhncT2ajjHspMX7kIZ9Kf24CoFv2cXBrWP8D2hAA+bG0UI suVkU/9G1BbmsDX43Uum6BRKUPRP1pORCucEB5hNujPVGAo10LRILC1TV E/ctTKJh9wiC9jiQvM8KOPGilht0nL+hTne5k8DXbHWeouu+zXy2cpt49 oucf9fa18+S7ETOxHWwQgcMBElzY7rVvwXV3oafhgonnpSIkRd/YzITPt rJrKkQlNf1X3QIYlvBYL0DY6dskyxY8l0B+zpI1mVIm6JWUjTYVMl26Ak w==; X-IronPort-AV: E=McAfee;i="6600,9927,10962"; a="2049593" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="2049593" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2024 06:50:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="2380058" Received: from tassilo.jf.intel.com (HELO tassilo) ([10.54.38.190]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2024 06:50:08 -0800 Date: Thu, 25 Jan 2024 06:50:07 -0800 From: Andi Kleen To: "Kirill A. Shutemov" Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , linux-kernel@vger.kernel.org, Kai Huang , Sean Christopherson Subject: Re: [PATCHv3, RESEND] x86/trampoline: Bypass compat mode in trampoline_start64() if not needed Message-ID: References: <20240124131510.496803-1-kirill.shutemov@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: > I think it is cleaner to switch to IRET here. Does this work for you? > > diff --git a/arch/x86/realmode/rm/trampoline_64.S b/arch/x86/realmode/rm/trampoline_64.S > index 608f108cba7d..14d9c7daf90f 100644 > --- a/arch/x86/realmode/rm/trampoline_64.S > +++ b/arch/x86/realmode/rm/trampoline_64.S > @@ -243,7 +243,9 @@ SYM_CODE_START(trampoline_start64) > movl $pa_trampoline_pgd, %eax > movq %rax, %cr3 > > - jmpq *tr_start(%rip) > + pushq $__KERNEL_CS > + pushq tr_start(%rip) > + lretq Looks good. Thanks. -Andi