Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1155612ybz; Sat, 25 Apr 2020 12:12:21 -0700 (PDT) X-Google-Smtp-Source: APiQypLa+6+Yrq+psJb8S7uRIFuoNdIof/sf12T3N7inIFKYA75wBDAc0AedbM8BXQIsyRYPw9TB X-Received: by 2002:aa7:cdd9:: with SMTP id h25mr13174421edw.17.1587841941403; Sat, 25 Apr 2020 12:12:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587841941; cv=none; d=google.com; s=arc-20160816; b=qcEy1YoBCdGVuzdRHNvB4DmmolU0X0pZWl7fD3U1FQZPAE0nO1cwL3QMY6/RFucuwB AByZqakjvruG/NAzGwd4wvyS24Ujh6tVQKnYyYqtcJ8WlDbQpa8xozhURAX5fom2Hk9k NVWNFlPlaNgKgt6h2kqxWkYsw1tJwfiAhlEfVhDm/IPf50fUydbm1Qvz5b6fPNvDswyf jR5NaNVCAJW/2wJnlluJufKteBGrdlcWozCwFRjK+TOnBrOnhH3jQ6oUHvBJOVEvpazP ToVpKrNgkJNHmT0XDvHlQ8T/SN6KW3CDCFmqIZRtsULTWbT158ip6y1oUt1jR+hnRz+s 7RaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=4yQbr64JLhObds6+rRxtJWXTRJ9XQtbJev/NBm0MF2o=; b=F3F7AhEavvGFqKlNNDU/N0MnAR/volIEqvUVjXUhGWwBOvfgUwIsEjEoKecXiyPnBg hIjW6350n56bm//q+zq6BqIDdPs8l9t89ueZk9zcMPta/D1lbjQNIMH4g05ZquEIwVH3 AOP7rsxuxkv5AtFbi+TeBVFq2I4TDWZxmlhGU9hHSx8+KUt/HXA8L+iVh1bZZLJmTEt4 KMf0t0RElJZoXdVHK0zZwfOIU7168tegf/WnfGoGRxW9Ng1o2ROx1hzoi/UVRCR6nsq9 gYpz2aF25RNNB1fbH8OvxTs2ySVxt8sfU+fBE+2SnX6g4IaGuPesi7ON5sO8Xu4RBWQj FoRA== ARC-Authentication-Results: i=1; mx.google.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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y21si5285482ejq.259.2020.04.25.12.11.57; Sat, 25 Apr 2020 12:12:21 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726359AbgDYTKi (ORCPT + 99 others); Sat, 25 Apr 2020 15:10:38 -0400 Received: from 8bytes.org ([81.169.241.247]:37020 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726192AbgDYTKh (ORCPT ); Sat, 25 Apr 2020 15:10:37 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id ED5AD433; Sat, 25 Apr 2020 21:10:35 +0200 (CEST) Date: Sat, 25 Apr 2020 21:10:32 +0200 From: Joerg Roedel To: Andy Lutomirski Cc: Joerg Roedel , Dave Hansen , Tom Lendacky , Mike Stunes , Dan Williams , Dave Hansen , "H. Peter Anvin" , Juergen Gross , Jiri Slaby , Kees Cook , kvm list , LKML , Peter Zijlstra , Thomas Hellstrom , Linux Virtualization , X86 ML , Sean Christopherson Subject: Re: [PATCH] Allow RDTSC and RDTSCP from userspace Message-ID: <20200425191032.GK21900@8bytes.org> References: <20200319091407.1481-56-joro@8bytes.org> <20200424210316.848878-1-mstunes@vmware.com> <2c49061d-eb84-032e-8dcb-dd36a891ce90@intel.com> <4d2ac222-a896-a60e-9b3c-b35aa7e81a97@intel.com> <20200425124909.GO30814@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 25, 2020 at 11:15:35AM -0700, Andy Lutomirski wrote: > shift_ist is gross. What's it for? If it's not needed, I'd rather > not use it, and I eventually want to get rid of it for #DB as well. The #VC handler needs to be able to nest, there is no way around that for various reasons, the two most important ones are: 1. The #VC -> NMI -> #VC case. #VCs can happen in the NMI handler, for example (but not exclusivly) for RDPMC. 2. In case of an error the #VC handler needs to print out error information by calling one of the printk wrappers. Those will end up doing IO to some console/serial port/whatever which will also cause #VC exceptions to emulate the access to the output devices. Using shift_ist is perfect for that, the only problem is the race condition with the NMI handler, as shift_ist does not work well with exceptions that can also trigger within the NMI handler. But I have taken care of that for #VC. Regards, Joerg