Received: by 10.223.185.116 with SMTP id b49csp3817071wrg; Mon, 26 Feb 2018 06:36:20 -0800 (PST) X-Google-Smtp-Source: AH8x226kOCsjyiejw8R/GOkgI3UVtPeCS1eBqU/5Rb1CHAvc73/PDB9kBTmAytm/3C2D5lcPC6V9 X-Received: by 10.101.97.207 with SMTP id j15mr8488331pgv.266.1519655780265; Mon, 26 Feb 2018 06:36:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519655780; cv=none; d=google.com; s=arc-20160816; b=t3dNPAeSW1R+kduD8v6zo9mWrCzreipemMzYykAruvzEl3EgaZ9JtsLZvhr6gepISE 129pkx2JyEwILSpy9u85Ap+opaivMASVl94ZZOnBK3Sfi2mik2brf884Y41doOwSskxj JUvM/nHKTznuUv6lKrKXMckDd/7zES47qLJbgwJv4GKBKWo4DPdpVbF6NDYY70wVLgzt 2Tvqh06MNsfGM7Y6bYoAldL8o/dUQFFvk8BfJ1cz0MVvfOQ7+RxWVXyhBN0L29RHJ1JK JwMzsjj38gfsKew6WJIxJiO1VvXB2Dam79mL1m8Pc+vKjb0SsWR1FMvUveM/kUIjFTUY gIhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=rGt7pjR4q+YScTtDSA8W2kkAleIVhEhySR1fN4tCwcc=; b=kzmYuhXjBkBR2S2kP48qV7fvpfP5WI0Rwn1lXV9+NBXu5YCdXmtgDOUSxQGEFue71Q YIjIfvpFn/dKBpk3RkBqPzQwInXlRH+EiCPZVrsVKEq08nSNpdWTDIEHjTM4T/JD7e/R iWUE0mox4BbGt4B9IAqMPnpQe6QiZw5PFCP5yWYJTc7Yq+CyPH3a21UDF8cBDHMkIkG+ SMmxowNBfLu4+H3znyFEjzyiveKNaP37/8HJifBGxFqWjx/kWVBRlTZuCX7zf20RO/5S RAcrIZljVhX9ug1yFQBuS3fXYj92ZNxJa2Blr6XyHw/v+PbEKQ+sA9ZuwD/cTcobQXb+ l6QQ== 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 w3si5577156pgb.258.2018.02.26.06.36.05; Mon, 26 Feb 2018 06:36:20 -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 S1753896AbeBZOeh (ORCPT + 99 others); Mon, 26 Feb 2018 09:34:37 -0500 Received: from us01smtprelay-2.synopsys.com ([198.182.47.9]:34151 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753812AbeBZOe1 (ORCPT ); Mon, 26 Feb 2018 09:34:27 -0500 Received: from mailhost.synopsys.com (mailhost2.synopsys.com [10.13.184.66]) by smtprelay.synopsys.com (Postfix) with ESMTP id 6693824E0FF4; Mon, 26 Feb 2018 06:34:27 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 4F9593BA0; Mon, 26 Feb 2018 06:34:27 -0800 (PST) Received: from ru20arcgnu1.internal.synopsys.com (ru20arcgnu1.internal.synopsys.com [10.121.9.48]) by mailhost.synopsys.com (Postfix) with ESMTP id 335DB3B9B; Mon, 26 Feb 2018 06:34:25 -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 1/2 v3] mmc: dw_mmc: Fix the DTO timeout overflow calculation for 32-bit systems Date: Mon, 26 Feb 2018 17:34:12 +0300 Message-Id: <20180226143413.44134-2-Evgeniy.Didin@synopsys.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180226143413.44134-1-Evgeniy.Didin@synopsys.com> References: <20180226143413.44134-1-Evgeniy.Didin@synopsys.com> 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 --- Nothing changed since v2. drivers/mmc/host/dw_mmc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 0aa39975f33b..194159219b32 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -1944,7 +1944,8 @@ 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