Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1070986pxb; Fri, 13 Nov 2020 03:31:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJxuz1GmFYyJKtVSRtHH+g9FtDbFsrI5orGgBkPVIFr7e7r+K/52tu0mN+yafihAZSUi6pP8 X-Received: by 2002:a17:906:4cca:: with SMTP id q10mr1409741ejt.181.1605267117897; Fri, 13 Nov 2020 03:31:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605267117; cv=none; d=google.com; s=arc-20160816; b=xJcEbSFdwqRUQNVoOt0dTFrF1Pbix4uBg9qjEj0tmipnshuB3k5vvSdJM6BfEpbGen Dq9HMP1+UmNg1X/EKT20LZwndb8Erhv9gkpo9adB0icY/oGLt0+fGPE3t5TMyLtkB7YM TmgDLB5K2cXv2cwLBQJaM8xwPouH00lC4skDjpzzRYqyrY7bbCx61zqbFLMilpzJGi9+ xQNbuwCvmYYv6OANiujSCrM5bD38NU0O5dBruvwjp1RMHpZ7JetDEz89JYKI/5LZ3HaX o8h7J/arRqWb6hGu1DkAEQzQuC4amTefsF1pjzpbXP5e1C2lvsl/Lg/Ra+GDL/1lkraO pRXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=8Jz+qn6L2dKOdzkMNeYJ7i10uOGTnka7jGpACGkgmZc=; b=vjGqnWfXEttaK+wt05zl1ve+OjBqKXd8lcaXHsWMJ9S5HoSzanJjFz2s5Pl1b/UzYa 9OTEXGjvnNoi9oAO1CwxtexhKaNLjgHN9AYpKR8hx1kPWAyAH4bk0Uyj3QxIkCL58YMS TAZeQIc/PfrFxSEYFnXuDcjMc8NJcaqNQgNAfRsNFAXNJ14SQhQIfoFW4yO3RGonj+Fn qSNHSbQcfA7tWmiwV2Aax6gKw7Xr8Ws2xUz9g9Dz1RCYDCqkl3CBhTIMS+qJIZctWPHv KlWYMJ/zUJPqBLFOw4uZ4n/E6n+SFQwos8aUk0sE1lXnYf9WKFV9zxfMMjkGdpMJhnx5 wyzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IG4lTBmx; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n18si5386783eje.443.2020.11.13.03.31.32; Fri, 13 Nov 2020 03:31:57 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=IG4lTBmx; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726560AbgKML2V (ORCPT + 99 others); Fri, 13 Nov 2020 06:28:21 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:30969 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726237AbgKML0b (ORCPT ); Fri, 13 Nov 2020 06:26:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605266785; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8Jz+qn6L2dKOdzkMNeYJ7i10uOGTnka7jGpACGkgmZc=; b=IG4lTBmx8LR5smq1hHHZyUNd9qnLVJOvd1JlfScJvJK4VNKqXGMS4SAI1z/Vwxcp8PNyyJ TooZj+dU8iyGjhIzr65RHcsEMe9TL7PkmYyqbn0/vskJYJI3A6Rzwbq5eSR410AstlerTb bDi+RSGv4ndgEiG3Yv51MjxYogyFGgs= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-587-2wGfXzNZOIWdp31Tjarp-w-1; Fri, 13 Nov 2020 06:26:23 -0500 X-MC-Unique: 2wGfXzNZOIWdp31Tjarp-w-1 Received: by mail-wm1-f70.google.com with SMTP id s3so3761902wmj.6 for ; Fri, 13 Nov 2020 03:26:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=8Jz+qn6L2dKOdzkMNeYJ7i10uOGTnka7jGpACGkgmZc=; b=NI/kBrZeT9WBi/08+YVGf+nm0+n+IcSAuv2RbP1sOOpYFHZ950wfnfjMKPl6R9ei7e g1faYYCO8Q1S0rmJZzPYakW9XAyLNRewvcVGT2qUm8CgVJ4akAwmyEkJCyzG4GVOZBO/ Cj/Q380BkAQKdWR7MjdxZJJ8ITESHqLl1VbbOyMA+/k+8eofwxZqATZmeX1WDDoQQe8M A3yznCkReEkUA/MpMsqZyJ3Qqp9MGGM/ttqWzgVC61VQHXPKwft9p4qQExB+U7Inhws1 7JQgiVG3u4/fCUV1BEdMjdS8YUDzJ3Szp0jka9Qgr7Mn/XgV0Vi+MV1W63w/m3+rUvX7 0DDg== X-Gm-Message-State: AOAM531ZGiKPKEJO44+jvrwZ7iLUxNgR4P4jfNb+lUtGl3sx7W0t22qT BGwA0QLyu8l20pzT1foXR6nfGqAOe1/dUF8QDK4G99PfHLMkMzSK7id7SO11QOAcU2Mpt2EmV/C /D7Sgg442UvsNcs7/OpNlvMps X-Received: by 2002:adf:f9c4:: with SMTP id w4mr2968113wrr.64.1605266782231; Fri, 13 Nov 2020 03:26:22 -0800 (PST) X-Received: by 2002:adf:f9c4:: with SMTP id w4mr2968095wrr.64.1605266782064; Fri, 13 Nov 2020 03:26:22 -0800 (PST) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id g186sm19977226wma.1.2020.11.13.03.26.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Nov 2020 03:26:21 -0800 (PST) Subject: Re: [PATCH] KVM: x86: clflushopt should be treated as a no-op by emulation To: David Edmondson , linux-kernel@vger.kernel.org Cc: Vitaly Kuznetsov , Nadav Amit , x86@kernel.org, Wanpeng Li , kvm@vger.kernel.org, Thomas Gleixner , Sean Christopherson , "H. Peter Anvin" , Joerg Roedel , Jim Mattson , Borislav Petkov , Ingo Molnar References: <20201103120400.240882-1-david.edmondson@oracle.com> From: Paolo Bonzini Message-ID: <72b96832-634a-56f0-95aa-f9a282d8fbf8@redhat.com> Date: Fri, 13 Nov 2020 12:26:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201103120400.240882-1-david.edmondson@oracle.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/11/20 13:04, David Edmondson wrote: > The instruction emulator ignores clflush instructions, yet fails to > support clflushopt. Treat both similarly. > > Fixes: 13e457e0eebf ("KVM: x86: Emulator does not decode clflush well") > Signed-off-by: David Edmondson > --- > arch/x86/kvm/emulate.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c > index 0d917eb70319..56cae1ff9e3f 100644 > --- a/arch/x86/kvm/emulate.c > +++ b/arch/x86/kvm/emulate.c > @@ -4046,6 +4046,12 @@ static int em_clflush(struct x86_emulate_ctxt *ctxt) > return X86EMUL_CONTINUE; > } > > +static int em_clflushopt(struct x86_emulate_ctxt *ctxt) > +{ > + /* emulating clflushopt regardless of cpuid */ > + return X86EMUL_CONTINUE; > +} > + > static int em_movsxd(struct x86_emulate_ctxt *ctxt) > { > ctxt->dst.val = (s32) ctxt->src.val; > @@ -4585,7 +4591,7 @@ static const struct opcode group11[] = { > }; > > static const struct gprefix pfx_0f_ae_7 = { > - I(SrcMem | ByteOp, em_clflush), N, N, N, > + I(SrcMem | ByteOp, em_clflush), I(SrcMem | ByteOp, em_clflushopt), N, N, > }; > > static const struct group_dual group15 = { { > Queued, thanks. Paolo