Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp513437ybx; Wed, 6 Nov 2019 04:18:40 -0800 (PST) X-Google-Smtp-Source: APXvYqzLgOhVacvyBunUKHbYhMvDzsZte305BlJd5W4pQ/NE0o+6UsCcb4hi+j7Paqqf47Krmlgx X-Received: by 2002:aa7:c314:: with SMTP id l20mr2332702edq.34.1573042720855; Wed, 06 Nov 2019 04:18:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573042720; cv=none; d=google.com; s=arc-20160816; b=b38dlgFhrpyuCEOZGGMnLLlZfKGMI7sTp+Xm5eeQC4qAeCjZMF1mNU6mOK7wnVKOQ8 L6ThC/T2kM7GzEI9royFdbAqNgiX6e5S1D6nh4rxa3gChHaXcqtyeo3gqMcGg/xz6Cda H8NgXAuiav3tCJXvterTlGBDIxOLwVydEtL35UAjEI7b1FfxEdWHweXm2gxjl9iBQ5op fDgDStAjdktGFQk+2wi4DOn1hxV0g+ER43CGVVG5ZzsNdTIfZkxXng2FRyzXx/UoJEC2 27G26CTsGizv7QregcAuPIP8Ov8Vw3Zs1KXKj+DsuTBIr+Yw+YCMnL9kgSjguis8Fd9P U/gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:openpgp:from:references:cc:to:subject; bh=3JkGp+uV4EX2YLZVMnoCzXMV7AWPPY0mdAbm7lpOXew=; b=BmeIQ5uHM4gQCCqHbL8IpCFlxOTFqeMMYeRuvuh54fuApkWSVmBWSfHhnlS+xb9fPb ZpA7LnqDP60lakGVcDOiAgTFPktSgZnkSupOAce95ZXuwyyUrbA0YMBbiXUNny8c5qZ3 HS3/7kzGwl9cFCjFQSLnK898eUR5asYD+SmluoTa2/43omp5OaNLc8+JMI7JpoTkH+3Q 31si1AJguE2ptXkqhFGZ5N//xcKWzqk2Bv4KdGTj8N16M4neotgECNrjj+bIIJlG5K1P ddsv9ZDE3uddhHSztqOw4D3dE2bVTH4LDnwFPtWC1zNMdmJw1eAu8L4pZ3NdpArfqhfq V3DQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g19si13018171edb.280.2019.11.06.04.18.16; Wed, 06 Nov 2019 04:18:40 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730341AbfKFMRo (ORCPT + 99 others); Wed, 6 Nov 2019 07:17:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51104 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725856AbfKFMRo (ORCPT ); Wed, 6 Nov 2019 07:17:44 -0500 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ECA6F5AFF8 for ; Wed, 6 Nov 2019 12:17:43 +0000 (UTC) Received: by mail-wm1-f71.google.com with SMTP id 2so1108494wmd.3 for ; Wed, 06 Nov 2019 04:17:43 -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:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=3JkGp+uV4EX2YLZVMnoCzXMV7AWPPY0mdAbm7lpOXew=; b=XcyZoupnHgZdqk0NH3wDL3Qd0QF5C39MZEnNkMcgddFkggSKQncy56aSbaJE67cYcl X6Q4ZDjqjWKTs1WYcn+jf8me3XAx6LgSayf/afO9qWXEQEg8Q1I+h0xWQc0BQRgucLYn woP6Ji2vhkvXR3Iq/WgeEntTQB+a2ai+3/oGDmCunu8hgmE6QagGgQA67EAIX9EGd619 1HhT0tmjv8ZDm5sDK8v869H8VlXXqiu/YZ5YFO7qi63V4ZHx3HfQ/ROJzDPp5boLmzKc T1GiKWk5vFRU0nwOIif5nPRE3aEhTkqJ/V2QrFgO8At31etU13wkHfpYAZgt37QDF5Ct pIlQ== X-Gm-Message-State: APjAAAUhhf4SIRI8H/h5qocbOXMrDiSpBz71Jf+ZtTIXywd+95nA562L chE8EGEBkhr3/HtrERdJxd5HKlYpiqYOQkfz8JlgmuNca8A0QuErNmveSC4mApE91hllA92DdKf 7fYSPDmUmFAeDzp0EtPKvpQQO X-Received: by 2002:adf:e94e:: with SMTP id m14mr2467676wrn.233.1573042662550; Wed, 06 Nov 2019 04:17:42 -0800 (PST) X-Received: by 2002:adf:e94e:: with SMTP id m14mr2467638wrn.233.1573042661943; Wed, 06 Nov 2019 04:17:41 -0800 (PST) Received: from [192.168.10.150] ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id x7sm46454174wrg.63.2019.11.06.04.17.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 Nov 2019 04:17:41 -0800 (PST) Subject: Re: [PATCH v2 00/14] KVM: x86: Remove emulation_result enums To: Sean Christopherson , Alexander Graf Cc: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Liran Alon References: <20190827214040.18710-1-sean.j.christopherson@intel.com> <8dec39ac-7d69-b1fd-d07c-cf9d014c4af3@redhat.com> <686b499e-7700-228e-3602-8e0979177acb@amazon.com> <20191106005806.GK23297@linux.intel.com> From: Paolo Bonzini Openpgp: preference=signencrypt Message-ID: <3d827e8b-a04e-0a93-4bb4-e0e9d59036da@redhat.com> Date: Wed, 6 Nov 2019 13:17:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20191106005806.GK23297@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/11/19 01:58, Sean Christopherson wrote: >> enum kvm_return { >> KVM_RET_USER_EXIT = 0, >> KVM_RET_GUEST = 1, >> }; >> >> and then consistently use them as return values? That way anyone who has not >> worked on kvm before can still make sense of the code. > Hmm, I think it'd make more sense to use #define instead of enum to > hopefully make it clear that they aren't the *only* values that can be > returned. That'd also prevent anyone from changing the return types from > 'int' to 'enum kvm_return', which IMO would hurt readability overall. > > And maybe KVM_EXIT_TO_USERSPACE and KVM_RETURN_TO_GUEST? That would be quite some work. Right now there is some consistency between all of: - x86_emulate_instruction and its callers - vcpu->arch.complete_userspace_io - vcpu_enter_guest/vcpu_block - kvm_x86_ops->handle_exit so it would be very easy to end up with a half-int-half-enum state that is more confusing than before... I'm more worried about cases where we have functions returning either 0 or -errno, but 0 lets you enter the guest. I'm not sure if the only one is kvm_mmu_reload or there are others. Paolo