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 043D6C433EF for ; Thu, 19 May 2022 14:47:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239922AbiESOq6 (ORCPT ); Thu, 19 May 2022 10:46:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239850AbiESOqy (ORCPT ); Thu, 19 May 2022 10:46:54 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 263A04B1E3 for ; Thu, 19 May 2022 07:46:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652971613; 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=IYenpcwbemxE/tpiqt4OT+PMDoY+cz7r/DOS2tuXYQI=; b=R+Y1ITuTnpCTOOkL35yKlpu1UXYGH/daEoCJMDizwX+ozNgGaPXgvnKSZ9T8J5vOvoiuAw bPiQ3ResLMzzbEYuRuRuMj8Y2k0AP75nDNRzh0l6lNNHXw+cpZ63LtiyfO/sjTUcnzGd0V u5tLH0/6MBAPQog6Td2aX2Poj5o5B+8= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-517-r29LjJq7MRq-m6C9mffQ-w-1; Thu, 19 May 2022 10:46:52 -0400 X-MC-Unique: r29LjJq7MRq-m6C9mffQ-w-1 Received: by mail-wm1-f71.google.com with SMTP id z23-20020a05600c221700b003942fd37764so4601355wml.8 for ; Thu, 19 May 2022 07:46:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=IYenpcwbemxE/tpiqt4OT+PMDoY+cz7r/DOS2tuXYQI=; b=bbX7mak5IlH1FlC+1q2UiE+YzhrwuufpkkFuEM8DcPsniNR5PM9zcDYmOTolYktEyS lG7HFmksedTjuiZloyiSP+hjW1eZKNzNWPtkE03rHttJaExFgSG7j7oRCmmCgxeQIq3n riNqcHfKDoKRqMj3Bet03oGz2mrbxFK5+sfZUv4yZsK+X9mIQ+KRYe9sQBY4RhQdBxHy Oc9jBGXVogkvcGznLw7VsMH5CarXrM80b7b29CtHHz4e002DYYL8l7UTyAa2ur+dtELh TXo4+od9zmbx3c4lQDCfb4NPQXuRINB8yMKyKryHlQdVXnwPOMucrsHhH/b/syyL/cYM 90vw== X-Gm-Message-State: AOAM532hEg1auQiQj4B45hOqfnJiJ0c5sKnSn0Lq1R1VCjp8iE1y4d+M Y2b8n2MH4dq2RaQGA1xH/skWpqR9AvlLoUmq4Vc6LMvLbT9h14yLpKxNqRQOKVAdxugNbtlXz2C qgq7Id7LacxadGa3UouLS1Gdw X-Received: by 2002:a5d:674c:0:b0:20d:87e:8d6f with SMTP id l12-20020a5d674c000000b0020d087e8d6fmr4389531wrw.40.1652971611084; Thu, 19 May 2022 07:46:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyr6JwGKaZDuEnW7utGBQ+cruIn2morLnGA2beoQBpy8dow5R22hQX7c9kMilfKrC6KCUQoKg== X-Received: by 2002:a5d:674c:0:b0:20d:87e:8d6f with SMTP id l12-20020a5d674c000000b0020d087e8d6fmr4389505wrw.40.1652971610845; Thu, 19 May 2022 07:46:50 -0700 (PDT) Received: from fedora (nat-2.ign.cz. [91.219.240.2]) by smtp.gmail.com with ESMTPSA id a7-20020adfbc47000000b0020c635ca28bsm5370388wrh.87.2022.05.19.07.46.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 May 2022 07:46:50 -0700 (PDT) From: Vitaly Kuznetsov To: Like Xu Cc: Peter Zijlstra , Sean Christopherson , Wanpeng Li , Joerg Roedel , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Jim Mattson , Paolo Bonzini Subject: Re: [PATCH RESEND v12 00/17] KVM: x86/pmu: Add basic support to enable guest PEBS via DS In-Reply-To: References: <20220411101946.20262-1-likexu@tencent.com> <87fsl5u3bg.fsf@redhat.com> Date: Thu, 19 May 2022 16:46:49 +0200 Message-ID: <874k1ltw9y.fsf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Like Xu writes: > On 19/5/2022 9:31 pm, Like Xu wrote: >> =3D=3D=3D=3D Test Assertion Failure =3D=3D=3D=3D >> =C2=A0=C2=A0 lib/x86_64/processor.c:1207: r =3D=3D nmsrs >> =C2=A0=C2=A0 pid=3D6702 tid=3D6702 errno=3D7 - Argument list too long >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 1=C2=A0=C2=A0=C2=A0 0x000000000040da11: = vcpu_save_state at processor.c:1207=20 >> (discriminator 4) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 2=C2=A0=C2=A0=C2=A0 0x00000000004024e5: = main at state_test.c:209 (discriminator 6) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 3=C2=A0=C2=A0=C2=A0 0x00007f9f48c2d55f: = ?? ??:0 >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 4=C2=A0=C2=A0=C2=A0 0x00007f9f48c2d60b: = ?? ??:0 >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 5=C2=A0=C2=A0=C2=A0 0x00000000004026d4: = _start at ??:? >> =C2=A0=C2=A0 Unexpected result from KVM_GET_MSRS, r: 29 (failed MSR was= 0x3f1) >>=20 >> I don't think any of these failing tests care about MSR_IA32_PEBS_ENABLE >> in particular, they're just trying to do KVM_GET_MSRS/KVM_SET_MSRS. > > One of the lessons I learned here is that the members of msrs_to_save_all= [] > are part of the KVM ABI. We don't add feature-related MSRs until the last > step of the KVM exposure feature (in this case, adding MSR_IA32_PEBS_ENAB= LE, > MSR_IA32_DS_AREA, MSR_PEBS_DATA_CFG to msrs_to_save_all[] should take > effect along with exposing the CPUID bits). AFAIR the basic rule here is that whatever gets returned with KVM_GET_MSR_INDEX_LIST can be passed to KVM_GET_MSRS and read successfully by the host (not necessarily by the guest) so my guess is that MSR_IA32_PEBS_ENABLE is now returned in KVM_GET_MSR_INDEX_LIST but can't be read with KVM_GET_MSRS. Later, the expectation is that what was returned by KVM_GET_MSRS can be set successfully with KVM_SET_MSRS. --=20 Vitaly