Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp5633194pxv; Wed, 7 Jul 2021 08:14:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVoSusR9hC6RCFj07dSB+BdtJyCHqm2paY7NBwMivVzXtCR7U/04uJx7cwAsvnbfvZ4Hy9 X-Received: by 2002:a50:e79b:: with SMTP id b27mr24672524edn.267.1625670860324; Wed, 07 Jul 2021 08:14:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625670860; cv=none; d=google.com; s=arc-20160816; b=MFtwtonzaQ+00sjBddcJn5q8Adir9wuSzGcK+s7PnJUV9Yz2/nxkIAKm3dt0wCxwJK UyGgR9tut/hYLwFgt3s/FvpNjk6U8fDkFJNo2D8ftcgxy1/lCJeN4K/BxDOs0VJKq+XX 4ISSscnlFF0DQrHjO/GrW+Kh8UEkGLKq7+R4r2rlRzUn5K5ItyxdJxK5zYwLqdK+dQ5K NRlVEX1gBmfxl/+x3BpPewmDg8sVwkJLkUolf/O3TihAsQK340QDPNvUFi4UpW4ETpXO 8BPZyLpcNM4ZIS4bs5HOfPciTSNGnzehZkL7iYKe2GTme4VatTOHNQBpEvRfnzSaq1Jw z0Gw== 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=aWcVKjuywp9lh2ZpwGA5QOnKrFtu8NroiBWGr7IsBn8=; b=bmNBG4fo4ZFO50dbai3CdqekyNr+D86bbXc5BLHlvnb0+r7sT/o6XD11XmLlDFKolP p4obNZrTgiegIm6BKLztv+S1R8pmHv28YvuBFdUWnu/COKkLlFsdBvDmofDyuuu4aFq3 OGDeayGCQNPzhY4n+HDbxVHn0tJv7H4bYHD1V6qBo8zpOBo4zxY+fApBYOxN9PVGFhAP Q7L5CiZnuPjzXR0BLE2yvjpz2nI7l3tI8mljYIxBSoPoP3WWvrOBs+JDca6OJImLgMug WYKzeX2KM6wvBe2ayDOMPvcVFnNQ5qNxEkuyHNc+WijxjJeBHACgSgur9ed3NJrRK/zn FgQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=a28QXZwc; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w11si20870115ejc.221.2021.07.07.08.13.52; Wed, 07 Jul 2021 08:14:20 -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=@redhat.com header.s=mimecast20190719 header.b=a28QXZwc; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232212AbhGGPLe (ORCPT + 99 others); Wed, 7 Jul 2021 11:11:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:45743 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232233AbhGGPLd (ORCPT ); Wed, 7 Jul 2021 11:11:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625670532; 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=aWcVKjuywp9lh2ZpwGA5QOnKrFtu8NroiBWGr7IsBn8=; b=a28QXZwcYX5I/YLrg1MDdlWEUmXUAtcH5JBcOlEOkiMVUh4HpNTPvV7Wg+uS2Bhl8+3nSB Dh5xkYvITzmzLH1LYuf5SRofuSYNiBhEbogm+Bxpoq3vn6m8RhnNNvQyQa8dwLw0yH9rEt LUOl5TIEj9wh1GGcbtPHiEMLIJgjM1E= Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-522-Eq-7GN0xOlOQ2SpFcI1O1Q-1; Wed, 07 Jul 2021 11:08:51 -0400 X-MC-Unique: Eq-7GN0xOlOQ2SpFcI1O1Q-1 Received: by mail-lf1-f69.google.com with SMTP id bu14-20020a056512168eb029031226594940so1153179lfb.15 for ; Wed, 07 Jul 2021 08:08:51 -0700 (PDT) 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=aWcVKjuywp9lh2ZpwGA5QOnKrFtu8NroiBWGr7IsBn8=; b=VK6PtRagKPr0XTyZ6gsOeOY5C79vFw1B78PiAV7FruVtjRfIDQmhqj8Wz9XyXZhCnf mQfgj6+aSzESOugCHvI9uVip6+/Cs2pu6GXlV+yOn0/go0IyuPUzoymf8tmFosltUtAS uUiTSUroNZf8UjwIjKoU7tcnPzmjFj8urnyOlQ2homaagzgMuu/JdMIcZ4G99UbuvWS9 0HLvK4Nzz3dlNCnBWSEC/tS65TGoCgBVPHv+rb8faa8mNelIqArdiAbl0Ou2GOJ/cPai 2SwQBQdgb3qfeSsRydD5Hj/H7w7ecKhd9xcUy3SUdkI3WcVu8VbbBYFa4EZTVlVJJSn/ RH2Q== X-Gm-Message-State: AOAM533q+hqFkUtlIoH9LYQtp4PK2IGzcHgADM5yk3IwesfoyuIMVzfH Ebwxzik3Nxsv5De2PU1rvmyvunBJ9XoSiWpEVWD1Y8zh0JAApO8rjpTc6jevWVnBTBZCvzcznen ndRuAZu8kzSBVq3o6Zt5o4xG1LHL9KlDJEwkyTwD3 X-Received: by 2002:a19:2d0f:: with SMTP id k15mr20212376lfj.237.1625670529926; Wed, 07 Jul 2021 08:08:49 -0700 (PDT) X-Received: by 2002:a19:2d0f:: with SMTP id k15mr20212330lfj.237.1625670529596; Wed, 07 Jul 2021 08:08:49 -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: <671be35f-220a-f583-aa31-3a2da7dae93a@redhat.com> From: Eduardo Habkost Date: Wed, 7 Jul 2021 11:08:32 -0400 Message-ID: Subject: Re: [PATCH 4/4] x86/tsx: Add cmdline tsx=fake to not clear CPUID bits RTM and HLE To: Paolo Bonzini Cc: 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 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. 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