Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp205583ybz; Fri, 24 Apr 2020 14:31:51 -0700 (PDT) X-Google-Smtp-Source: APiQypKaUAkdbffuFzThHIzh6pzcFTHkPfsCZn+Og7YFcL2xmICjdCCuXeABlVpjwbWkY6V6nG9h X-Received: by 2002:aa7:dac4:: with SMTP id x4mr8079106eds.127.1587763911356; Fri, 24 Apr 2020 14:31:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1587763911; cv=pass; d=google.com; s=arc-20160816; b=pVCPEFGmsgnZ2rslcVXiGfstwClY/abwuHDvU2ECmTcziBCUwzK/w9zix87WaijtcW 2ZXsno2p8x8e1Y02V3DvfyMWPdEC6UF3+WSLMYxsONqzToTD6iJpV6t1ik237GKLMKz+ 6mjJgO2da5ACrsicXebbSj244Ni+b7Qk9O2ZTAYS+cpARxkUQxdYT9g24qoXasa4tnJo 4PH2OqTp/WA1VU+J7QnSUCOLC+iGCoBVSyEXK7X6KUCpQYpkuCBPrcygO/uJLyK6BrCh +aHCRJKccyXGoo+fz+3laPe3VgwX1QzQWuSue7vsvyUcpS5RlEolnTNZB7S6mnZOEnVF U+uA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:in-reply-to:user-agent:date:message-id:from :references:cc:to:subject:dkim-signature; bh=iXPwJEHMUd1Pb8WSoTwVTlGPBsQhkZh2PuV0ssteSI0=; b=GyC2pm7z9CKGw+mvViJ1Sh1auuU16ddaqiUuvvCMJAtMb1lFK52voNm6OBvo1MKBdP 8ytZu0kXIzNYAWbmsgRZgERV2gBjMRXTI+k2vXtdP0WWM2VavzUEfpoQfUYnxBjShiny APHu0wMBzIhsFFF5+sBMlpE9KUg2e6cNV9GRXFLyF1kX/mFCtR0OUuQBIgHiyW9pTRp1 hi/m5CwtrPkQJdELA9RHHTEFtvzSV9rstEVhNt/VOu0UxLWKhncSfKPqLEsaxR1cRqAp HE1bRT8tcwNmq+6cxCZ/jjJBPXC/lCp334Acbx9G7+G8EVyvZ+ZCVS5GjYHaYmwrT25q YA9Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=S1kokANA; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 13si4116398edw.369.2020.04.24.14.31.26; Fri, 24 Apr 2020 14:31:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=S1kokANA; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726087AbgDXV1i (ORCPT + 99 others); Fri, 24 Apr 2020 17:27:38 -0400 Received: from mail-dm6nam11on2087.outbound.protection.outlook.com ([40.107.223.87]:34180 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725970AbgDXV1i (ORCPT ); Fri, 24 Apr 2020 17:27:38 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IF/LoJB2mYZllic4z+nkUSvnAIJFQdA7EgGf0cH8Ox3O8Gs2glfYZX0wx0j/vUl0Appb2qHUx1wWwLsAmUUGdp3evby5GnAVLSfMVpNoEVLYssSkIBNQTsE8LS38odik8reZ8xsgG1RwLCnVkaSoHbUg+9WW2IsR/LcT8yrWG+t1qTAfJ6uCs8r27AAKK8HPfyEXmk6keQUqb4THs285CFyvw5GQePrMYmogUFY8nEsrsFmDHYZuPfs5yQcIcXwyZNU/TiO05EHbpEnbcrz+kR5u0wJGrpYcX8VSiR6Ze5aSscqmzKPsQH9br8uYUk4BUIqopp/HFFJPvj2hk1e2WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iXPwJEHMUd1Pb8WSoTwVTlGPBsQhkZh2PuV0ssteSI0=; b=Ui7iZuFeEQ8k02ANy/SMOTiOUrl7L3IEZjELiBa+pz4PYk1ZmhFjN+JqWpiGKrvLVZk5OlCS1kEz0QvmT6PWy8/J8z43oWvApH9UoxaadOF0VRqBJp51sPG3XDLtxOkjXyzkRZZgQ7kn9FEQiFMaQiRN2pQo4Z0Jl1Lr9qdgmM58UYoAjc9yxRT45OUpZNMhKnHU/2Py/MJE47xevC0z9zr9np3WYChfA6yYfvJQdpiSbQFGVqIC4kuALCZo15bkAHRz/jcxitjzGFaVwOWsvdyOxSDAC519eb1oxoavW9HNbWEZypxwEYWPGwCQZJLgAwoFfNZO4Gq7/D+V0KzAqw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iXPwJEHMUd1Pb8WSoTwVTlGPBsQhkZh2PuV0ssteSI0=; b=S1kokANAn1gzMJ0ZWXiSSpny6W4HtRgQp51Z8tMBNYU3HCrH5/1/EV+K1vpDUeUzAOwXuHfAFNkJxfQN/odM8ohkGNbInwNPxY4Z4tDrxuSlM2ETvN//RMamoNHojZemC3kYGez9wC0jQW+o7FGtH6i98tY4uOvlaGZRNd3qBqU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Received: from DM6PR12MB3163.namprd12.prod.outlook.com (2603:10b6:5:15e::26) by DM6PR12MB3562.namprd12.prod.outlook.com (2603:10b6:5:3c::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.22; Fri, 24 Apr 2020 21:27:35 +0000 Received: from DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::9ae:cb95:c925:d5bf]) by DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::9ae:cb95:c925:d5bf%4]) with mapi id 15.20.2937.020; Fri, 24 Apr 2020 21:27:35 +0000 Subject: Re: [PATCH] Allow RDTSC and RDTSCP from userspace To: Dave Hansen , Mike Stunes , joro@8bytes.org Cc: dan.j.williams@intel.com, dave.hansen@linux.intel.com, hpa@zytor.com, jgross@suse.com, jroedel@suse.de, jslaby@suse.cz, keescook@chromium.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, luto@kernel.org, peterz@infradead.org, thellstrom@vmware.com, virtualization@lists.linux-foundation.org, x86@kernel.org, Sean Christopherson References: <20200319091407.1481-56-joro@8bytes.org> <20200424210316.848878-1-mstunes@vmware.com> <2c49061d-eb84-032e-8dcb-dd36a891ce90@intel.com> From: Tom Lendacky Message-ID: Date: Fri, 24 Apr 2020 16:27:32 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 In-Reply-To: <2c49061d-eb84-032e-8dcb-dd36a891ce90@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SN6PR01CA0035.prod.exchangelabs.com (2603:10b6:805:b6::48) To DM6PR12MB3163.namprd12.prod.outlook.com (2603:10b6:5:15e::26) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from office-linux.texastahm.com (67.79.209.213) by SN6PR01CA0035.prod.exchangelabs.com (2603:10b6:805:b6::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13 via Frontend Transport; Fri, 24 Apr 2020 21:27:33 +0000 X-Originating-IP: [67.79.209.213] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: bd7ab3d7-0a07-41bc-b92e-08d7e8964e35 X-MS-TrafficTypeDiagnostic: DM6PR12MB3562: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-Forefront-PRVS: 03838E948C X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB3163.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(136003)(366004)(396003)(39860400002)(346002)(376002)(478600001)(2616005)(956004)(52116002)(4744005)(7416002)(2906002)(26005)(53546011)(31686004)(81156014)(6506007)(8936002)(8676002)(186003)(16526019)(4326008)(5660300002)(6512007)(66556008)(86362001)(66946007)(66476007)(31696002)(36756003)(6486002)(316002)(110136005);DIR:OUT;SFP:1101; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 467goDWZkBEpkhxfDCvcgqEtMW+Lim/F49AB/25Xqk/MsCPCyh+eNLBZGw8qn2J4p1GGXovUvNCflRpjhTwJaFdztA/1m6BbF8N0gLbhs3U3yv1AIt8lXWRY5DZhy0a/W/nW2PMN32OaoGdKrjsv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Yppoionsl98yZPzabDA2bke+wf+Y3mfqwTKry/1rPHy1rUjFmJ6Qy8rz9TSOlDtez/dRcdFjM= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: bd7ab3d7-0a07-41bc-b92e-08d7e8964e35 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2020 21:27:35.2595 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: K9RXoA/3AHh87XPc4HN4aYawXMIxeB/Dbz3DJ/H5rJI0aZiNqtWaU6bviMUqO91ugEJUoULYKTPZNpxvVfdLRw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3562 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/24/20 4:24 PM, Dave Hansen wrote: > On 4/24/20 2:03 PM, Mike Stunes wrote: >> I needed to allow RDTSC(P) from userspace and in early boot in order to >> get userspace started properly. Patch below. >> >> --- >> SEV-ES guests will need to execute rdtsc and rdtscp from userspace and >> during early boot. Move the rdtsc(p) #VC handler into common code and >> extend the #VC handlers. > > Do SEV-ES guests _always_ #VC on rdtsc(p)? Only if the hypervisor is intercepting those instructions. Thanks, Tom >