Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp5007131pxv; Tue, 6 Jul 2021 14:59:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhnzWx9BF2CibcyAKt0b/YGAzqS+WufZd+qk564LvRYHEYGZGAXhDNRrfrRBMFeGrwTIjI X-Received: by 2002:a05:6602:3403:: with SMTP id n3mr17352792ioz.165.1625608767850; Tue, 06 Jul 2021 14:59:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625608767; cv=none; d=google.com; s=arc-20160816; b=txWj3VMymxu5PjfFGpfpJTlG9DPemrrpDt+4WfVe+uSfyKXo0+8EyDoZIpoTNDJZQW qvTMUDzx5BNqab6t/W3SfAGNldkPJz6LfuNYbVX9hFT9cCQn90zslZXrE42npaOqoNTK nf6b4DlOrVoD86to6sHp4p/rbVWJva1q38Ho+I0M3cKA2+JTvAH68xVCpaldoKy23Dyc VUmjnuve2Qgis9oC3CESqS/PgIY4derxyjttvJ3W+ALe0XDvRDP98bThXoHsiGN2KELO F8I2vCjxrQAUmuaUVTiJ8H9L/lMvwImfFtEGNbU5mG7r5RUTg29KVta789zSZAOUggMa xCAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject:from :references:cc:to:dkim-signature; bh=k+aIEuRJ9fWvAoEW/b9NeolC7NVomT1H6FczvBKOAzE=; b=Zh5g4b3G3CcLflz1HYJqvNGLFCI72FRBmkV216zEsZ8hRXShOvQOmjKWpjiy+iz4nX tDT1ja3A2zfkYaqvfX8xDBoC8KT4u1Dwe+iq/XylI2bASh9YJ2//Z2uNvfS4o7gHTlNg srJO3JXaPGU1byBgxdFj7SKoHY+3zYOs8u2ROkOV95Ow5k4RsGMajbKVvDBay1ep7hH/ jTiOuIA9rUXDJpm33qq8/uAbd00E/hy6kJlo05vlAmJ2vy8dUQFNDMfBsyWNglp6ggm1 YZCIO9Hzu1oRggT4YDPQ3qfdhZB7WjNtnxKHQeCcp1DeXPe32dwzsjbf+sXeb2o6GFAc 1kkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iLunRKnw; 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 u11si796576jau.121.2021.07.06.14.59.06; Tue, 06 Jul 2021 14:59:27 -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=iLunRKnw; 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 S229950AbhGFWAy (ORCPT + 99 others); Tue, 6 Jul 2021 18:00:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:57220 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229876AbhGFWAx (ORCPT ); Tue, 6 Jul 2021 18:00:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625608694; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k+aIEuRJ9fWvAoEW/b9NeolC7NVomT1H6FczvBKOAzE=; b=iLunRKnwLudlFUJNpOv/hCBw4iNO5US/9JcdHGrwAMluMo0VZHv205EhqjRjBV9y2Zr/jx IPvprmxDrVezVjeSTSaNlkwiMSbogDpzwTJfq8UEhYgBCDdqHy6CzdRsh2SM4l2O2pJ4uQ 1So/F1DelsBYU8yKz9Tc8kxKPkmPFtc= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-363-hk6MA_PNPeeXxaa4TINr-g-1; Tue, 06 Jul 2021 17:58:13 -0400 X-MC-Unique: hk6MA_PNPeeXxaa4TINr-g-1 Received: by mail-ed1-f69.google.com with SMTP id o8-20020aa7dd480000b02903954c05c938so244944edw.3 for ; Tue, 06 Jul 2021 14:58:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=k+aIEuRJ9fWvAoEW/b9NeolC7NVomT1H6FczvBKOAzE=; b=WTR9z07kCxMP5C2E02Cr8K9Z1u4daHjXBs6GFdmHbEoyc3YkjWBodAFBZSLkxilY/0 Swvndywg4Yz4FpJymH6oMvIw9MfpoivHt6wWwLGnncg3LCVfi1+WWXslpBsP/+4LgG3+ Dqtyp04LvgMqWnQ1hcjJGKcWWOGu2wMEZ+bGhGr1uSu1vVydQy8ew4nvwl6dNb4hGyIg mXokfMpNdob8QtXAoaBes9aKEJTf6qCdV8NbUuiShHyjb+Z1aoDH9qJ3R/C4NowKiNFD KvDnBzJyxjaK+YrfgpeF24QlnBKA1Pyb5u4Si3/nJ3POxf3MNdsOiXXBXMte+EvGXUac lgzw== X-Gm-Message-State: AOAM530VhNddzapEAaV4uG2FQ4TldPy/wJT3/Jl1FBuN/rBQmYXdyXse WLlZvNZNJaCW4C/Q7hRfDRRKYhiR09Y54ZVl2h38fRJ15/IuNL2CAiO6a2sH81SKtAkkjPcsQ97 OZ6TW/5ujzURpj9F8F8krNIg4 X-Received: by 2002:a17:906:76d5:: with SMTP id q21mr10696837ejn.17.1625608691883; Tue, 06 Jul 2021 14:58:11 -0700 (PDT) X-Received: by 2002:a17:906:76d5:: with SMTP id q21mr10696799ejn.17.1625608691666; Tue, 06 Jul 2021 14:58:11 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e? ([2001:b07:6468:f312:5e2c:eb9a:a8b6:fd3e]) by smtp.gmail.com with ESMTPSA id u17sm7779485edt.67.2021.07.06.14.58.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Jul 2021 14:58:11 -0700 (PDT) To: Eduardo Habkost 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 References: <20210706195233.h6w4cm73oktfqpgz@habkost.net> <4cc2c5fe-2153-05c5-dedd-8cb650753740@redhat.com> From: Paolo Bonzini Subject: Re: [PATCH 4/4] x86/tsx: Add cmdline tsx=fake to not clear CPUID bits RTM and HLE Message-ID: <671be35f-220a-f583-aa31-3a2da7dae93a@redhat.com> Date: Tue, 6 Jul 2021 23:58:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Paolo