Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp12361ybs; Tue, 26 May 2020 02:21:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjbLs7a04OqJ0jNOUdtRc9EdJwic+O2n8Q6cM/3QQLze2pmCrzQtfIVFW625fPeVqfgmVu X-Received: by 2002:aa7:d90b:: with SMTP id a11mr19099934edr.159.1590484884148; Tue, 26 May 2020 02:21:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590484884; cv=none; d=google.com; s=arc-20160816; b=T0OIWV4eyuPU9MzBkg5TbUz//In7kCjcJUmVclj7jOfEREmfNnaDMHMgemk9t/Humv KfmRfWisP4Cj+v4ODbnP+h60Z6Xa9PqdQ76waG/cdfsIK7LBD8ZBji7mfjFdO/0nRFvQ iLNh6DhBk9SduBQKGoHeIB5g47I7MaQqTgQedSMhuxivRTlDusgB0GzdoXtSIYeyPiHC YIqROIvpG5mz8GssvAPUK6ZOzcx3L8rQc1Tyl7xIFRB54yuLSY7p0r4OiGpt9U8p9bXM f12UpRy8na6WAlqUaz86MBw7pmePdimKi/2Mn9FPv+TML5J0m/T9u23e0fi4UUhE/DWU mDyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=3q+7t7sjlYH1ceIvNrmNgbY6YY9E6lQweSEw445KMuQ=; b=fJ/r2nWeG6u+e1VQe0BEkIhZGhXvdi1pGPvwCJrsVNayKfvYS8t8vCUwJgK1RSbB5V 4we9dUmV9+62QP8GeeL/HKKzSiNGUlTfnC46r/otNPPRrcdTZb59tcwUsXjwdtVvabf1 HpeKgMpFYkNhYtAvznGLzN2YiE4dXBpT4AzeNu1HNhossdCa4tD0Rhh8xQKzYBEKk8ZV Eg3soUDBr3+8QqYXqoDwVKaIRslEkD1LTG9ngoSarxDOdtipB7JoO2IHeYC7WW/SStwB zdqSjHhrCwNcQwqT88++lSu0CbrosnHc2IFFMRrvLXrWpgBJJzBy0K4ZRxMGSaNB66fZ rb0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=iKa2bVBp; 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=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v12si10390733ejr.574.2020.05.26.02.21.01; Tue, 26 May 2020 02:21:24 -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=@alien8.de header.s=dkim header.b=iKa2bVBp; 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=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731678AbgEZJTR (ORCPT + 99 others); Tue, 26 May 2020 05:19:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731600AbgEZJTR (ORCPT ); Tue, 26 May 2020 05:19:17 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11CD7C03E97E; Tue, 26 May 2020 02:19:17 -0700 (PDT) Received: from zn.tnic (p200300ec2f0f91004890e1585abde4e7.dip0.t-ipconnect.de [IPv6:2003:ec:2f0f:9100:4890:e158:5abd:e4e7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id E9AF21EC01CE; Tue, 26 May 2020 11:19:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1590484754; 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:in-reply-to:in-reply-to: references:references; bh=3q+7t7sjlYH1ceIvNrmNgbY6YY9E6lQweSEw445KMuQ=; b=iKa2bVBpMQp6StjjDbQaxUSuJ6wTp1s+D5je8Zka3UYOO595HcNgIRtDL9u0hOFnuPhGDR MQnn6PnjduoWek/zB3TtJ35+Q0grOSS/8KmKwPz0q9/upZHz5W9p3CmZZPhGuWcO6Wb/Nn Y120KdDXjix8h/C8LNwg7L1XZb/LHKU= Date: Tue, 26 May 2020 11:19:09 +0200 From: Borislav Petkov To: Sean Christopherson Cc: Joerg Roedel , x86@kernel.org, hpa@zytor.com, Andy Lutomirski , Dave Hansen , Peter Zijlstra , Thomas Hellstrom , Jiri Slaby , Dan Williams , Tom Lendacky , Juergen Gross , Kees Cook , David Rientjes , Cfir Cohen , Erdem Aktas , Masami Hiramatsu , Mike Stunes , Joerg Roedel , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH v3 64/75] x86/sev-es: Cache CPUID results for improved performance Message-ID: <20200526091909.GB28228@zn.tnic> References: <20200428151725.31091-1-joro@8bytes.org> <20200428151725.31091-65-joro@8bytes.org> <20200520051637.GA16599@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200520051637.GA16599@linux.intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 19, 2020 at 10:16:37PM -0700, Sean Christopherson wrote: > The whole cache on-demand approach seems like overkill. The number of CPUID > leaves that are invoked after boot with any regularity can probably be counted > on one hand. IIRC glibc invokes CPUID to gather TLB/cache info, XCR0-based > features, and one or two other leafs. A statically sized global array that's > arbitrarily index a la x86_capability would be just as simple and more > performant. It would also allow fancier things like emulating CPUID 0xD in > the guest if you want to go down that road. And before we do any of that "caching" or whatnot, I'd like to see numbers justifying its existence. Because if it is only a couple of CPUID invocations and the boot delay is immeasurable, then it's not worth the effort. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette