Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5943537ybe; Tue, 17 Sep 2019 16:34:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6uRUA/1JKFM5F5b25ls2D3PjYJHPZy5JpNl9SqyRF7uTcETHhdxRZqEVfhj7Q+E07X5nn X-Received: by 2002:a17:906:48d4:: with SMTP id d20mr7154609ejt.84.1568763287274; Tue, 17 Sep 2019 16:34:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568763287; cv=none; d=google.com; s=arc-20160816; b=TE/GxK3/bKWpiLKCxp6yMSBS0ioVPUD5+7IJnc7dCZwLTvl4dg4+uxtc4VPR5+jIbL c1+iDbwY/YAtTl/DsYRiU03Vf1DlY7nzuXKay8xHySE0emMQAalC+g5u38swZJgjqUBJ cmXPUk+AbuW+Mea04jFivNi4d0JvSzOsGt9VpAthlTwOxmsr2BzrKJKQfBicSlob7DPb lOu0Ysx3fyW1TwTxL+bn8skCT5F3IrYxJUXm5SdTI3njz4vcDPRudUVlUmzHIcC+hZlC +Gx1xTtHFSFvmnaPR/rMO2fCT0Z7mAJpNUNiwQqVJcU52v/3ejyrNDsYFbtreho2pxEh 7gew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:openpgp:from:references:cc:to:subject; bh=jS+ZWi+aIzVL4RGXZzRns8oVj2lE4iWxT+LDZNVf+Zo=; b=baXjEr/wkYtCcO8PGWVBUy183r7dcnIdxz1ueJGYRuEbaVGd078zHjfnfUXHSE4hJd JJ9yRSrtWW0LGMr5TycmHO1gCfs8baOvCs99Tlki0mIVkEj8Z04wcMhkfV1Ullkknb8f vYDaJND88hJRGDwWkCg8lRx0kJw26qtJkPH46dDzowAeId9N35fSfSo7Al68jFu5R4j+ HitZPuT8shKdl7bu3CvTh4gpzfOF4Gj7E8B1sMScrC9Y8lusRE5gL/JBSpCja8Bfl4/E SJoJNedCPfeQuRVueTIPmuGD8hPsVauopWbPs7GZGTqi74bwQTVEeOuxsrhCwcsZ4aIK E8pg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j14si2187865edt.298.2019.09.17.16.34.23; Tue, 17 Sep 2019 16:34:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726574AbfIQOHV (ORCPT + 99 others); Tue, 17 Sep 2019 10:07:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47978 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726545AbfIQOHV (ORCPT ); Tue, 17 Sep 2019 10:07:21 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 43A8EC05168C for ; Tue, 17 Sep 2019 14:07:20 +0000 (UTC) Received: by mail-wr1-f70.google.com with SMTP id f11so1349645wrt.18 for ; Tue, 17 Sep 2019 07:07:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=jS+ZWi+aIzVL4RGXZzRns8oVj2lE4iWxT+LDZNVf+Zo=; b=Ytfc8Xt2yeggPe0qEcD+pg+Lmkhx4ISHnq/T4U4f7zSdyQgBKrddwojaXiuCslW45G K9tunQXEgK4K+gm/LymfrR0nQjJ2n+mkyK2RnQNmjRy1cqURQnJl05ewpaAvml1lo60M s3IjohdFMWi5D8J5lC/kYEk8lc7j1wQO/sua6/MHB2iuipz22W1VKSAEJgc6Ya4vM+yN B0Dy6qSh2+IeozJRoU/v1IV0+qx4774nMZ2S86wXH/LFawNFUX6TBpo3Za3GOXEBTXDA 7ZSwjEbZqoGKFSjn8RjmEawUMaHtYeTJiuTj0tf+7QrbgWUSKvJmgMQvdzsZ4tGBPuh3 CJIw== X-Gm-Message-State: APjAAAXn5BdhuAshg6F3cgqIVeW8qz0siGU8XdvbLZKPy5ZdpP2573te u2QnqbsKdyPok1tu/BZJHAUtQR8Jq7CfTiXJX4yN8ZcjM6OLbVnwzUl0uXFDYzCsJWBPeR8ROhd 4LNMXAhVrOaFC+78AWUm+11I1 X-Received: by 2002:a5d:5403:: with SMTP id g3mr3107317wrv.338.1568729238785; Tue, 17 Sep 2019 07:07:18 -0700 (PDT) X-Received: by 2002:a5d:5403:: with SMTP id g3mr3107294wrv.338.1568729238531; Tue, 17 Sep 2019 07:07:18 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c46c:2acb:d8d2:21d8? ([2001:b07:6468:f312:c46c:2acb:d8d2:21d8]) by smtp.gmail.com with ESMTPSA id h17sm4148586wme.6.2019.09.17.07.07.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Sep 2019 07:07:17 -0700 (PDT) Subject: Re: [PATCH 1/3] cpu/SMT: create and export cpu_smt_possible() To: Jim Mattson , Vitaly Kuznetsov Cc: kvm list , LKML , linux-hyperv@vger.kernel.org, the arch/x86 maintainers , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Sean Christopherson , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , "Peter Zijlstra (Intel)" , Michael Kelley , Roman Kagan References: <20190916162258.6528-1-vkuznets@redhat.com> <20190916162258.6528-2-vkuznets@redhat.com> From: Paolo Bonzini Openpgp: preference=signencrypt Message-ID: <4704aac9-cac2-f04d-8344-6642432c31e2@redhat.com> Date: Tue, 17 Sep 2019 16:07:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16/09/19 19:16, Jim Mattson wrote: >> KVM needs to know if SMT is theoretically possible, this means it is >> supported and not forcefully disabled ('nosmt=force'). Create and >> export cpu_smt_possible() answering this question. > It seems to me that KVM really just wants to know if the scheduler can > be trusted to avoid violating the invariant expressed by the Hyper-V > enlightenment, NoNonArchitecturalCoreSharing. It is possible to do > that even when SMT is enabled, if the scheduler is core-aware. > Wouldn't it be better to implement a scheduler API that told you > exactly what you wanted to know, rather than trying to infer the > answer from various breadcrumbs? Yes, however that scheduler API could also rely on something like cpu_smt_possible(), at least in the case where core scheduling is not active, so this is still a step in the right direction. Paolo