Received: by 10.223.185.116 with SMTP id b49csp957203wrg; Fri, 23 Feb 2018 09:23:44 -0800 (PST) X-Google-Smtp-Source: AH8x224RA23AYUC+FZlm9U/R8kkPUQWp+Y121QdACxeoQrUNCSajXE9cz61TeCrH56b0OgiEB3d3 X-Received: by 2002:a17:902:aa8d:: with SMTP id d13-v6mr2373688plr.114.1519406623978; Fri, 23 Feb 2018 09:23:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519406623; cv=none; d=google.com; s=arc-20160816; b=m1ZOuFuMyLdRmBb6Hmr3TJZ0wqjC40e8cT7hPxYKk5XT30+cvHcWYUY8KWWYVCzD9J tkRFNAOmRAIBe/Bq8pLa0ei+E9VbvgxXQk6VXoeAzvEK1L+QgX/S6qIgpoGR6Sp1RW1v yEnhcusN+gpt1mkObCDp5ca/6MyOX17+ifiBvTzGXzCCMAEfgcguTgg5O5EtVAGeZmzE ANME55wAE2u7JwzPipBxzGI//qZDQaUgtyRRibcSYOPDJ46JE5k/qYW86wz1NAe8SNYE uoS1qtMggT4eYyxInSCHXHPA9W0NDj//r6BF3cOl/VqMU/oDGqfwpnqeOn0KxDvHORbZ uT8g== 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:dkim-signature:arc-authentication-results; bh=L9oVXZtrekz1WwkweOqrW7fKNEvGH49/gjYLUINdaCY=; b=kMhKKcg7lWgNAgpCBlgeqwQoy4qrPgZPmMfupJfLBeSrM/98ZSTkym8Z6IAcvkjG19 CY7ncD1LhSNUE+AQhvxAz/V8GZgB6g+3R0FZ6ASueq/Guwl2TUHL+f8vl27m1oTDw4A8 GRPtsqjUJvqEXjsju3HJz512gS3Zcg3ISTtIiQfGCAxY9CQ7am0pBQIrQr698YOj00T8 pXhQObmngYflv0u8OYDn/g8JLissmiAotoDBnXzrKXVVbHWkyerAAJ0x/YEB/eHN6jdW hn2tYO0EMXhTxu1vBuxkCFRzAEnoSHRRjd4EDD0pQzpEQIvhZZAt3JiVdgifPFwVyFW6 Vrzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=Bw/D2lvL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f4-v6si2055743plt.765.2018.02.23.09.23.29; Fri, 23 Feb 2018 09:23:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=Bw/D2lvL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751897AbeBWRWl (ORCPT + 99 others); Fri, 23 Feb 2018 12:22:41 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:42340 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751836AbeBWRWj (ORCPT ); Fri, 23 Feb 2018 12:22:39 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1NHMOqD160396; Fri, 23 Feb 2018 17:22:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2017-10-26; bh=L9oVXZtrekz1WwkweOqrW7fKNEvGH49/gjYLUINdaCY=; b=Bw/D2lvL6YhSy7ySSBJGbfGK+hJs38g/lwCwGdTCXSxmY015yxgjEx9uqc1h/qTB2EGn psdQlEMaDCtX6itPLX4r/bzh4JayilfcGfUfi0hP3fHlWNbPEMxJJAQoUj1OU7lAN0sg huhC7qfxVMdzpC4JuZKS0VMXhDzVZrxyADCJ3I0WNQa9wyBhxcI6/ECEqcFadZ/5m9Wv USWYZ8wDIEfTWlM3G6gIJ4CtyNW5xDribBRvU78qAOuYN+zwOK5ftTM+7JOH9sPZVG3Y qLpzmMJxKo6FI0DNwBKQ6pfPsX5jwCZOszHzmyHJgEltRvt7jMCFLArcTCpjg/ujjJH1 cQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2gamj2gyyn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Feb 2018 17:22:24 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w1NHMNRG017699 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 23 Feb 2018 17:22:23 GMT Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w1NHMMRf009759; Fri, 23 Feb 2018 17:22:22 GMT Received: from char.us.oracle.com (/10.137.176.158) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 23 Feb 2018 09:22:22 -0800 Received: by char.us.oracle.com (Postfix, from userid 1000) id 0BC5E6A00FB; Fri, 23 Feb 2018 12:22:20 -0500 (EST) Date: Fri, 23 Feb 2018 12:22:20 -0500 From: Konrad Rzeszutek Wilk To: Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, x86@kernel.org, Radim =?utf-8?B?S3LEjW3DocWZ?= , KarimAllah Ahmed , David Woodhouse , Jim Mattson , Thomas Gleixner , Ingo Molnar , stable@vger.kernel.org Subject: Re: [PATCH 1/3] KVM: x86: use native MSR ops for SPEC_CTRL Message-ID: <20180223172220.GK8252@char.us.oracle.com> References: <1519249297-73718-1-git-send-email-pbonzini@redhat.com> <1519249297-73718-2-git-send-email-pbonzini@redhat.com> <20180222170717.GP31483@char.us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.3 (2017-05-23) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8813 signatures=668678 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=896 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802230215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 23, 2018 at 10:37:49AM +0100, Paolo Bonzini wrote: > On 22/02/2018 18:07, Konrad Rzeszutek Wilk wrote: > >> Having a paravirt indirect call in the IBRS restore path is not a > >> good idea, since we are trying to protect from speculative execution > >> of bogus indirect branch targets. It is also slower, so use > >> native_wrmsrl on the vmentry path too. > > But it gets replaced during patching. As in once the machine boots > > the assembler changes from: > > > > callq *0xfffflbah > > > > to > > wrmsr > > > > ? I don't think you need this patch. > > Why not be explicit? According to the spec, PRED_CMD and SPEC_CTRL Explicit is fine. But I would recommend you change the commit message to say so, and perhaps remove 'It is also slower' - as that is incorrect. > should be passed down to the guest without interception so it's safe to > do this. On the other hand, especially with nested virtualization, I > don't think you can absolutely guarantee that the paravirt call will be > patched to rdmsr/wrmsr. If it is detected to be Xen PV, then yes it will be a call to a function. But that won't help as Xen PV runs in ring 3, so it has a whole bunch of other issues. If it detects it as KVM or Xen HVM guest it will patch it with the default - which is normal MSRs. Ditto for HyperV. But no biggie - explicit is fine, just nagging on the commit message could use a bit of expansion. > Paolo >