From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6535C433FE for ; Thu, 23 Sep 2021 00:59:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CD87C61090 for ; Thu, 23 Sep 2021 00:59:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238772AbhIWBAo (ORCPT ); Wed, 22 Sep 2021 21:00:44 -0400 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:54947 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237852AbhIWBAn (ORCPT ); Wed, 22 Sep 2021 21:00:43 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R271e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=hao.xiang@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0UpGxa-f_1632358750; Received: from 192.168.3.6(mailfrom:hao.xiang@linux.alibaba.com fp:SMTPD_---0UpGxa-f_1632358750) by smtp.aliyun-inc.com(127.0.0.1); Thu, 23 Sep 2021 08:59:11 +0800 Message-ID: <84cd2713-3cc4-3120-946e-0cf8b8a8187d@linux.alibaba.com> Date: Thu, 23 Sep 2021 08:59:11 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.1.1 Subject: Re: [PATCH] KVM: VMX: Check if bus lock vmexit was preempted Content-Language: en-US To: Paolo Bonzini , Xiaoyao Li , kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, chenyi.qiang@intel.com, shannon.zhao@linux.alibaba.com, Sean Christopherson , hao.xiang@linux.alibaba.com References: <1631964600-73707-1-git-send-email-hao.xiang@linux.alibaba.com> <87b411c3-da75-e074-91a4-a73891f9f5f8@redhat.com> <57597778-836c-7bac-7f1d-bcdae0cd6ac4@intel.com> From: Hao Xiang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/9/22 20:40, Paolo Bonzini wrote: > On 22/09/21 12:32, Xiaoyao Li wrote: >>> >> >> EXIT_REASON.bus_lock_detected may or may not be set when exit reason >> == EXIT_REASON_BUS_LOCK. Intel will update ISE or SDM to state it. >> >> Maybe we can do below in handle_bus_lock_vmexit handler: >> >>      if (!to_vmx(vcpu)->exit_reason.bus_lock_detected) >>          to_vmx(vcpu)->exit_reason.bus_lock_detected = 1; >> >> But is manually changing the hardware reported value for software >> purpose a good thing? > > No.  That said, Hao's patch is just making the code clearer; there's > no behavioral change since the "if" will just redo the same > assignments as handle_bus_lock_vmexit. > > Paolo I agree Paolo. EXIT_REASON.bus_lock_detected may or may not be set when exit_reason=EXIT_REASON_BUS_LOCK,  It clould depend on hardware implementaion. No matter when intel states it clearly, I think it is better that we avoid repeated assignment by adding additional check condition in vmx_handle_exit.  Of course , it is also ok that hand_bus_lock_vmexit do nothing , but the code is not clear, and the code logic will be inconsistent with spec description.