Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp87762ybf; Thu, 27 Feb 2020 16:38:30 -0800 (PST) X-Google-Smtp-Source: APXvYqw/HTWw2BLY4O110Pr+uU96U+DCZWG2EnhdNScFLoqlgcE+s7VXjVpASptghuWV7GgiAn6Q X-Received: by 2002:aca:5447:: with SMTP id i68mr1264161oib.31.1582850310018; Thu, 27 Feb 2020 16:38:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582850310; cv=none; d=google.com; s=arc-20160816; b=GYsWbpiE4HZwbOqdOXY4CQFrtU/GlyX1O8+c2Z1lv86h4ukhT3q8wtQOnJ/av7XV9V 7Zro6VtAyEr9iPCaXKUIVLhoopoSBe/VFUYlveJ3Cui02ltDhOr8Gv7SrkV4BcyEKtcA QFas0I5p8aIsyOXoqoiPK/cL2Lz941JJ4YkqB/ZHp/y2JKsZhIFgp42goZ/2v8tugZeC IKGCVdXh12dTBGI+6Ar7olQS7+NmVXFy2sqgBSf4JGu1jBMNlwCjI1MAjC8cIGECJdV6 Iy4WJW9mRTSJUtoKrNgfRUUAFIwI0jOlZVghMMjjzgarXl1FNNXeVLIvbB1USqjyWAfB 9PWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=QE+argeuCRAuvITS41/jAIWoLAo7PoR6Fkkr31YU2NA=; b=viu+MXC/dy+0SQ4bNxuVWpMkxTz4CxMPcH0edxo2aQ2iTp+Cv7S6cZqW0T9RAqeOFN QhBeg5fazlyHjKy9X8bho8mOVdH5ZPUo7U0zky9BrXidTVUU/kyrlL/HrCK3mnvs4ZSy I5Qnoxk8v0kckNQdishhBIEcx21UrABo0vo1MjX9q7dPueKvhu6nroAi+KQM5cswnVf7 A8jHe3Pu6sVwk5/8Os2TNYA1eSKv0EfAL02wb7ueYv1pPyYwpZ+lARNMdH+U19T4ajSR o/SdWK6Ef4a67cgPtl+Q75MM9Bfg6iWlHbfAldqbMSumQnQ+2giPocLbMpNvTXvGE/tg LaSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=hc7ZBPxZ; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j74si650336otj.246.2020.02.27.16.38.17; Thu, 27 Feb 2020 16:38:30 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=hc7ZBPxZ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730375AbgB1AhC (ORCPT + 99 others); Thu, 27 Feb 2020 19:37:02 -0500 Received: from mail-pj1-f68.google.com ([209.85.216.68]:51802 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729984AbgB1AhC (ORCPT ); Thu, 27 Feb 2020 19:37:02 -0500 Received: by mail-pj1-f68.google.com with SMTP id fa20so519908pjb.1; Thu, 27 Feb 2020 16:37:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=QE+argeuCRAuvITS41/jAIWoLAo7PoR6Fkkr31YU2NA=; b=hc7ZBPxZCvi/RCs8hpFjQtsPdJGC3EfyAGZ4nwITnuuJPe2Km/x0b65qhE0ex8DJO1 +h7KQw6/Wn/+orRoByfIcgkG9KfZ7kmOsOlsqr91FrDWZl3T/Q4muXmDtTWJAjsp7+5Q ea045xobgoVNA7jfDvqQdpBfoU3MzGOjbDZH+MzWs3/9XzqhKWCYGsn9Lt+7/0kAPDzj P8o6LLg1a0wGvnloiPq++/7kxUO/1CDil1ROBcTDzqByzadqktgO8mKsi4g7xmX1XpzE RFru8ZXgtQAtZB5SIMER0fKit2CvaMREdDzAGQ2Zt+Ik8olI9QirL+uIXzrdvqWQcG+q zaHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=QE+argeuCRAuvITS41/jAIWoLAo7PoR6Fkkr31YU2NA=; b=MxF3QZGBgZzJj2dCP15LTikeX8C063JINn7u0/ye3p/1kx2gIXZs6eKK3bnsb4JtEo IlrVrAmemKiC+k9l6NnZrB100Gi1qAUbUwyt2yh0LvuyeS3b3EuMRC2StW0IIA0go72n y08rjIWxe7l/yWxRtqxv9+506wVd+9Z9Th0uzmU/EKjqYMynCowJxDsE3gbBR4S0r9wI AqM5IHCkJz0gT/E+OCvfSPggqs6zJK8y29pf1cd4YgEzS4sdkMz5aTDpg/1aNnzd8afv MZ60DYQqHcfUv0zvRZSKHcPsZgOn0/yy7zDhJsy/0qFVuOsAAUR5zArGDbWJtodm5/IE C48A== X-Gm-Message-State: APjAAAUQHRv8YKRzNV5UiWHsEwG/H3/1nV1+uBgScp8UAD1XlVCFFauF neHfhnDqUXBzZv21ddt9OuE= X-Received: by 2002:a17:90a:a385:: with SMTP id x5mr1762369pjp.102.1582850221209; Thu, 27 Feb 2020 16:37:01 -0800 (PST) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id d24sm8922211pfq.75.2020.02.27.16.37.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 27 Feb 2020 16:37:00 -0800 (PST) Date: Thu, 27 Feb 2020 16:36:59 -0800 From: Guenter Roeck To: Doug Anderson Cc: Minas Harutyunyan , Greg Kroah-Hartman , Antti =?iso-8859-1?Q?Sepp=E4l=E4?= , Boris ARZUR , linux-usb@vger.kernel.org, LKML , Felipe Balbi , Stefan Wahren , Martin Schiller Subject: Re: [RFT PATCH 3/4] usb: dwc2: Abort transaction after errors with unknown reason Message-ID: <20200228003659.GB11811@roeck-us.net> References: <20200226210414.28133-1-linux@roeck-us.net> <20200226210414.28133-4-linux@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 27, 2020 at 02:06:55PM -0800, Doug Anderson wrote: > Hi, > > On Wed, Feb 26, 2020 at 1:04 PM Guenter Roeck wrote: > > > > In some situations, the following error messages are reported. > > > > dwc2 ff540000.usb: dwc2_hc_chhltd_intr_dma: Channel 1 - ChHltd set, but reason is unknown > > dwc2 ff540000.usb: hcint 0x00000002, intsts 0x04000021 > > > > This is sometimes followed by: > > > > dwc2 ff540000.usb: dwc2_update_urb_state_abn(): trimming xfer length > > > > and then: > > > > WARNING: CPU: 0 PID: 0 at kernel/v4.19/drivers/usb/dwc2/hcd.c:2913 > > dwc2_assign_and_init_hc+0x98c/0x990 > > > > The warning suggests that an odd buffer address is to be used for DMA. > > > > After an error is observed, the receive buffer may be full > > (urb->actual_length >= urb->length). However, the urb is still left in > > the queue unless three errors were observed in a row. When it is queued > > again, the dwc2 hcd code translates this into a 1-block transfer. > > If urb->actual_length (ie the total expected receive length) is not > > DMA-aligned, the buffer pointer programmed into the chip will be > > unaligned. This results in the observed warning. > > > > To solve the problem, abort input transactions after an error with > > unknown cause if the entire packet was already received. This may be > > a bit drastic, but we don't really know why the transfer was aborted > > even though the entire packet was received. Aborting the transfer in > > this situation is less risky than accepting a potentially corrupted > > packet. > > > > With this patch in place, the 'ChHltd set' and 'trimming xfer length' > > messages are still observed, but there are no more transfer attempts > > with odd buffer addresses. > > > > Cc: Boris ARZUR > > Cc: Douglas Anderson > > Signed-off-by: Guenter Roeck > > --- > > drivers/usb/dwc2/hcd_intr.c | 12 ++++++++++++ > > 1 file changed, 12 insertions(+) > > Seems sane to me. Also suggest a "Fixes" or "Cc: stable" tag. > Added: Fixes: 151d0cbdbe860 ("usb: dwc2: make the scheduler handle excessive NAKs better") > Reviewed-by: Douglas Anderson Thanks! Guenter