Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2585707pxk; Sun, 20 Sep 2020 09:18:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGfugi6a0cW1/dmOx86QAbkQMMZdZz1AXperAnByr+Vgx37GGb6dc6VaiZcG4MdZqVmLj/ X-Received: by 2002:a17:906:a947:: with SMTP id hh7mr44067522ejb.126.1600618695372; Sun, 20 Sep 2020 09:18:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600618695; cv=none; d=google.com; s=arc-20160816; b=BGGNmHsZaJAauk990nd02N4/uoOcXTNUhKBFQC1hbVFlMW/fi3+6N6KQxfqXmjNxEL Z9Atdwvj2KkMZHODE71aneVUcipJfiKytSb0E3e/aiHMczXrueqUqrI+Gztx2lhntEi7 WVuu2+/aYUHty9Q3k7aFTjD7exd8YqJn532cYmhH7ohfoU8iGq4TySd/A11yX+A3+dV5 EZeJK/+7Mu5ywbMjuV9dV8I4XA0ImMeUg2Gt6U3U79ogRrKGZ6T30fSJgbY9rsfSAku9 USwHc4B7aqDKrjE24SKO+qbYIdmgVZtl3OIe+diVlX2kHtYDFm0k2QS+9GRPYT61pFKL +0FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=/kWnqXrmbNnKVKApIsW6t2RNJuOEdoDJzOEfSJ0us8s=; b=afqbCTa7eCUlM/CP27hXQHZI7a43g49QO4UySV6zrKjmVB26oXGtx9l6rMQyyLiOj+ hs3jKHr5bB3X0Idlx4ZAyIa7dBohSOMd5MUf3R2V7GLu4U2uuoyeiaKCYwYbUUiIAfP4 SFylT2aF+GJ8qZLm25XeCrl420q4lic2zoktaBw4cZGhaRua/aLQ3cQXt8EC2A2tfKSx aOXNsLe5wpv5cPSzCT1hhLW4ONYK5S2N2EC0RphuQ35yiO+hapccBizZJt2stc4B0wPk 8RuClGLqiTXRL7qopEM5GMcEDv6e4C2YSwR44Xqjc4dKyDdimtcyructGk/EcnZKIuL8 eCZA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ju7si6521982ejb.418.2020.09.20.09.17.37; Sun, 20 Sep 2020 09:18:15 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726375AbgITQQE (ORCPT + 99 others); Sun, 20 Sep 2020 12:16:04 -0400 Received: from mga02.intel.com ([134.134.136.20]:34883 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726311AbgITQQD (ORCPT ); Sun, 20 Sep 2020 12:16:03 -0400 IronPort-SDR: Z/btV2oIZEGEE4OQBmo0xIMclj5hatdZqETj6rkChzv1weMYldD50leviV/xs7ANQWDPZohkAK vcowZdJMwHcQ== X-IronPort-AV: E=McAfee;i="6000,8403,9750"; a="147907847" X-IronPort-AV: E=Sophos;i="5.77,283,1596524400"; d="scan'208";a="147907847" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2020 09:16:03 -0700 IronPort-SDR: 2OiPkCNNx5PxzODqcuEyjmlGwl+i9mA/YoOKObe+NWpf6W3Imv6Rv9aqis8zuAINJgB2P3Fa99 forf2oD8sLNA== X-IronPort-AV: E=Sophos;i="5.77,283,1596524400"; d="scan'208";a="453615387" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.160]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Sep 2020 09:16:03 -0700 Date: Sun, 20 Sep 2020 09:16:02 -0700 From: Sean Christopherson To: Paolo Bonzini Cc: Maxim Levitsky , kvm@vger.kernel.org, Vitaly Kuznetsov , Ingo Molnar , Wanpeng Li , "H. Peter Anvin" , Borislav Petkov , Jim Mattson , Joerg Roedel , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , linux-kernel@vger.kernel.org, Thomas Gleixner Subject: Re: [PATCH v4 2/2] KVM: nSVM: implement ondemand allocation of the nested state Message-ID: <20200920161602.GA17325@linux.intel.com> References: <20200917101048.739691-1-mlevitsk@redhat.com> <20200917101048.739691-3-mlevitsk@redhat.com> <20200917162942.GE13522@sjchrist-ice> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 19, 2020 at 05:09:09PM +0200, Paolo Bonzini wrote: > On 17/09/20 18:29, Sean Christopherson wrote: > >> + vcpu->arch.efer = old_efer; > >> + kvm_make_request(KVM_REQ_OUT_OF_MEMORY, vcpu); > > I really dislike KVM_REQ_OUT_OF_MEMORY. It's redundant with -ENOMEM and > > creates a huge discrepancy with respect to existing code, e.g. nVMX returns > > -ENOMEM in a similar situation. > > Maxim, your previous version was adding some error handling to > kvm_x86_ops.set_efer. I don't remember what was the issue; did you have > any problems propagating all the errors up to KVM_SET_SREGS (easy), > kvm_set_msr (harder) etc.? I objected to letting .set_efer() return a fault. A relatively minor issue is the code in vmx_set_efer() that handles lack of EFER because technically KVM can emulate EFER.SCE+SYSCALL without supporting EFER in hardware. Returning success/'0' would avoid that particular issue. My primary concern is that I'd prefer not to add another case where KVM can potentially ignore a fault indicated by a helper, a la vmx_set_cr4(). To that end, I'd be ok with adding error handling to .set_efer() if KVM enforces, via WARN in one of the .set_efer() call sites, that SVM/VMX can only return negative error codes, i.e. let SVM handle the -ENOMEM case but disallow fault injection. It doesn't actually change anything, but it'd give me a warm fuzzy feeling.