Received: by 10.223.185.116 with SMTP id b49csp1930201wrg; Thu, 22 Feb 2018 05:36:14 -0800 (PST) X-Google-Smtp-Source: AH8x227dI19exwmXpvBzoMnNlObarZlqxgWF8C6lfBHjeJhlQVfTACJc0J3C6+9XunHni9aX9D45 X-Received: by 10.98.141.208 with SMTP id p77mr6897377pfk.5.1519306574060; Thu, 22 Feb 2018 05:36:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519306574; cv=none; d=google.com; s=arc-20160816; b=Bm92BKkcdXCAtsK4378Z2vxFd0vollyZ5U3RTJZZXFolrNaOUKSLqi7ym+byY/qG+z yP9UZoETfCalRomTqGZbRJ9pUvhNDn6q0lN5PxmE8oxCkQxaoBhSmAiICEqNJtSQ1Ube iQyDxWhOG2tCJyzrmaPkMr5ith39lLkVQEkXgTewwoSEjN+4rYB/Os4LzBUfp/hBNZIF uHVPAji6stjA0ggr3iO2vv5FCb0Ic26eDaLL9ZK1fFoXmHf4e2dTlvoaZEMWPx7fMjYN TnhV5fEGNeszl/rN1RcN9vRD7g4VwYgI07NHL6uD7Ivj+hnvVxpOG5H86r10fcjkJb9A wPYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=o6uKbdZqkk79JsDi1t7BjyKsyOlR7I3EDO7pv2ghUEc=; b=eCce+aP4+cY3uE7PGwG9s6K5jw0Miq+nwdRAeW8+ScVInW2pK+PDRVD8BTAdBEQrY5 ctxhMZH0hmQEP14o06/5bgNQRPyypQxX+9tZsBFhPgDx2UhnZ7r3EZ5EE+pTUMPbheK0 1NhXc7HU0D7mfFJ5uYs8ItK7nZuOmattnMGc2PQLvMX74899Jt5ytycRmW7ueK1M6yk7 ZBWzmyLXHH/0HCNXy1xchkS+JaVjv28dgzI6GOryrsloCJgBXXZIiCuOWIQRrjIgxVVK Yd4j2YxlwBbzgscA3NCAxulCAIE4qUBs5QbFXpyGF6flJXm3wfpEP5ayhbiYKHPC/0+E umaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bf8-v6si49779plb.751.2018.02.22.05.35.59; Thu, 22 Feb 2018 05:36:14 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932544AbeBVNfT (ORCPT + 99 others); Thu, 22 Feb 2018 08:35:19 -0500 Received: from smtprelay.synopsys.com ([198.182.47.9]:40050 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753844AbeBVNfS (ORCPT ); Thu, 22 Feb 2018 08:35:18 -0500 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id 0D0E824E0823; Thu, 22 Feb 2018 05:35:18 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id E32E0386C; Thu, 22 Feb 2018 05:35:17 -0800 (PST) Received: from ru20arcgnu1.internal.synopsys.com (ru20arcgnu1.internal.synopsys.com [10.121.9.48]) by mailhost.synopsys.com (Postfix) with ESMTP id B3ED93868; Thu, 22 Feb 2018 05:35:15 -0800 (PST) From: Evgeniy Didin To: linux-mmc@vger.kernel.org Cc: Alexey Brodkin , Eugeniy Paltsev , Douglas Anderson , Ulf Hansson , linux-kernel@vger.kernel.org, linux-snps-arc@lists.infradead.org, stable@vger.kernel.org, Vineet Gupta Subject: [PATCH v2] mmc: dw_mmc: Fix the DTO timeout overflow calculation for 32-bit systems Date: Thu, 22 Feb 2018 16:34:18 +0300 Message-Id: <20180222133418.29336-1-Evgeniy.Didin@synopsys.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In commit 9d9491a7da2a ("mmc: dw_mmc: Fix the DTO timeout calculation") have been made changes which cause multiply overflow for 32-bit systems. The broken timeout calculations caused false interrupt latency warnings and stacktrace splat (such as below) when accessing the SD Card. | Running : 4M-check-reassembly-tcp-cmykw2-rotatew2.out -v0 -w1 | - Info: Finished target initialization. | mmcblk0: error -110 transferring data, sector 320544, nr 2048, cmd response | 0x900, card status 0x0 | mmc_host mmc0: Bus speed (slot 0) = 50000000Hz (slot req 400000Hz, actual | 396825HZ div = 63) | mmc_host mmc0: Bus speed (slot 0) = 50000000Hz (slot req 25000000Hz, actual | 25000000HZ div = 1) | ------------[ cut here ]------------ | softirq: huh, entered softirq 6 TASKLET 6f6a9412 with preempt_count 00000101, | exited with 00000100? | WARNING: CPU: 2 PID: 0 at ../lib/scatterlist.c:652 sg_miter_next+0x28/0x20c | Modules linked in: | CPU: 2 PID: 0 Comm: swapper/2 Not tainted 4.15.0 #57 | | Stack Trace: | arc_unwind_core.constprop.1+0xd0/0xf4 | dump_stack+0x68/0x80 | warn_slowpath_null+0x4e/0xec | sg_miter_next+0x28/0x20c | dw_mci_read_data_pio+0x44/0x190 | dw_mmc f000a000.mmc: Unexpected interrupt latency | dw_mci_interrupt+0x3ee/0x530 | __handle_irq_event_percpu+0x56/0x150 | handle_irq_event+0x34/0x78 | handle_level_irq+0x8e/0x120 | generic_handle_irq+0x1c/0x2c | idu_cascade_isr+0x30/0x6c | __handle_domain_irq+0x72/0xc8 | ret_from_exception+0x0/0x8 |---[ end trace 2a58c9af6c25fe51 ]--- Lets cast this multiply to u64 type which prevents overflow. Tested-by: Vineet Gupta Fixes: ARC STAR 9001306872 HSDK, sdio: board crashes when copying big files Signed-off-by: Evgeniy Didin CC: Alexey Brodkin CC: Eugeniy Paltsev CC: Douglas Anderson CC: Ulf Hansson CC: linux-kernel@vger.kernel.org CC: linux-snps-arc@lists.infradead.org Cc: # 9d9491a7da2a mmc: dw_mmc: Fix the DTO timeout calculation --- Changes since v1: -uint64_t switched to u64 -changed commit message drivers/mmc/host/dw_mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 0aa39975f33b..1a0b9751c67c 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -1944,7 +1944,7 @@ static void dw_mci_set_drto(struct dw_mci *host) drto_div = (mci_readl(host, CLKDIV) & 0xff) * 2; if (drto_div == 0) drto_div = 1; - drto_ms = DIV_ROUND_UP(MSEC_PER_SEC * drto_clks * drto_div, + drto_ms = DIV_ROUND_UP((u64)MSEC_PER_SEC * drto_clks * drto_div, host->bus_hz); /* add a bit spare time */ -- 2.11.0