From nobody Mon May 13 07:46:54 2024 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 C94A9ECAAD8 for ; Thu, 22 Sep 2022 20:03:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231949AbiIVUDB (ORCPT ); Thu, 22 Sep 2022 16:03:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229777AbiIVUCW (ORCPT ); Thu, 22 Sep 2022 16:02:22 -0400 Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AE3B2F647; Thu, 22 Sep 2022 13:02:20 -0700 (PDT) Received: from pps.filterd (m0150241.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MHCnSr018532; Thu, 22 Sep 2022 20:01:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pps0720; bh=hrmDoxXNnaoMzX0uDj4vrE4mN2zUsUoIEygEbT+8Fgg=; b=ggzTAojvzWg9UuHd2E3gGj0AQolEZFYj69pwstnwr6PXevDpRAlZwN7ReF8PZlgNKyvF R5451w6y5HL6y9H51iz+Sos6TTt7WpsRjbNczX1rSVKxh4LTo+00R7ZWPkvwI1FCKK5c JrXddx9GBriQmOqL3uA9kb1yeHz8iTJ9L2pK+XkMMwht4LnCxyAgV1vs45wtZSbiMuhY o1r7OMwPYSnh4HRoqRXLHroaWpwbZ6kTDMYFdPEuPQ0L81ZJX+BC6IK8hgW6V7t+XKfy Kj+8shhPat0PRxjRO5mmIZpXJFleYWEegUHvgXepsPZbkMjSmgobeM5z14XCjtk6/kZD yg== Received: from p1lg14880.it.hpe.com (p1lg14880.it.hpe.com [16.230.97.201]) by mx0a-002e3701.pphosted.com (PPS) with ESMTPS id 3jruwbhb07-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Sep 2022 20:01:41 +0000 Received: from p1lg14885.dc01.its.hpecorp.net (unknown [10.119.18.236]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by p1lg14880.it.hpe.com (Postfix) with ESMTPS id 382EE801AD4; Thu, 22 Sep 2022 20:01:40 +0000 (UTC) Received: from dog.eag.rdlabs.hpecorp.net (unknown [16.231.227.36]) by p1lg14885.dc01.its.hpecorp.net (Postfix) with ESMTP id E0EF9807672; Thu, 22 Sep 2022 20:01:37 +0000 (UTC) From: Mike Travis To: Borislav Petkov , Dave Hansen , Ingo Molnar , Thomas Gleixner , Steve Wahl , x86@kernel.org Cc: Mike Travis , Dimitri Sivanich , stable@vger.kernel.org, Andy Shevchenko , Darren Hart , "H. Peter Anvin" , Russ Anderson , linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org Subject: [PATCH v2] x86/platform/uv: Dont use smp_processor_id while preemptible Date: Thu, 22 Sep 2022 15:00:35 -0500 Message-Id: <20220922200035.94823-1-mike.travis@hpe.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: hHU9eJaViupHQ3IJVxCe-wNB3pgRoexl X-Proofpoint-ORIG-GUID: hHU9eJaViupHQ3IJVxCe-wNB3pgRoexl X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-22_14,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 adultscore=0 clxscore=1011 phishscore=0 mlxscore=0 priorityscore=1501 spamscore=0 malwarescore=0 mlxlogscore=999 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220129 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" To avoid a "BUG: using smp_processor_id() in preemptible" debug warning message, disable preemption around use of the processor id. This code sequence merely decides which portal that this CPU uses to read the RTC. It does this to avoid thrashing the cache but even if preempted it still reads the same time from the single RTC clock. Signed-off-by: Mike Travis Reviewed-by: Steve Wahl Reviewed-by: Dimitri Sivanich Cc: stable@vger.kernel.org --- v2: modify patch description, add Cc:stable tag --- arch/x86/platform/uv/uv_time.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/x86/platform/uv/uv_time.c b/arch/x86/platform/uv/uv_time.c index 54663f3e00cb..094190814a28 100644 --- a/arch/x86/platform/uv/uv_time.c +++ b/arch/x86/platform/uv/uv_time.c @@ -275,14 +275,17 @@ static int uv_rtc_unset_timer(int cpu, int force) */ static u64 uv_read_rtc(struct clocksource *cs) { - unsigned long offset; + unsigned long offset, time; + unsigned int cpu =3D get_cpu(); =20 if (uv_get_min_hub_revision_id() =3D=3D 1) offset =3D 0; else - offset =3D (uv_blade_processor_id() * L1_CACHE_BYTES) % PAGE_SIZE; + offset =3D (uv_cpu_blade_processor_id(cpu) * L1_CACHE_BYTES) % PAGE_SIZE; =20 - return (u64)uv_read_local_mmr(UVH_RTC | offset); + time =3D (u64)uv_read_local_mmr(UVH_RTC | offset); + put_cpu(); + return time; } =20 /* --=20 2.26.2