Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFAC5C433F5 for ; Mon, 13 Dec 2021 10:04:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241463AbhLMKEi (ORCPT ); Mon, 13 Dec 2021 05:04:38 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:45550 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240022AbhLMJ7O (ORCPT ); Mon, 13 Dec 2021 04:59:14 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 355D9B80E7E; Mon, 13 Dec 2021 09:59:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 122F8C3460D; Mon, 13 Dec 2021 09:59:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1639389550; bh=jQN/HNVVbD2WGBmSRc+jLwnRdojvjt56bzQhZG2x9iE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=btBDc1/ofCdCjVAsYBGtkTi/y1PSoYutJYcJ1DtH6OS/Hw4+kGyzIoxdsBjEeST8R xwIIDgW3hJRGvUeZxNukAQUCvWXxdmRpH3QOpaEIQLJ5un8LuEEajhcO7mKRUIhLOR xNTIpAEbj3PgW5YNdvccX4dTTarAMjWJcr4tkl5s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Rogers , Alexander Shishkin , Andi Kleen , Jiri Olsa , John Garry , Kajol Jain , Kan Liang , Konstantin Khlebnikov , Mark Rutland , Namhyung Kim , Paul Clarke , Peter Zijlstra , Stephane Eranian , Arnaldo Carvalho de Melo Subject: [PATCH 5.15 126/171] perf tools: Fix SMT detection fast read path Date: Mon, 13 Dec 2021 10:30:41 +0100 Message-Id: <20211213092949.289871261@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211213092945.091487407@linuxfoundation.org> References: <20211213092945.091487407@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ian Rogers commit 4ffbe87e2d5b53bcb0213d8650bbe70bf942de6a upstream. sysfs__read_int() returns 0 on success, and so the fast read path was always failing. Fixes: bb629484d924118e ("perf tools: Simplify checking if SMT is active.") Signed-off-by: Ian Rogers Cc: Alexander Shishkin Cc: Andi Kleen Cc: Jiri Olsa Cc: John Garry Cc: Kajol Jain Cc: Kan Liang Cc: Konstantin Khlebnikov Cc: Mark Rutland Cc: Namhyung Kim Cc: Paul Clarke Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lore.kernel.org/lkml/20211124001231.3277836-2-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/util/smt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/tools/perf/util/smt.c +++ b/tools/perf/util/smt.c @@ -15,7 +15,7 @@ int smt_on(void) if (cached) return cached_result; - if (sysfs__read_int("devices/system/cpu/smt/active", &cached_result) > 0) + if (sysfs__read_int("devices/system/cpu/smt/active", &cached_result) >= 0) goto done; ncpu = sysconf(_SC_NPROCESSORS_CONF);