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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B90F3C433F5 for ; Sun, 27 Mar 2022 15:15:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235825AbiC0PQi (ORCPT ); Sun, 27 Mar 2022 11:16:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231449AbiC0PQg (ORCPT ); Sun, 27 Mar 2022 11:16:36 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 30677506E7 for ; Sun, 27 Mar 2022 08:14:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1648394097; 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=aO0HGjT7ZCP54sd0nyJvdO8KKuk8vcPL3oF3GsN92ZE=; b=SNswb3xSgkvYu6XDGOKqvcJl86wT7RMxeA25H1RTOvl7+JfXvpxEsbdcGsoCrc1a4fs2cn ERrWlosJhTYBgNRPtYo1gOqtcfzg7btnPzz54wSzdqiAdlJHY/WWfbLLr1hvaCQgayLF90 D5YUySikyFrL6E3OXI4Z9NW5sW/F20k= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-494-ORdutjHEP4arkCb2xFdKWg-1; Sun, 27 Mar 2022 11:14:53 -0400 X-MC-Unique: ORdutjHEP4arkCb2xFdKWg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 44DD0185A79C; Sun, 27 Mar 2022 15:14:53 +0000 (UTC) Received: from starship (unknown [10.40.194.231]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4D9531402404; Sun, 27 Mar 2022 15:14:50 +0000 (UTC) Message-ID: Subject: Re: [PATCH v4 3/6] KVM: x86: nSVM: support PAUSE filtering when L0 doesn't intercept PAUSE From: Maxim Levitsky To: Paolo Bonzini , kvm@vger.kernel.org Cc: Ingo Molnar , Borislav Petkov , Sean Christopherson , Vitaly Kuznetsov , "H. Peter Anvin" , Joerg Roedel , linux-kernel@vger.kernel.org, Thomas Gleixner , Jim Mattson , x86@kernel.org, Dave Hansen , Wanpeng Li Date: Sun, 27 Mar 2022 18:14:49 +0300 In-Reply-To: <848bba1a-66f2-a3eb-510e-9322b729c8ec@redhat.com> References: <20220322174050.241850-1-mlevitsk@redhat.com> <20220322174050.241850-4-mlevitsk@redhat.com> <848bba1a-66f2-a3eb-510e-9322b729c8ec@redhat.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2022-03-24 at 19:24 +0100, Paolo Bonzini wrote: > On 3/22/22 18:40, Maxim Levitsky wrote: > > Allow L1 to use PAUSE filtering if L0 doesn't use it. > > > > Signed-off-by: Maxim Levitsky > > Can you enlarge the commit message to explain the logic in > nested_vmcb02_prepare_control? No problem, I will do in the next version. How about this: KVM: x86: nSVM: support nested PAUSE filtering when possible Expose the pause filtering and threshold in the guest CPUID and support PAUSE filtering when possible: - If the L0 doesn't intercept PAUSE (cpu_pm=on, or pause_filter_count kvm_amd's parameter is 0), then allow L1 to have full control over PAUSE filtering. - Otherwise if the L1 doesn't intercept PAUSE, use KVM's PAUSE thresholds, and update them even when running nested. - Otherwise ignore both host and guest PAUSE thresholds, because it is not really possible to merge them correctly. It is expected that in this case, userspace hypervisor (e.g qemu) will not enable this feature in the guest CPUID, to avoid having the guest to update both thresholds pointlessly. Best regards, Maxim Levitsky > > Thanks, > > Paolo >