From patchwork Fri Feb 17 14:23:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 58621 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp914482wrn; Fri, 17 Feb 2023 06:25:58 -0800 (PST) X-Google-Smtp-Source: AK7set+bYhUKhB2rZ2Dm9fMxEJmmC0u7t6NLaGXR0K0yEt5pB4wmnj4ExZ0io/Ho4/oKIz/v9Iyy X-Received: by 2002:a17:907:1c9f:b0:8b1:70d0:cb65 with SMTP id nb31-20020a1709071c9f00b008b170d0cb65mr5760596ejc.11.1676643958032; Fri, 17 Feb 2023 06:25:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676643958; cv=none; d=google.com; s=arc-20160816; b=UfYIH6xNgLctFdrtYOUQfBoLrvdON2rSCbj/wN0B+ksdAv6XJsWkixmotxyCEg5FF8 BpEmhK9fhYbP0ZhRVxH5IYul3YfvUjwCOX00leRSOyl5sbZpGVZ0pb+4PhbEfG0F+iHL F1AXFQf1nUwfTkA6RLWvMLUMtsriaoGfe3etCFQEuunM6295CfHfymbiLVGf3eZyR4Ce /8vRcB8PWHlvUyiVsHiyzeX2EAPt5fBhoR6xzo3oP2x+hWpZ6OY+77qfXMgdJyljv/Jd gDe+mrtrjy6yocdVa6JCAkobsmi0UESBGUQohcaxJZLjkhPsAlNizh6ucPjXkMEl9jLO 5C0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=/r1THNGgRM5btnnh99j8Pd1lIXUkhgzTKBHXgpl+7Go=; b=C8/GagtLTuJrPFeSElKCDkCkLlO5V8UUbbnX8hrZ7j6g5kBLZae9pzQtxZg/Tx9wOp IvsGIk4g6JbBzs7sGzc2jB80uwNoziSu+zIhB4U6Hiy/5C14/o+4pd3Y/YzMISkMI5/c XYkULPvo8f96F3WB+WyVI5vPtK6eGoswiyyFKnks1R2wF6oYPcRO2mEQPjLSPipRIFfo jqrdKOD1+IZ4LiOYMI9AEPveRjo66FxCNTyrY2jLrVq4uPQxURKm3xX1K5VMUbykpBAA kclZJ2lmitcz7/KqX7WrVS//d8Jl6yjQCdRiZBjS2fo1qOkVPKf5b/vdnH8HcVrc70Ne Xvxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ryliv6Cy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ay22-20020a170907901600b008b128c10e7asi5111959ejc.215.2023.02.17.06.25.26; Fri, 17 Feb 2023 06:25:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Ryliv6Cy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229672AbjBQOX7 (ORCPT + 99 others); Fri, 17 Feb 2023 09:23:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229660AbjBQOX5 (ORCPT ); Fri, 17 Feb 2023 09:23:57 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A90AD7DA4; Fri, 17 Feb 2023 06:23:56 -0800 (PST) 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 5A066B82C18; Fri, 17 Feb 2023 14:23:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29FA3C433EF; Fri, 17 Feb 2023 14:23:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676643834; bh=7H2DeJNOEk7tlRz3sYy/zEMbu3crAXpNlXvgJu8H2B4=; h=From:To:Cc:Subject:Date:From; b=Ryliv6CyfFtLPk07eFlM1P/VsYsX/f6nTJIhgKkH254ZWYbt9cspnrn7f4QUOpptC fjf3jxU0IFBjuoBPtPxdS+v1NW1iWasjA66+9Q3Rb2wBNfm+14lGYI41ySDBL75BGu 7rrRGEtg277a9mtwJrZmnk6xcJonfwNLkFssKam4UBKiuShXyCEdxfBwKiVAJJM8/m dAU5npIUenIDIyvvYu+EOFTgJpiYwucd10LTamfKfrCM7wdIswihhnWoVziYyDh/bW NC027eQkGGG7gOkZKAN1N7EhLSOdirgZavRFYI+Od9xv4sZzhHx3MU2WUBopfGUezC 8X0d+3A88l+uQ== From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: a.zummo@towertech.it, alexandre.belloni@bootlin.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-rtc@vger.kernel.org, Ard Biesheuvel , Pierre Gondois , Alexandru Elisei Subject: [PATCH] rtc: efi: Avoid spamming the log on RTC read failure Date: Fri, 17 Feb 2023 15:23:38 +0100 Message-Id: <20230217142338.1444509-1-ardb@kernel.org> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1297; i=ardb@kernel.org; h=from:subject; bh=7H2DeJNOEk7tlRz3sYy/zEMbu3crAXpNlXvgJu8H2B4=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBj743p2GXrREsNQPTcNdf5BEQsIa5li4nOa/vDP VT7oy+Ci+KJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCY++N6QAKCRDDTyI5ktmP JOQMDADAj7RTrpvWaj/z9/rWenkV64kqh5DBzl+USFcDavcgaH9/HcyE/xMykGaNQtKzRTyZB6O 52ewPcDnWvyZxAubHoM8vQB8CVs3eVE30PpWWjv7pKUGrbqopFbsxoENfUnHG/BExKRSOu99deN CdlzHSBbWg2Hiy5QLY06dy1JeL22opoORoCiux6vS81PRnEJUBzO3PRs4LHkd01KtwM4R3Y86RS 8X38i3YmXU8wqrE3O3BhCBL3Jpkyf+DLxIqabkxUpJgIn1/9cKwp3qEot8wjqs/LxgaiOlERG7f cSH7S9dpfVPPWR/gICye4knitO0kwiqL7qAEHHVVnsB+Wwtn4tZBcT9MgMPW+YxztFraXUMPvrg LPWReVlyoUwsdxrXc93euUs13Qg3wH2ZGIza49byPzjAoAqJ1a/scwJb0ESsAjGerE2A8AIUnAq jFAZC8FxB16GF5LCDfsmHfzZtcqugLQ3tE1gNhUO9L+F7jJYDoA+lzxzdiuiEoTcMno4w= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758088615124736197?= X-GMAIL-MSGID: =?utf-8?q?1758088615124736197?= There are cases where the EFI runtime services may end up in a funny state, e.g., due to a crash in the variable services, and this affects other EFI runtime services as well. That means that, even though GetTime() should not return an error, there are cases where it might, and there is no point in logging such an occurrence multiple times. This works around an issue where user space -apparently- keeps hitting on /dev/rtc if it fails to read the h/w clock, resulting in a tsunami of log spam and a non-responsive system as a result. Cc: Pierre Gondois Cc: Alexandru Elisei Link: https://lore.kernel.org/all/Y2o1hdZK9GGDVJsS@monolith.localdoman/ Signed-off-by: Ard Biesheuvel --- drivers/rtc/rtc-efi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-efi.c b/drivers/rtc/rtc-efi.c index e991cccdb6e9cee4..174959f783b8309b 100644 --- a/drivers/rtc/rtc-efi.c +++ b/drivers/rtc/rtc-efi.c @@ -164,7 +164,7 @@ static int efi_read_time(struct device *dev, struct rtc_time *tm) if (status != EFI_SUCCESS) { /* should never happen */ - dev_err(dev, "can't read time\n"); + dev_err_once(dev, "can't read time\n"); return -EINVAL; }