Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3978189ybg; Mon, 28 Oct 2019 23:49:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqy1KT6VPTvLe1wiUvLSYIrHhv3h26f/Lu3oJmp4OF4fTFuubNg/x4VPVytfINApN9knooz7 X-Received: by 2002:aa7:d81a:: with SMTP id v26mr23485122edq.213.1572331793847; Mon, 28 Oct 2019 23:49:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572331793; cv=none; d=google.com; s=arc-20160816; b=IRN/JCqJWtnB+7GSzJCj5drAH15wmkQDvnrdnuZyXQRufOdr7mFM8ue95/2RNEyrbs ziM9RRIVYE/RhkQoiaT2PdM9sigprmzKZYbJkCSoFYEY7wdwW3IjhBOtWt+R+jIo22Ln D6BGPjTvx7S40lJwAduOgK6QLc5Tr2hRJtjLnDsU6cBUOvCT1JsxtPAazENZBh00JX3a p4aequ6eLwQl6V3TiULyuJbjtYoOUUJetufNtXOgPtnjNytpGgbC9ng9SUD5V4DK5hb1 MagQ3Gq4S56vqchG4YpuRlHznfH2RmwSlcAOi9FS+E8E6OkTt/EloAmublP3gRgkGwSV Ff1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=v3kvJXcbFkEV09nvemioGfRfs68Gl22rKf+fp6o5KcY=; b=dIHc3GeGY4jhhQ8Rhs2uqYb+9wcbqa9OQjGPAGZMQA5B5yWwDoh2Rz0ea5gUQfFqv/ 1EviHmdnes7MD0I6ojF+Sy578bObC9pXWZ5QyfBwAXRviD7aK69Fpwh8gu4xBQEI7LT6 Qd1G0rbItG0mS0rDnMyvTxhAFvuRbNVWCiuzjMBZzk1+1dBGMEQfTDsrdHcdtDXe972i CoKfQLVK3Tdzh90lrxtAZTk4HpcpyWzrN3UPO9+wTISvE5tIqkpIFfdO2B/cobQKoeUa gflDGdag3M4PZgIJOmePj4AHDxO5Ospo3ixaC2y+6Mbh7BRxWRcVb3Qn/MtxX/WAN2Rz tf3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LctBUarB; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d21si9460395edb.180.2019.10.28.23.49.30; Mon, 28 Oct 2019 23:49:53 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LctBUarB; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730949AbfJ1Tbs (ORCPT + 99 others); Mon, 28 Oct 2019 15:31:48 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:43987 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730396AbfJ1Tbs (ORCPT ); Mon, 28 Oct 2019 15:31:48 -0400 Received: by mail-pg1-f193.google.com with SMTP id l24so7570258pgh.10; Mon, 28 Oct 2019 12:31:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=v3kvJXcbFkEV09nvemioGfRfs68Gl22rKf+fp6o5KcY=; b=LctBUarBHVK+LJbiZaWPtVv840QdYut23jNX11CEvVa2GTB+Cqj8uGEUiMDecRg3u9 Oc883co3hZ2QPb/Wk4mFmt8ONSqTXe1eLQmY6B0AQtKRNo6aqM4/heaWD5jH/KwddO35 e6XwAQnuC1AZyuan2Tjw78hTpfDD92WML2gdaBxgmnoSNWuksWfzCIxjVLfm5XkuENIW 7kLoxZ/ku/P2/xGOpSWBatIDhCCxhbJRR17gk++qyYgW25Cu+HisQfle1plHYPGBRaxT c9YlB+2UJhKJsnzy0aKriViry3erD7kqGmJTFdZ4LPN1Tav43/ZKd6R6XHJXKnLTMRl4 59Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=v3kvJXcbFkEV09nvemioGfRfs68Gl22rKf+fp6o5KcY=; b=I1NhZn934pibWzYQGjHZz3cYaQkhONfvL+OFu52Xr63hNADiJVq6XeYYrvhOiTl8wu eK0vYoavfytvwUlIHQu+05qJpeL5XeVmWVULsEWfnA7cv62c7YdV4c9Ntq9wwWfwY4ty KzgPwsWiusbnlSJJIhkH/xZM/X2pZZJdVqytnggNkkoTntlWlATu27WSP0B6K3aqFZko 8CPAi134MpfeA0zdqyG3okcHSprJhVcCFe9VZ0c99BSDqOxTFYorpyOox1FxC3liSAqy CbR47i4DPjx3YVzqwyqDGMr83tkSkxKvo9BWoLKNbMD8oTWQwiugdE/pO2lvTyUWS9WJ 9Z2w== X-Gm-Message-State: APjAAAUEiBLZLUsn+g4dcmSYgKeUrtbtV/gVSab5+9lI/dyojVv0mZ1m VKx3EuBEU695bgKpbCMF5iw= X-Received: by 2002:a17:90a:6302:: with SMTP id e2mr1225776pjj.20.1572291107424; Mon, 28 Oct 2019 12:31:47 -0700 (PDT) Received: from saurav ([27.62.167.137]) by smtp.gmail.com with ESMTPSA id j14sm11884901pfi.168.2019.10.28.12.31.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2019 12:31:46 -0700 (PDT) Date: Tue, 29 Oct 2019 01:01:40 +0530 From: Saurav Girepunje To: b-liu@ti.com, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: saurav.girepunje@hotmail.com Subject: [PATCH] usb: musb: Fix external abort on non-linefetch Message-ID: <20191028193140.GA27668@saurav> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While setting the usb mode from sysfs. Below error came on kernel version 4.19. On latest kernel vserion api name changed. Therefore API name and backtrace API name are different. [ 821.908066] Backtrace: [ 821.910695] [] (musb_default_readl [musb_hdrc]) from [] (dsps_musb_set_mode+0x38/0x12c [musb_dsps]) [ 821.922059] [] (dsps_musb_set_mode [musb_dsps]) from [] (musb_mode_store+0xc8/0x12c [musb_hdrc]) [ 821.933105] r7:a0010013 r6:0000000b r5:cd79d200 r4:cb634010 [ 821.939096] [] (musb_mode_store [musb_hdrc]) from [] (dev_attr_store+0x20/0x2c) [ 821.948593] r7:cd79d200 r6:c5abbf78 r5:00000000 r4:bf0788d4 [ 821.954549] [] (dev_attr_store) from [] (sysfs_kf_write+0x48/0x4c) [ 821.962859] r5:00000000 r4:c0425164 [ 821.966620] [] (sysfs_kf_write) from [] (kernfs_fop_write+0xfc/0x1fc) [ 821.975200] r5:00000000 r4:cd79d080 [ 821.978966] [] (kernfs_fop_write) from [] (__vfs_write+0x34/0x120) [ 821.987280] r10:00000000 r9:0000000b r8:00000000 r7:0000000b r6:c5abbf78 r5:c0285178 [ 821.995493] r4:cb67a3c0 [ 821.998160] [] (__vfs_write) from [] (vfs_write+0xa8/0x170) [ 822.005835] r9:0000000b r8:00000000 r7:c5abbf78 r6:000def80 r5:cb67a3c0 r4:0000000b [ 822.013969] [] (vfs_write) from [] (SyS_write+0x44/0x98) [ 822.021371] r9:0000000b r8:000def80 r7:00000000 r6:00000000 r5:cb67a3c0 r4:cb67a3c0 [ 822.029517] [] (SyS_write) from [] (ret_fast_syscall+0x0/0x3c) [ 822.037467] r9:c5aba000 r8:c010daa8 r7:00000004 r6:b6f0ad58 r5:000def80 r4:0000000b [ 822.045599] Code: e1a0c00d e92dd800 e24cb004 e0801001 (e5910000) Without pm_runtime_{get,put}_sync calls in place, Similar issue come on "mode_show" and "vbus_store" also. fix- call pm_runtime_{get,put}_sync before reading/writing usb mode/vbus from sysfs. As sugguested on commit '2d15f69ed5c1c33f283e77ec161578badde33eaf' Merged all the fix which reslove same bug in the same file. " commit '2d15f69ed5c1c33f283e77ec161578badde33eaf' Author: Saurav Girepunje Date: Thu Aug 8 00:05:03 2019 +0530 usb: musb: Fix external abort on non-linefetch for vbus_store Without pm_runtime_{get,put}_sync calls in place, writing vbus value via /sys causes the error "Unhandled fault external abort on non-linefetch" On Thu, Aug 08, 2019 at 12:11:46AM +0530, Saurav Girepunje wrote: > Without pm_runtime_{get,put}_sync calls in place, writing > vbus value via /sys causes the error > > "Unhandled fault external abort on non-linefetch" > > Signed-off-by: Saurav Girepunje Thanks for the patch. Can you please merge another two similar patches you just sent with this one? They all fix the same bug in the same file so could be just in one patch. -Bin. " Signed-off-by: Saurav Girepunje --- drivers/usb/musb/musb_core.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index bd63450af76a..dc7d786feb58 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1723,9 +1723,11 @@ mode_show(struct device *dev, struct device_attribute *attr, char *buf) unsigned long flags; int ret; + pm_runtime_get_sync(dev); spin_lock_irqsave(&musb->lock, flags); ret = sprintf(buf, "%s\n", usb_otg_state_string(musb->xceiv->otg->state)); spin_unlock_irqrestore(&musb->lock, flags); + pm_runtime_put_sync(dev); return ret; } @@ -1738,6 +1740,7 @@ mode_store(struct device *dev, struct device_attribute *attr, unsigned long flags; int status; + pm_runtime_get_sync(dev); spin_lock_irqsave(&musb->lock, flags); if (sysfs_streq(buf, "host")) status = musb_platform_set_mode(musb, MUSB_HOST); @@ -1748,6 +1751,7 @@ mode_store(struct device *dev, struct device_attribute *attr, else status = -EINVAL; spin_unlock_irqrestore(&musb->lock, flags); + pm_runtime_put_sync(dev); return (status == 0) ? n : status; } @@ -1766,6 +1770,7 @@ vbus_store(struct device *dev, struct device_attribute *attr, return -EINVAL; } + pm_runtime_get_sync(dev); spin_lock_irqsave(&musb->lock, flags); /* force T(a_wait_bcon) to be zero/unlimited *OR* valid */ musb->a_wait_bcon = val ? max_t(int, val, OTG_TIME_A_WAIT_BCON) : 0 ; @@ -1773,6 +1778,7 @@ vbus_store(struct device *dev, struct device_attribute *attr, musb->is_active = 0; musb_platform_try_idle(musb, jiffies + msecs_to_jiffies(val)); spin_unlock_irqrestore(&musb->lock, flags); + pm_runtime_put_sync(dev); return n; } -- 2.20.1