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=-13.6 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no 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 B59F9C07E9B for ; Wed, 7 Jul 2021 16:42:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 97B3861CB9 for ; Wed, 7 Jul 2021 16:42:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230365AbhGGQp2 (ORCPT ); Wed, 7 Jul 2021 12:45:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230340AbhGGQp0 (ORCPT ); Wed, 7 Jul 2021 12:45:26 -0400 Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF7D3C06175F for ; Wed, 7 Jul 2021 09:42:44 -0700 (PDT) Received: by mail-ot1-x330.google.com with SMTP id i12-20020a05683033ecb02903346fa0f74dso2809273otu.10 for ; Wed, 07 Jul 2021 09:42:44 -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=GGs8qC7yLeuU76aGHT+b9/9uNPRLJI8gTxSyotZUZjQ=; b=ulqDE9XePT0F3X1rxoUkPWYmj/cjMwrSpkBWRNe6WgiTfaJW/vXMef8qiVm4PydT4M jbH39id9qamVcenVkkU3LeJWCriDFwFdPEDgjjS/jH8FbNRapZZOavwTz+8vjvPMKYai ee5TcQDOeoV2RAyE0sTUpqCNMFI7LpO7vyQ5DPYWTmFw6BehRCEknNp3jMKpUG3He1wY z0yGFQC4J0szM/5KLyN1KSfwvCe7YC6gYJBOLqpqf64LE3MwloxNKpcNkr+oVpFYFmMA mtFZxq6hgdQaQaKQKoy+QB5/J2IKaJvcDNPOESZeLDQXVmPo39QEhvj5Vlm3UZG80JcE Ejow== 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=GGs8qC7yLeuU76aGHT+b9/9uNPRLJI8gTxSyotZUZjQ=; b=FAKe5TuMvi9BlFr3pW55gCuJc63qdry++hu/7eB/5xpqadnhQkcrdqU5iGBX42fFYH JOCNkrgcfYXyFRDve7Jzg2t1zNmOfL+6xHdv6CmQXXKQDQyn0nrlZApmzd+fr6C+zxht GKIjfurAcvwJl/vFAifkcex7EvtH2G60VVH/mYqMt7VoiPNQEUdHpykUCrgI+My8YxP1 q7j/3Fu0UfQNcT7vM29RC8kUEa0GRTJqhvFpwRIW3ZX7IxNfg6uHWOVadQQTlutpB9sh YJVE2x873h2DlKIP8dn86O7B7YLtN6/alP8PVlRhDg94sfNZF/p92oB0GP73BkY7weL2 ob+g== X-Gm-Message-State: AOAM532VyjNcB0HR+8yBJnKlO75P4MPt2/Qo/zKt+pJVaP0fufiKedwm oe0o+SNUSklerxS88jwCMAzZeV1a5K8ZMj3BLgvFVQ== X-Google-Smtp-Source: ABdhPJxV/BWpTieutmD1GHOrCDI3SB0Memv132JxXJ8jgEqQapcXhpkMcicwRomyQ3PoTY61I19Y36tPpb8y777naR4= X-Received: by 2002:a9d:550e:: with SMTP id l14mr20870914oth.241.1625676163750; Wed, 07 Jul 2021 09:42:43 -0700 (PDT) MIME-Version: 1.0 References: <20210706195233.h6w4cm73oktfqpgz@habkost.net> <4cc2c5fe-2153-05c5-dedd-8cb650753740@redhat.com> <671be35f-220a-f583-aa31-3a2da7dae93a@redhat.com> In-Reply-To: From: Jim Mattson Date: Wed, 7 Jul 2021 09:42:26 -0700 Message-ID: Subject: Re: [PATCH 4/4] x86/tsx: Add cmdline tsx=fake to not clear CPUID bits RTM and HLE To: Eduardo Habkost Cc: Paolo Bonzini , Pawan Gupta , Thomas Gleixner , Borislav Petkov , Jonathan Corbet , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , x86@kernel.org, "H. Peter Anvin" , "Paul E. McKenney" , Randy Dunlap , Andrew Morton , "Maciej W. Rozycki" , Viresh Kumar , Vlastimil Babka , Tony Luck , Sean Christopherson , Kyung Min Park , Fenghua Yu , Ricardo Neri , Tom Lendacky , Juergen Gross , Krish Sadhukhan , Kan Liang , Joerg Roedel , Victor Ding , Srinivas Pandruvada , Brijesh Singh , Dave Hansen , Mike Rapoport , Anthony Steinhauser , Anand K Mistry , Andi Kleen , Miguel Ojeda , Nick Desaulniers , Joe Perches , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, kvm@vger.kernel.org, Jiri Denemark , "libvir-list@redhat.com" , Michal Privoznik Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 7, 2021 at 8:09 AM Eduardo Habkost wrote: > > CCing libvir-list, Jiri Denemark, Michal Privoznik, so they are aware > that the definition of "supported CPU features" will probably become a > bit more complex in the future. Has there ever been a clear definition? Family, model, and stepping, for instance: are these the only values supported? That would make cross-platform migration impossible. What about the vendor string? Is that the only value supported? That would make cross-vendor migration impossible. For the maximum input value for basic CPUID information (CPUID.0H:EAX), is that the only value supported, or is it the maximum value supported? On the various individual feature bits, does a '1' imply that '0' is also supported, or is '1' the only value supported? What about the feature bits with reversed polarity (e.g. CPUID.(EAX=07H,ECX=0):EBX.FDP_EXCPTN_ONLY[bit 6])? This API has never made sense to me. I have no idea how to interpret what it is telling me. > On Tue, Jul 6, 2021 at 5:58 PM Paolo Bonzini wrote: > > > > On 06/07/21 23:33, Eduardo Habkost wrote: > > > On Tue, Jul 6, 2021 at 5:05 PM Paolo Bonzini wrote: > > >> It's a bit tricky, because HLE and RTM won't really behave well. An old > > >> guest that sees RTM=1 might end up retrying and aborting transactions > > >> too much. So I'm not sure that a QEMU "-cpu host" guest should have HLE > > >> and RTM enabled. > > > > > > Is the purpose of GET_SUPPORTED_CPUID to return what is supported by > > > KVM, or to return what "-cpu host" should enable by default? They are > > > conflicting requirements in this case. > > > > In theory there is GET_EMULATED_CPUID for the former, so it should be > > the latter. In practice neither QEMU nor Libvirt use it; maybe now we > > have a good reason to add it, but note that userspace could also check > > host RTM_ALWAYS_ABORT. > > > > > Returning HLE=1,RTM=1 in GET_SUPPORTED_CPUID makes existing userspace > > > take bad decisions until it's updated. > > > > > > Returning HLE=0,RTM=0 in GET_SUPPORTED_CPUID prevents existing > > > userspace from resuming existing VMs (despite being technically > > > possible). > > > > > > The first option has an easy workaround that doesn't require a > > > software update (disabling HLE/RTM in the VM configuration). The > > > second option doesn't have a workaround. I'm inclined towards the > > > first option. > > > > The default has already been tsx=off for a while though, so checking > > either GET_EMULATED_CPUID or host RTM_ALWAYS_ABORT in userspace might > > also be feasible for those that are still on tsx=on. > > This sounds like a perfect use case for GET_EMULATED_CPUID. My only > concern is breaking existing userspace. > > But if this was already broken for a few kernel releases due to > tsx=off being the default, maybe GET_EMULATED_CPUID will be a > reasonable approach. > > -- > Eduardo >