Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2948560pxk; Mon, 21 Sep 2020 00:56:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+YkLpincGRMe43kbXkQrVdE0N7k94NrlMz6S6VE2oQcU4i4MGob77T3UjPtHp6b4AFBO2 X-Received: by 2002:a17:906:72d2:: with SMTP id m18mr48045391ejl.220.1600674960151; Mon, 21 Sep 2020 00:56:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600674960; cv=none; d=google.com; s=arc-20160816; b=now1SpS9LI9ag/t6kJJevXOH2RAe4dlg1wl7pXMgTvAXIof9hmYs1ym5x94Vv7BUrI /lgJebOXTHmkFaktWZmn6Y/5LceqbFBmZnEUoSAWIAfzSL0qxgAAxgkBENpXKT3j+PGs Je7iNk64TavjZBjtfDExFMoPACGDU0A008r1GiXsg0j6RalqwJAyLuxPsDwEKmqeXrYg kgNjrAybZhRiaNVIuN8gAnzpVtRddMIDkjnpCmRzLohOnYmLXd/OoPqgco5MumdudaBQ wrAwdyOASgiiFLt89Z63UU+ZsBRus5OlLiJ09dCEC2EIqRAyq9g08kaChK69w1ZbMxtF bcGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=2G++eeOF8cxUbk5F9wVp3kaVjonLJ7VVOFgIVwjkZNo=; b=TacSVsuUolMRa+QOnKWwMVBUdpIfaLqs03j9zpfjXaVStz14/lbiwYMGbZOxGLRDcX pVJkyMbced1GgNwFOqKTJ3Y2a4UIAFKIQ+lBxV9lhNQvTGo9C4hehwchGNg0qqTe/C2+ MiMfahSUivEyyEX5jzywjEnsJ5nInOR3oj5kiKTlFgCRivO++4+WIXN978y/GKGt1nVZ LsPSZAIQlsNz8F7osW6l83hQ0UiBNDx0tnTdTEgnUoWoMXwyYhpFykNnTWZdNy63T/10 +5lvHlwGZXufL7TmgotVeShF8Uq8Ai4pgL4ZWr9uBpuqJMiDUgnCqrAySsnoFK1hFDZI +ZGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cQUIyD7S; 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 qx20si7766207ejb.469.2020.09.21.00.55.36; Mon, 21 Sep 2020 00:56:00 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cQUIyD7S; 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 S1726457AbgIUHx3 (ORCPT + 99 others); Mon, 21 Sep 2020 03:53:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:49417 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726413AbgIUHx3 (ORCPT ); Mon, 21 Sep 2020 03:53:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600674808; 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=2G++eeOF8cxUbk5F9wVp3kaVjonLJ7VVOFgIVwjkZNo=; b=cQUIyD7SEdDO0Wo8dWzFqpfqf3dKqsWrVu8NOGe+5n5K9iFpgo6pdLjbnQtS5/X60RfQZ+ 1UDvgR9gPFWBDis9jOhOEwMRzXinpw11lJ3vuv5u7c8Y21rcMn6/ty1nwaz6rgkR52sb35 YyI1wSv9eQ6cq1hBFrpM7NXI6eThzG0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-346-8gqyXM2SNNKAFXor4CE7Cg-1; Mon, 21 Sep 2020 03:53:24 -0400 X-MC-Unique: 8gqyXM2SNNKAFXor4CE7Cg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 82EF810BBECD; Mon, 21 Sep 2020 07:53:22 +0000 (UTC) Received: from starship (unknown [10.35.206.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 844A57882C; Mon, 21 Sep 2020 07:53:18 +0000 (UTC) Message-ID: <5a3538861a65973f9ae6e2d0798ac17f52428ded.camel@redhat.com> Subject: Re: [PATCH v4 2/2] KVM: nSVM: implement ondemand allocation of the nested state From: Maxim Levitsky To: Paolo Bonzini , Sean Christopherson Cc: 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 Date: Mon, 21 Sep 2020 10:53:17 +0300 In-Reply-To: References: <20200917101048.739691-1-mlevitsk@redhat.com> <20200917101048.739691-3-mlevitsk@redhat.com> <20200917162942.GE13522@sjchrist-ice> <20200920161602.GA17325@linux.intel.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.3 (3.36.3-1.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2020-09-20 at 18:42 +0200, Paolo Bonzini wrote: > On 20/09/20 18:16, Sean Christopherson wrote: > > > 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. > > So did I, and that's why we get KVM_REQ_OUT_OF_MEMORY. But it was more > of an "it's ugly and it ought not to fail" thing than something I could > pinpoint. > > It looks like we agree, but still we have to choose the lesser evil? > > Paolo > > > 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(). The thing is that kvm_emulate_wrmsr injects #GP when kvm_set_msr returns any non zero value, and returns 1 which means keep on going if I understand correctly (0 is userspace exit, negative value would be a return to userspace with an error) So the question is if we have other wrmsr handlers which return negative value, and would be affected by changing kvm_emulate_wrmsr to pass through the error value. I am checking the code now. I do agree now that this is the *correct* solution to this problem. Best regards, Maxim Levitsky