From patchwork Tue Apr 13 14:43:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1465814 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=eeBPsSy/; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FKSzF0lKyz9sRf for ; Wed, 14 Apr 2021 00:43:50 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D8D0D81D3B; Tue, 13 Apr 2021 16:43:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.b="eeBPsSy/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 522AE81D15; Tue, 13 Apr 2021 16:43:39 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2072c.outbound.protection.outlook.com [IPv6:2a01:111:f400:7d00::72c]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3EEC881CF0 for ; Tue, 13 Apr 2021 16:43:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OeQOyVmnDxGTw33GFI9rpEAy9tebNSG9Skng7zQrAIJdfwKX1e+4Srxk8ncLsDX+Q5KXNkaL4jhugtmH/WsR8y4Hb0FU81DVqjIkVPyOsF4y9RQUJtJYmF6QcUWARoEVTFwrGgdpJ4z8JZ8QKwqGzt2mSQZ9FrK4jW8SpEkQtVP0G6ukRt5PmHR7UhcnTF7kx9FtUtWv1VL0Dqiyi/nf+aJaDbtManyAeAqeeVzde/N55PNivp/AgUTA44wFC4cWDuDJxl7ZWyH9YrECyjO4D1VXUXG72erGKaPC4iO1jHmMgAUh/3Dcfs4qFwfgQaYz+79vBQ87ZO3EnnAgPrAg3Q== 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-SenderADCheck; bh=PfMPWmR06b3WzgG9+estIy5HMgFQMOYLNS+gsV0ft+4=; b=C8GFP9eTJ1fnE+gcG7Yqp3FASTavH3b7zglLnP61uyHi1dxhvvSycWkPYMyASDZZDzlnH39ZZkxWXlRWyMJplJT7/akLYw+l8sMSF/CLOcAA0yrh9fBz7TOrCsEGczPdCPavB0CavzyFhyqr0w6SpIk5wBzOnG/GmkaCp48s+a0MdxMYvY0rVf170hKGxo1ppIe550n9OlrcfFrvTM7mg/P1hKzQfRL0F5QjDB0u+YNNB3ub1PwlhThYVY4NKAwBSDsDPKhxV1BjoMSR2eBFlAxugzG5AiOzYSsbIpUUNLPLyRZ80H2H1DG2wDIf6MtwhwIXrhgqUSHuFcEScxVq9w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PfMPWmR06b3WzgG9+estIy5HMgFQMOYLNS+gsV0ft+4=; b=eeBPsSy/WyESTispT9appf+KKaQFQKIXws8lZdG2oxHWQNFeAn8J3OH3GmDFtKtm4Se04ruMZ+9dU09UBWI2EPBBl6zf7OJj8ZwyMc95i61Z+ziFOkto7/1pqnUAz+UGFNA9mQ8h9QocQ4rRjg9spx3U/qRP/3A0Fzt3p5+jvbE= Authentication-Results: lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM9PR10MB4069.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:1ff::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.22; Tue, 13 Apr 2021 14:43:33 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::edba:45:89f8:b31f]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::edba:45:89f8:b31f%7]) with mapi id 15.20.4020.022; Tue, 13 Apr 2021 14:43:32 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Stefan Roese , Chris Packham , Rasmus Villemoes , Christophe Leroy Subject: [PATCH] watchdog: use time_after_eq() in watchdog_reset() Date: Tue, 13 Apr 2021 16:43:20 +0200 Message-Id: <20210413144320.2504774-1-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.29.2 X-Originating-IP: [80.208.71.248] X-ClientProxiedBy: AM0PR10CA0080.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::33) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (80.208.71.248) by AM0PR10CA0080.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:15::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Tue, 13 Apr 2021 14:43:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c8095abf-7d61-4e23-1836-08d8fe8a82d0 X-MS-TrafficTypeDiagnostic: AM9PR10MB4069: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7daYDVJm+8Oznpc8nVDyqRFjHtpcl1tfQli24LHchKr7K0tZM39GUJIrgZZYRn8gKm+g5GP0iBPPI3FjPx2k64F2UjniOPm2dDsHd7VhbRvoBtYEvtup8cQlSZHaiZdagGejQPKMuCMypbRT1elW61jIS0dbdtMIVANy9KnhR3nzc56VXZWYdfHcv2fpd2ixCrwr/4XGkPqN1PQ8LZopkzwxcplJFJDPeIIbQmSj6e2CgjYE/oeMKfP1oLFSfNpGntcxyo4Bhf8VFQN5wFWGaYnZBEY6cxILeM7H+wUekYMpfkyeQD2kdmJS8Ql0sgcsnRIjWqpqBW2RhR08hhXlGiEi+pE6nA4uozDS+H4o5dLCebrSmBhLFNxyDN0+cd6ja4JcvQluKhrHD4LKeqP4cvnvWuDRM1ZJ984bwYMMj8wvVbnYvTnpTQw2eXTHAcvP40zTXGGFmAcC/1k44iyD1dwW7gCrhMdepbu7z2a/UhGkc9Zg8R7Zc4Pea0Fz9ZPlG+vnwpp52pDGSOyeHmnHduAGOVRJpH5+xg901a9Egf0Rmjpwr1KOh/gtx7Tuzy/deS9e3YhDNPktBp15bRzq5AzsCdcAtM2Y49Wvm9FXclNBAlIMNGFKtDI8GOUSjJ1wBRWqFZEW6MhlviivXOnMYQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(136003)(376002)(39840400004)(366004)(396003)(346002)(54906003)(1076003)(956004)(8676002)(6666004)(66556008)(38350700002)(66476007)(83380400001)(2616005)(52116002)(478600001)(186003)(86362001)(8936002)(36756003)(16526019)(316002)(38100700002)(5660300002)(6512007)(4326008)(26005)(6486002)(66946007)(44832011)(2906002)(6916009)(6506007)(8976002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: PwCB+tUY5rNnNlbNxe8/dCe1CjGuxpav+MpXC+sQI0BLzj/5/fKZmhg1mWPD/zBAOPhAXJm8D6CNSCssePkULhxtRIo0wJ0WLk84D/55F8hBY8f3Kkq0JSq3VCLvVDfsoEik2dmdQTxBAG8B2yGwk+FXksn0ijkHxrHss1IcQR0YI3XzedBVDRLDGpOmsTkOMdqmhX9df1pPAhl3caZxwGychtTe+eQ3bDPN242qIiY8Xudt0bPfIQpEpUsI77+Jtjx9wDDlvYDdQzcYZ+I3yuX6HnPIUnx5Q4UjzCI+lfDdjOwlDFjGfb8KRSnePCZOz9LVj/bZBRjrR3qtqTEbS0VJi02AUHbu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-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2021 14:43:32.7812 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OOLiJrMB3lFSJafheNHdD8qIhXkPZFw3OneB3E6fk3SCy+8EtihKs2xxYcOF7b4DrybBY2mJWLHzajH0jGVEX2N5MqszUQDF8ptQoajM/hk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR10MB4069 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean Some boards don't work with the rate-limiting done in the generic watchdog_reset() provided by wdt-uclass. For example, on powerpc, get_timer() ceases working during bootm since interrupts are disabled before the kernel image gets decompressed, and when the decompression takes longer than the watchdog device allows (or enough of the budget that the kernel doesn't get far enough to assume responsibility for petting the watchdog), the result is a non-booting board. As a somewhat hacky workaround (because DT is supposed to describe hardware), allow specifying hw_margin_ms=0 in device tree to effectively disable the ratelimiting and actually ping the watchdog every time watchdog_reset() is called. For that to work, the "has enough time passed" check just needs to be tweaked a little to allow the now==next_reset case as well. Suggested-by: Christophe Leroy Signed-off-by: Rasmus Villemoes Reviewed-by: Stefan Roese --- It's the option I dislike the most (because of the DT abuse), but I also do accept that it's the one with the minimal code impact, and apparently the path of least resistance. So here it is. drivers/watchdog/wdt-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c index 0603ffbd36..2687135296 100644 --- a/drivers/watchdog/wdt-uclass.c +++ b/drivers/watchdog/wdt-uclass.c @@ -148,7 +148,7 @@ void watchdog_reset(void) /* Do not reset the watchdog too often */ now = get_timer(0); - if (time_after(now, next_reset)) { + if (time_after_eq(now, next_reset)) { next_reset = now + reset_period; wdt_reset(gd->watchdog_dev); }