Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2248488rdb; Mon, 20 Nov 2023 06:17:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IHmblSiBYM8Z7KYV0zPhimSpAzPAsNm/pToHELLBku/40T0yhlZ0GNNY5Ox80xvXao4XEVl X-Received: by 2002:aca:1e19:0:b0:3af:585:402a with SMTP id m25-20020aca1e19000000b003af0585402amr8473526oic.39.1700489861267; Mon, 20 Nov 2023 06:17:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700489861; cv=pass; d=google.com; s=arc-20160816; b=KsbTbtYLYZrXRUyyPXsWIN6yJyko6Wl+pvMCDCJaAK5n3ByLWMQZjXqV4otbQcOhKS bc0yOqLvBfQdV/CXrGw1wkk5VSwDw2GsvfcU1C05CJkPghpfab+uYkqfru0ge+kDGaMF aZQ2zX2V2+sPbMWZ4yeNfY97Jt8sg9DWhRq0Adnj8Wb4ApXi/gpQT0t47SMoE3+mn14e QGP9wu5bGUdWx4YfOjqXBMPVMWgNNWW+CIMNjt9sgz0I6EZ4Ny55Fr6emZ4EQgQHnH/H 8C8jqglrbUMNTy/tP1wKAkrjW5SjD55aZZjEAM1R6i6NOQRIZS5AINk05A31jWuUpCSS EyXw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5CgYUedyKiO6EIimQ7+v0ot41IaJmK11YFGpcndJIq8=; fh=ymaRkomZM+R14u9KePKW0Fq87oztHn6zURB34jTKP1c=; b=0sGA+hWkavaSRvf+E/x7BcMOnBfqcjXOnsgyI31ym/gs/ZNSRc4JEpWoPE9Mz1pCoV /uYrJiN278rmK/aVqM1ziDmtScSGl+Er3zGpLwT7TtXogqw5MKHCx3vnmaUyIMX0rani vqrid7Y3mRUOrqICT676hDY/3Tza7lQhnVxpB/AEPoNBOyYryMWzNtm60AwDyZrbArnl MHooAQpRm2bXfJZclomyLsj3kUFEdWMlF4xjIiYM0edlh+8W/nxS7BvHlJ4faicTFe+L kOM8kV03282dZcOlHGsbY2Maz4xspNpNpk+JKVjD9nrqUYpWCr9ZVsORLBJl5oIIxizP ZptQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=xr2T4ATF; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id w22-20020a63c116000000b005b9602a7badsi8441191pgf.688.2023.11.20.06.17.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 06:17:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=xr2T4ATF; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 62C0480A4146; Mon, 20 Nov 2023 06:17:37 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233128AbjKTOQg (ORCPT + 99 others); Mon, 20 Nov 2023 09:16:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233345AbjKTOQ0 (ORCPT ); Mon, 20 Nov 2023 09:16:26 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2062.outbound.protection.outlook.com [40.107.223.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBB0210C; Mon, 20 Nov 2023 06:16:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hCHsL1dBRYy3zmdGtvj7J25O3LSZ44ynvLGTQImdTsl6xLFd3OlXIu+6K8NfTMmDid77kKf1FVcWffZHulXqkivYo95ITNnNqAHo5wBVZTYZdH1XsuK+PGbYSgHQMNpxGdeaErI65YFNvikZNJTVbXC8zXq79/3jyIRU0xdgmo77NPDy5qRVRdf93JfE9WCmjfPfe8O7CZfy8SiHl116e5dXmjZo3sc3DfjtEcQl9SAODIg3U3wY//ulufY7y53dBl1FV1d9OvpNLpej6m4P/VXTJ402Ram6/E8/C8U+f58EfSRCCNIIBklNrL3/LNuj8ZPvKE76nOlZMIOLjK1n3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5CgYUedyKiO6EIimQ7+v0ot41IaJmK11YFGpcndJIq8=; b=ABo88JEH9BtR8Lm/4WmONMpyY+QNDH0LhvC0+v+XUcsAmClkdwMS17czn4dhRO4Qpzvop30HBUiJe93+XqWQe5YSTnTYbU70jJQ2X3K/aX0c8MMFq1lxaLAAxasmAfWfwpdxYK+k0/oR1mPFuvLgHKjHzy4zGBt2z+hAU5bt+rBAJGxhSW3JdJiDWf7LRhmtvdf1TeHVRr/Oc8hJte4F1ce8CKiqdq+XIQFBePLi9Kt6AXDpek3tFmkhpShh0vTDiuWYSDknPoFGgjtUcl7txuIwwC1Z1CVye1ChGY6qhDfrdDPplHfBYfiRgTyxR3HAqVtm9hSKTHJyTil4oihvkg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=o2.pl smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5CgYUedyKiO6EIimQ7+v0ot41IaJmK11YFGpcndJIq8=; b=xr2T4ATFBEezhvbhmqd1Kr82S+LUavivU1sMmeqL+14c2BPnkqpe3KF3P4DtfZTi+li9lJ+nzuMMIsQcwEKViTllKF9aMftVkpNSjVraYZhyWTo9CaFGRig6zPj2zVf3zHp69AuHKDxT06uX+qFM8DuqOyly5r9EvYV2AY8g0vU= Received: from CY8PR12CA0072.namprd12.prod.outlook.com (2603:10b6:930:4c::15) by CY8PR12MB8216.namprd12.prod.outlook.com (2603:10b6:930:78::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.27; Mon, 20 Nov 2023 14:16:21 +0000 Received: from CY4PEPF0000EE3E.namprd03.prod.outlook.com (2603:10b6:930:4c:cafe::b0) by CY8PR12CA0072.outlook.office365.com (2603:10b6:930:4c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.27 via Frontend Transport; Mon, 20 Nov 2023 14:16:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000EE3E.mail.protection.outlook.com (10.167.242.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7025.12 via Frontend Transport; Mon, 20 Nov 2023 14:16:20 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Mon, 20 Nov 2023 08:16:19 -0600 From: Mario Limonciello To: =?UTF-8?q?Mateusz=20Jo=C5=84czyk?= , Alessandro Zummo , Alexandre Belloni CC: "open list:REAL TIME CLOCK (RTC) SUBSYSTEM" , open list , , , , , , , , "Mario Limonciello" Subject: [PATCH v2 4/4] rtc: Extend timeout for waiting for UIP to clear to 1s Date: Mon, 20 Nov 2023 08:15:55 -0600 Message-ID: <20231120141555.458-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231120141555.458-1-mario.limonciello@amd.com> References: <20231120141555.458-1-mario.limonciello@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE3E:EE_|CY8PR12MB8216:EE_ X-MS-Office365-Filtering-Correlation-Id: 8d9f8afb-11e5-4ced-90a8-08dbe9d34528 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MVWJJC5EZmpDXlhwHJnH2BSEL0pyjTy2A+ZTErcCmrljP5+a3SIFpDmyO6cR2uswdRtCJSccz1I7jW5TkWQiNnmkDFksXnx/B/VOc3rs3//gSHAhkB2K+vp0ibuWTF7Gv5gBNN7A5aQ+fKMz1g56/ojOgymDD8PiUUAz2IP8nLJw37XDXBD3ZHLw/5IIpBHcYzu8PoKTC17Trl9AVrWH6ttCI86pQUKkfj2DtX+5UeMgWT7pC0lCgtRNBxZ2PHTKqK6og/2ZpcuYbpagD9D2h5lrbYD8PwRgIHiCioL7O+c+TD4MkLfAcYNJRUmu7gwDKfTb4BHrqZrBhhi/Cw87W7jp3WEJ/luSG2NtBkmBausiK2UajAPnf6QpoDnOA+0iLW3q/5Xg4u94xB9iQTvdTNeNM8xORJazq85Aic6RQ8xPWim3D8MXa18n6c/0Bw3CWl5ZmD70AWLHiD1SSntAL5rRUFVvc2jgWFb3/+aLC3yrZUo25No9sDo3vmWD8IQR0OrRU8ZY7FvPCUEPS7xy9FMlVqKxNp56yLjQ4SP0ruK3Mr69lbT6Ov5JwW/3LbJf/LnXkzRc+27NSP+lErzI5zTBNRTkU/PHYB/OGYKCTFDOz7l9etSC4GX7o3qyQzRFqDyZJuKHAtwaDdEaDmEeooa5cirwofjgMrc039nwpmMJOsO1xB1IG18HmF76AeBwb8WZlee/td5AZ/l/yN+TUXrz2AFS3/qhO7yT+ZBuOVcaBRgFjuog0YCYlJOZ/EipJjIg47j3FUpWnllaYJA0Dw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(136003)(396003)(376002)(39850400004)(346002)(230922051799003)(451199024)(64100799003)(186009)(1800799012)(82310400011)(46966006)(40470700004)(36840700001)(40460700003)(83380400001)(426003)(336012)(26005)(16526019)(1076003)(47076005)(36860700001)(41300700001)(4326008)(8676002)(8936002)(7416002)(2906002)(44832011)(5660300002)(478600001)(966005)(7696005)(6666004)(110136005)(70586007)(70206006)(54906003)(316002)(36756003)(81166007)(86362001)(82740400003)(356005)(2616005)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2023 14:16:20.9621 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8d9f8afb-11e5-4ced-90a8-08dbe9d34528 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EE3E.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB8216 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 20 Nov 2023 06:17:37 -0800 (PST) Specs don't say anything about UIP being cleared within 10ms. They only say that UIP won't occur for another 244uS. If a long NMI occurs while UIP is still updating it might not be possible to get valid data in 10ms. This has been observed in the wild that around s2idle some calls can take up to 480ms before UIP is clear. Adjust callers from outside an interrupt context to wait for up to a 1s instead of 10ms. Cc: stable@vger.kernel.org # 6.1.y: commit d2a632a8a117 ("rtc: mc146818-lib: reduce RTC_UIP polling period") Fixes: ec5895c0f2d8 ("rtc: mc146818-lib: extract mc146818_avoid_UIP") Reported-by: xmb8dsv4@gmail.com Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217626 Signed-off-by: Mario Limonciello --- v1->v2: * Add tags --- arch/x86/kernel/rtc.c | 2 +- drivers/base/power/trace.c | 2 +- drivers/rtc/rtc-cmos.c | 2 +- drivers/rtc/rtc-mc146818-lib.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c index 961ebc7f1872..2e7066980f3e 100644 --- a/arch/x86/kernel/rtc.c +++ b/arch/x86/kernel/rtc.c @@ -67,7 +67,7 @@ void mach_get_cmos_time(struct timespec64 *now) return; } - if (mc146818_get_time(&tm, 10)) { + if (mc146818_get_time(&tm, 1000)) { pr_err("Unable to read current time from RTC\n"); now->tv_sec = now->tv_nsec = 0; return; diff --git a/drivers/base/power/trace.c b/drivers/base/power/trace.c index c2e925357474..cd6e559648b2 100644 --- a/drivers/base/power/trace.c +++ b/drivers/base/power/trace.c @@ -120,7 +120,7 @@ static unsigned int read_magic_time(void) struct rtc_time time; unsigned int val; - if (mc146818_get_time(&time, 10) < 0) { + if (mc146818_get_time(&time, 1000) < 0) { pr_err("Unable to read current time from RTC\n"); return 0; } diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index d278b085821e..6bc1e0279cd9 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c @@ -231,7 +231,7 @@ static int cmos_read_time(struct device *dev, struct rtc_time *t) if (!pm_trace_rtc_valid()) return -EIO; - ret = mc146818_get_time(t, 10); + ret = mc146818_get_time(t, 1000); if (ret < 0) { dev_err_ratelimited(dev, "unable to read current time\n"); return ret; diff --git a/drivers/rtc/rtc-mc146818-lib.c b/drivers/rtc/rtc-mc146818-lib.c index 5abb925da4fa..9191e5f50fae 100644 --- a/drivers/rtc/rtc-mc146818-lib.c +++ b/drivers/rtc/rtc-mc146818-lib.c @@ -91,7 +91,7 @@ EXPORT_SYMBOL_GPL(mc146818_avoid_UIP); */ bool mc146818_does_rtc_work(void) { - return mc146818_avoid_UIP(NULL, 10, NULL); + return mc146818_avoid_UIP(NULL, 1000, NULL); } EXPORT_SYMBOL_GPL(mc146818_does_rtc_work); -- 2.34.1