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=-0.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 52679C34031 for ; Wed, 19 Feb 2020 01:59:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 30EFB24656 for ; Wed, 19 Feb 2020 01:59:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728171AbgBSB7M convert rfc822-to-8bit (ORCPT ); Tue, 18 Feb 2020 20:59:12 -0500 Received: from szxga02-in.huawei.com ([45.249.212.188]:3015 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728049AbgBSB7M (ORCPT ); Tue, 18 Feb 2020 20:59:12 -0500 Received: from DGGEMM405-HUB.china.huawei.com (unknown [172.30.72.55]) by Forcepoint Email with ESMTP id 89678D537310C44376DD; Wed, 19 Feb 2020 09:59:10 +0800 (CST) Received: from dggeme751-chm.china.huawei.com (10.3.19.97) by DGGEMM405-HUB.china.huawei.com (10.3.20.213) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 19 Feb 2020 09:59:09 +0800 Received: from dggeme753-chm.china.huawei.com (10.3.19.99) by dggeme751-chm.china.huawei.com (10.3.19.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 19 Feb 2020 09:59:10 +0800 Received: from dggeme753-chm.china.huawei.com ([10.7.64.70]) by dggeme753-chm.china.huawei.com ([10.7.64.70]) with mapi id 15.01.1713.004; Wed, 19 Feb 2020 09:59:09 +0800 From: linmiaohe To: Sean Christopherson CC: "pbonzini@redhat.com" , "rkrcmar@redhat.com" , "vkuznets@redhat.com" , "wanpengli@tencent.com" , "jmattson@google.com" , "joro@8bytes.org" , "tglx@linutronix.de" , "mingo@redhat.com" , "bp@alien8.de" , "hpa@zytor.com" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "x86@kernel.org" Subject: Re: [PATCH] KVM: VMX: replace "fall through" with "return true" to indicate different case Thread-Topic: [PATCH] KVM: VMX: replace "fall through" with "return true" to indicate different case Thread-Index: AdXmxq8nqVWWRnoHQZaSjPcZ82TtoQ== Date: Wed, 19 Feb 2020 01:59:09 +0000 Message-ID: <94f330693be7431fa6d586cc317c26bc@huawei.com> Accept-Language: en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.173.221.158] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sean Christopherson wrote: >On Tue, Feb 18, 2020 at 11:39:28AM +0800, linmiaohe wrote: >> From: Miaohe Lin >> >> @@ -4495,7 +4495,7 @@ static bool rmode_exception(struct kvm_vcpu *vcpu, int vec) >> if (vcpu->guest_debug & >> (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP)) >> return false; >> - /* fall through */ >> + return true; > >I prefer the current code, i.e. the fall through. This code is already burdened with a fall through, from #BP->#DB, and IMO the fall through makes it more obvious that the vcpu->guest_debug checks are corner cases, while everything else is handled by common logic. Yeh, it looks better this way. But from a different perspective, "return turn" here indicates #BP and #DB need do vcpu->guest_debug checks, while others not. Thanks. :) > >> case DE_VECTOR: >> case OF_VECTOR: >> case BR_VECTOR: