Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp1074469rdf; Sat, 4 Nov 2023 05:46:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGIUwyzpkfLLSq9wnLaOT0dfEo6rU21tLchLx34zlwLSq71wr/D6m+1HgsjFkApwLGvtx4b X-Received: by 2002:a05:6a00:10d2:b0:68a:3ba3:e249 with SMTP id d18-20020a056a0010d200b0068a3ba3e249mr28433795pfu.16.1699102003464; Sat, 04 Nov 2023 05:46:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699102003; cv=none; d=google.com; s=arc-20160816; b=Z4Ojq9c4erGba5A6kl9BcyOWum+wwMjoBpuUEG9AaZfFgNPAKB8Ir6tCYYiJwyVpvX rbeNtPpXfMsZQ0+29VWLeVtSMNwR6PT2jJsoTNogy0PdvB2f8caGJoQnSi+XQxWpwAws LeqrKVVOq5MQ/wdvMATDJrdLxd3vPix2mbiwrcVOhnmsJDwDn0Uu1Wneu9uJiBjlEYuj h2F19yXwIlfPC4vkyy4WkkFcvuZiEEhXbt1Wd1TI2SfNKxnqdRNzd8TTrb0VyVTzTGzb 00h/c3GxPmjbH2MY9XW7UHcPEDXiAyv8tHwMBYxohN2J91gdXh1uTwLdywt2YJXURgjD Q46A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=I7d3FLwKpFYOTr5gbCWXtm9OztyAg68Ag2ZB+uAGlNg=; fh=+P/YAw2zernQMYCM+6PO88cyfvFWVdhqutSbGYwZXbc=; b=yhNozemQ46wy6lzPNUb4E2t4CuXtc0aRHp80VStGXftLZ5RrpbOH/UJ7aT87jSfQRA VL6uVrs/B79KeZQlEwB6ddoFg14g9B+Ru85BjXN1X23IlIqWwSpCL5Df7LeJLNIzet/D FSqZWqJQm/4H5D1k4qmcrSFEUxKxcyZirl+ozlvR2j9ocIfDyr+87786U3jtmj7L2nSm hmvx/FCZdGjc126cfcla5OMblLkbkMViK1uJPScUp4uWmsmF/PWMdkbCwO4TzHUWsBbb l2Dkv9QWHnvCNjXcX0Rebl2cbjvbLyMjnDMa5OXYZZ4RCaZ++kTI1q6arJgxu/ZTthSM 5kAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=EzuzmZFK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id p27-20020a056a000a1b00b006c338f646d4si3841446pfh.211.2023.11.04.05.46.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Nov 2023 05:46:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=EzuzmZFK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 99CFF8051B40; Sat, 4 Nov 2023 05:46:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230180AbjKDMqY (ORCPT + 99 others); Sat, 4 Nov 2023 08:46:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbjKDMqX (ORCPT ); Sat, 4 Nov 2023 08:46:23 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77245194 for ; Sat, 4 Nov 2023 05:46:20 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-507a5edc2ebso1254e87.1 for ; Sat, 04 Nov 2023 05:46:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1699101979; x=1699706779; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=I7d3FLwKpFYOTr5gbCWXtm9OztyAg68Ag2ZB+uAGlNg=; b=EzuzmZFKo5Z4V3a3r8MfW9fO2I+Jxn1EVYlEq4kvA7vqLBDxTMoi64FesWFc9iTMGr zO2KoZqPTqpy2QvcfqCRfi7sZabTWAazWhbigxo5VfIQKfLZtpktK6B5d+TQpfOeg0FR u1g4R2XyK3Dxw9wy3fKC8kLSH1fycNFZ8A3fakDH/AR+9hTyqoFlKQvuDFHUzDn4wym/ mgICGy/TYO0aH7HEDutMuP08z1bgBtbPQB5tzuREF9YrWgnwsjmveY49j9Ka2gvTUowl kefnJSyFIg97CkXa9OWzJxSTsmu0FTipIYnpq33DdDtBbFh1OYSKcKVW21uQX/Md995n RWcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699101979; x=1699706779; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I7d3FLwKpFYOTr5gbCWXtm9OztyAg68Ag2ZB+uAGlNg=; b=YYistp43kWAKP8S91ksVnBNsrtGzNiYOmgGJ7Ug69s9U+IikYJYKan1mq4l0USQv2X F7trA7J9grtwoYdHzQFXZ7RUF3cfwKckL/DvAkD2CvKC623piaP6NdYhChVyHv3ySA+X VhjuqCY07CbKCSC2wovisN2JsOhz6fDvnRkQrWMiqg8ABFBNoTmgIvrHYbZY4s+xNhe1 D3FTG1FjBK//lnC7WebNUELNNLO9x8iPOTgj6/B7/cHwudORXaYWP+SslUyOn9Nb9YaH tW/GPXzlVOwUWEk+Nf/mweiBC7CvI9+HUH42I4eAa/zwLOGW1B97XCuvj7L30SJr0QFu NQYA== X-Gm-Message-State: AOJu0Yx4cMyqtt8j+AoB9vR+E4w0MSBoTQI+Ozx8GIOdOVJoT8SzQuRj myUTJALjhIyF5+81lcz5ubD7zdyWddFOmVg9K1+4tA== X-Received: by 2002:ac2:4c86:0:b0:507:8c80:f1d1 with SMTP id d6-20020ac24c86000000b005078c80f1d1mr46272lfl.2.1699101978565; Sat, 04 Nov 2023 05:46:18 -0700 (PDT) MIME-Version: 1.0 References: <20231104000239.367005-1-seanjc@google.com> <20231104000239.367005-6-seanjc@google.com> In-Reply-To: <20231104000239.367005-6-seanjc@google.com> From: Jim Mattson Date: Sat, 4 Nov 2023 05:46:06 -0700 Message-ID: Subject: Re: [PATCH v6 05/20] KVM: x86/pmu: Allow programming events that match unsupported arch events To: Sean Christopherson Cc: Paolo Bonzini , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Kan Liang , Dapeng Mi , Jinrong Liang , Like Xu , Aaron Lewis Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sat, 04 Nov 2023 05:46:29 -0700 (PDT) On Fri, Nov 3, 2023 at 5:02=E2=80=AFPM Sean Christopherson wrote: > > Remove KVM's bogus restriction that the guest can't program an event whos= e > encoding matches an unsupported architectural event. The enumeration of > an architectural event only says that if a CPU supports an architectural > event, then the event can be programmed using the architectural encoding. > The enumeration does NOT say anything about the encoding when the CPU > doesn't report support the architectural event. > > Preventing the guest from counting events whose encoding happens to match > an architectural event breaks existing functionality whenever Intel adds > an architectural encoding that was *ever* used for a CPU that doesn't > enumerate support for the architectural event, even if the encoding is fo= r > the exact same event! > > E.g. the architectural encoding for Top-Down Slots is 0x01a4. Broadwell > CPUs, which do not support the Top-Down Slots architectural event, 0x10a4 > is a valid, model-specific event. Denying guest usage of 0x01a4 if/when > KVM adds support for Top-Down slots would break any Broadwell-based guest= . > > Reported-by: Kan Liang > Closes: https://lore.kernel.org/all/2004baa6-b494-462c-a11f-8104ea152c6a@= linux.intel.com > Cc: Dapeng Mi > Fixes: a21864486f7e ("KVM: x86/pmu: Fix available_event_types check for R= EF_CPU_CYCLES event") > Signed-off-by: Sean Christopherson Yes! Finally! Reviewed-by: Jim Mattson