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 X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F04A0C43461 for ; Wed, 16 Sep 2020 08:34:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A3AD9206DC for ; Wed, 16 Sep 2020 08:34:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="BrqK9Oih" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726604AbgIPIeM (ORCPT ); Wed, 16 Sep 2020 04:34:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:46510 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725840AbgIPIeB (ORCPT ); Wed, 16 Sep 2020 04:34:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600245239; 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: in-reply-to:in-reply-to:references:references; bh=DAGiU6tQPn7qIzmXwLxHU7yiPU3YBQ56AcEEwsHRgsA=; b=BrqK9OihjhnHvpGJHUcQbLCckLsiREpv7sgSCut3k6IeONOZR4lb1Um1ZCDjHOIfiatRdI W8z6vUg+aIzFIoCBLdcl+GDcdFzgfkbO1j5U6mo6TCYOo4sLNJKC0sHoVF4Ytj9FwXTCOz JzdANeyloEiB7agQCy9H8nLprFjGiiM= 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-474-4HDCgbP5Okm5jDY_6ZfxHg-1; Wed, 16 Sep 2020 04:33:58 -0400 X-MC-Unique: 4HDCgbP5Okm5jDY_6ZfxHg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7B00D1800D4A; Wed, 16 Sep 2020 08:33:56 +0000 (UTC) Received: from work-vm (ovpn-114-237.ams2.redhat.com [10.36.114.237]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1EF9B5DE86; Wed, 16 Sep 2020 08:33:53 +0000 (UTC) Date: Wed, 16 Sep 2020 09:33:51 +0100 From: "Dr. David Alan Gilbert" To: Wei Huang Cc: Vitaly Kuznetsov , kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson , Wanpeng Li , Jim Mattson , Wei Huang , linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC 0/2] KVM: x86: allow for more CPUID entries Message-ID: <20200916083351.GA2833@work-vm> References: <20200915154306.724953-1-vkuznets@redhat.com> <20200915165131.GC2922@work-vm> <20200916034905.GA508748@weilap> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200916034905.GA508748@weilap> User-Agent: Mutt/1.14.6 (2020-07-11) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Wei Huang (wei.huang2@amd.com) wrote: > On 09/15 05:51, Dr. David Alan Gilbert wrote: > > * Vitaly Kuznetsov (vkuznets@redhat.com) wrote: > > > With QEMU and newer AMD CPUs (namely: Epyc 'Rome') the current limit for > > Could you elaborate on this limit? On Rome, I counted ~35 CPUID functions which > include Fn0000_xxxx, Fn4000_xxxx and Fn8000_xxxx. On my 7302P the output of: cpuid -1 -r | wc -l is 61, there is one line of header in there. However in a guest I see more; and I think that's because KVM tends to list the CPUID entries for a lot of disabled Intel features, even on AMD, e.g. 0x11-0x1f which AMD doesn't have, are listed in a KVM guest. Then you add the KVM CPUIDs at 4...0 and 4....1. IMHO we should be filtering those out for at least two reasons: a) They're wrong b) We're probably not keeping the set of visible CPUID fields the same when we move between host kernels, and that can't be good for migration. Still, those are separate problems. Dave > > > KVM_MAX_CPUID_ENTRIES(80) is reported to be hit. Last time it was raised > > > from '40' in 2010. We can, of course, just bump it a little bit to fix > > > the immediate issue but the report made me wonder why we need to pre- > > > allocate vcpu->arch.cpuid_entries array instead of sizing it dynamically. > > > This RFC is intended to feed my curiosity. > > > > > > Very mildly tested with selftests/kvm-unit-tests and nothing seems to > > > break. I also don't have access to the system where the original issue > > > was reported but chances we're fixing it are very good IMO as just the > > > second patch alone was reported to be sufficient. > > > > > > Reported-by: Dr. David Alan Gilbert > > > > Oh nice, I was just going to bump the magic number :-) > > > > Anyway, this seems to work for me, so: > > > > Tested-by: Dr. David Alan Gilbert > > > > I tested on two platforms and the patches worked fine. So no objection on the > design. > > Tested-by: Wei Huang > > > > Vitaly Kuznetsov (2): > > > KVM: x86: allocate vcpu->arch.cpuid_entries dynamically > > > KVM: x86: bump KVM_MAX_CPUID_ENTRIES > > > > > > arch/x86/include/asm/kvm_host.h | 4 +-- > > > arch/x86/kvm/cpuid.c | 55 ++++++++++++++++++++++++--------- > > > arch/x86/kvm/x86.c | 1 + > > > 3 files changed, 43 insertions(+), 17 deletions(-) > > > > > > -- > > > 2.25.4 > > > > > -- > > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK > > > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK