Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp4189868pxy; Mon, 26 Apr 2021 21:44:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXcXauPjUEc1FpINsSyQ3102xkt1p8JmGJHhTLVJ3xEfSFmnDH19eBAu6p3ixN+5Et+mWt X-Received: by 2002:a62:868e:0:b029:265:e138:c010 with SMTP id x136-20020a62868e0000b0290265e138c010mr21640872pfd.10.1619498670644; Mon, 26 Apr 2021 21:44:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619498670; cv=none; d=google.com; s=arc-20160816; b=zm+TZU/ZeY5AcoU0OVntbf9MWy3J/+DqFh9tIVuFf3bvJF930P0zxZlw5JuyOUIUxM GvVgEp/AIZ+NgwoEPijdLAhBAyIqhWgg63zubc+RRchyhe3GVwhuP8TkDRadFK9PFJmL iceW5ksf5uqbrZ0pF5wKGKgrYPfislHsEucKxhym3X1RjXLyQjqTo60RYFTIeLzgvbQf lt1a1cHxxE3Vtbg5JJlQm1eG0xgTs4adRmef7iMwe5M7H3kblHDJpV/15hR5wsy3a2YO Y2QOfzEP98LfUKBouYHx7P6xd9ShR0dcDstw7JXNy4N3Mk6AmNWAWs7KoLKOy0rh08lr KPDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=L/KHE0b9yQxhmyIXZE35ERgi0XKeQwuyEqiuqSbm+MM=; b=F0zx7eXvcFRm1oS0tOfQ3NhWtuJC19dL9aJhYd5FdGxMvpqeIaqWeZSckP4gPgEc2v l6Aem/gsC3putr+PB8Sfxuz1GV3I7XEHBckNGiNpo4MyaGteY9flqcec1AnUzhlCPsaH GV9i2gLC8uoImcV5wnwltx253jOKUgV+VTTCOnm/+J466m3wAVpIivc5JtguU8iFVnnu iwvh6bI6QJOomfCNi5Nt3nD+TmhMGstpeX1sz0Qe5J1xqN4N/IqhXc5htKmT8eLwOOZ4 0m8zU3/bDAJPEMPgb4H50apBm8uvJqL29c8T/LKFLIeJWLZe3Yf7APOgM52YmFrebxjG Lcdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=hffZSpoC; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q10si20338710pgm.285.2021.04.26.21.44.05; Mon, 26 Apr 2021 21:44:30 -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=@google.com header.s=20161025 header.b=hffZSpoC; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234600AbhD0Enu (ORCPT + 99 others); Tue, 27 Apr 2021 00:43:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229587AbhD0Enu (ORCPT ); Tue, 27 Apr 2021 00:43:50 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6E8FC061756 for ; Mon, 26 Apr 2021 21:43:07 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id b21so1671673plz.0 for ; Mon, 26 Apr 2021 21:43:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=L/KHE0b9yQxhmyIXZE35ERgi0XKeQwuyEqiuqSbm+MM=; b=hffZSpoCi3KBvwODP+2t/DdtmbubisXWP0vnNWLRWS4Y/Cp0n9d0WpV6sq3QbgYxTt v04oTjIB7J5TO/GSu15NOFMLDsSwfiKYjzpbyaOsvBmjEHgVkOqQF5i2dBUDZeX0y9EW VxVvpQ7Bfg5S5DathfiHWZJpH7cwdeI2VJ4/E5C0fzhTj3uLoECi+A6New3KuKzxdksc zh6Ve1N+SZS75XoEiNKEQxAvI7IP/NiFdw5C4E3okszmEUzfivA/upj/nDLNi73Rs1Pl lekPrYW/SgMVlu3IpvYype2JS4iIOV5tSaN936p/YyXn0fCFNx2wFzaVfzT4XHTrex/k ZfIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=L/KHE0b9yQxhmyIXZE35ERgi0XKeQwuyEqiuqSbm+MM=; b=PEMr3msLv0Hxz8GhEs4cO7+vJLXgPjfPI1LHQTIBGrICKNDwU2P3LbY2dCUG8hcTby votwPbXkLJ9gewc27i+58RbK5YoP+nC16gbeYTT6QqToqweAjOr23vP05ws7wo7n6a0X JD56e5nqnL5QP1PcgpnXifgo60mj5rAw4WU/nj3x3URPAmMek6eVvkgBOh8znHjq74MY 7beBjGqMA0GvsvTDS+scocIisgVnfafOI6kvBfIsf9H9Y587HzT8EqkLp/7vaYeXSb7C XIDQ+kVTOKkcuTbRg0AJ0ocF3vcKTBxdhQrJ/8pqy9uAqKnlbu1nGQS3lsfi0Hri3LhM 19ww== X-Gm-Message-State: AOAM533sLAxgOxq7tB6BL/OtN8vK69spswX4OxIHMTDNEVPxY5cIaS5u f8vfh5LKGaXzRBqhbFjAUCGf09XmGX47TaLAlCeamg== X-Received: by 2002:a17:902:654b:b029:ec:a435:5b5c with SMTP id d11-20020a170902654bb02900eca4355b5cmr23318742pln.42.1619498587057; Mon, 26 Apr 2021 21:43:07 -0700 (PDT) MIME-Version: 1.0 References: <20210423223404.3860547-1-seanjc@google.com> <20210423223404.3860547-4-seanjc@google.com> In-Reply-To: From: Reiji Watanabe Date: Mon, 26 Apr 2021 21:42:51 -0700 Message-ID: Subject: Re: [PATCH v3 3/4] KVM: x86: Tie Intel and AMD behavior for MSR_TSC_AUX to guest CPU model To: Sean Christopherson Cc: Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > It looks Table 2-2 of the Intel SDM Vol4 (April 2021) says > > TSC_AUX is supported: > > > > If CPUID.80000001H:EDX[27] = 1 or CPUID.(EAX=7,ECX=0):ECX[22] = 1 > > > > Should we also check X86_FEATURE_RDPID before returning 1 > > due to no RDTSCP support ? > > Yep. VMX should also clear RDPID if the ENABLE_RDTSCP control isn't supported. > That bug isn't fatal because KVM emulates RDPID on #UD, but it would be a > notieable performance hit for the guest. Thank you so much for the confirmation and the information. Understood. > There is also a kernel bug lurking; vgetcpu_cpu_init() doesn't check > X86_FEATURE_RDPID and will fail to initialize MSR_TSC_AUX if RDPID is supported > but RDTSCP is not, and __getcpu() uses RDPID. I'll verify that's broken and > send a patch for that one too. I don't find vgetcpu_cpu_init() or __getcpu() in https://github.com/torvalds/linux. I would assume you meant setup_getcpu() and vdso_read_cpunode() instead (?). > AMD also documents this in Appendix E: > > CPUID Fn0000_0007_EBX_x0 Structured Extended Feature Identifiers (ECX=0) > Bits Field Name > ... > 22 RDPID RDPID instruction and TSC_AUX MSR support. Thank you. I overlooked that... Regards, Reiji