Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1593560ybf; Thu, 27 Feb 2020 14:09:06 -0800 (PST) X-Google-Smtp-Source: APXvYqzTp1jHiyDDfriJTMfsgNmspngVUNTS8VZStOp5IaH+Rj3by1gL4bK9Sc9S7QgICDbPfh6e X-Received: by 2002:aca:ed94:: with SMTP id l142mr953128oih.58.1582841346618; Thu, 27 Feb 2020 14:09:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582841346; cv=none; d=google.com; s=arc-20160816; b=EQ4hUiSsbQkUwrSePy4czgN6XzHvzLT/Yf5O5wy+/yxQwzoWqGHrAiTh856p5i7ALr 48PNbQI/tVKuQNdEzzRwWd6ZlOeL+B/1eqjHmzQwcVOHT9PjOn19jMP9Av5G5LE3HSV9 xGRcx1kIidzZZeqtPYvU22mg75gZT+WtHZZ0E9pKExEyRyc3Kg8pr/ieIWPuypLjPDn3 xo5yKJixQRnzuQLq5p3ob2e/y1TjRMOVMHsFzT2XifYJs798+qYIuIefPU/ajkiQkHfb 5uhhGBMI0YpRiQlafdSfEpVKtPNZbsxEZXg5rW8h5lEE/Isyp9+djPOC/3+06X0OScj6 4LFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=iqKNDeiMvIdCSL5g1lAtM6a4Ex9LPGPv076qA0QF9lE=; b=ttXfAv1ccDMGVaPB7Znmesc78bCRjnEZg7zc4pB0tH8N5+wyuwf1Ajb3FRHlP/xTGG IAXU1k1EUaPyhxwdGo+OKVf5JslzfQUSPJa+UxCjvGE0mRA+s27N8No4G1r39ochRmQd PQVqfl+rYqnqyQ6Yfp3YzlA+9u50vO6X7tJ8mdgrkE0eRaFT9idOPDaYXi11e8llFbFo VtngqjgY+ROdFlU0mSTXn/z60LOAjT7jgY/Uq9VvtK+HQpZISkGHdjiHpvqES/tCbhXZ Uf5k0LErw5XrQLRIqS4xdjdzhZNflHcVmbsPMCt5BlE7v7WrymcKhTk4DUL5CvlDxgxO v1JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=mU4IwRfV; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k8si314582otp.69.2020.02.27.14.08.52; Thu, 27 Feb 2020 14:09:06 -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=pass header.i=@chromium.org header.s=google header.b=mU4IwRfV; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730240AbgB0WHJ (ORCPT + 99 others); Thu, 27 Feb 2020 17:07:09 -0500 Received: from mail-vs1-f67.google.com ([209.85.217.67]:42270 "EHLO mail-vs1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730107AbgB0WHJ (ORCPT ); Thu, 27 Feb 2020 17:07:09 -0500 Received: by mail-vs1-f67.google.com with SMTP id w142so694382vsw.9 for ; Thu, 27 Feb 2020 14:07:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iqKNDeiMvIdCSL5g1lAtM6a4Ex9LPGPv076qA0QF9lE=; b=mU4IwRfVv40ylj1KZhG7HSK0P8maoUVYPcDj7UGjf35I2u77f06PVOHTWkifNWYTUD Ys+1AHL6jXPpn+s3M5wfh69RonHgCQ9LuKBfHHginkUEE7V2pgNuUblYdLrPXS7xmS8R 6intotQ33g5TdMYt7fNsAve6mpUz21gBgX0Ls= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=iqKNDeiMvIdCSL5g1lAtM6a4Ex9LPGPv076qA0QF9lE=; b=s9O4t2/MA6X58DLwmuUR/ySWTXVQ2+xxv1oYGBwK8KXI7bK4u1dLAIWl1Puyah6otQ j+XWsW8PLDh9NfS5fFthfSVCTInVpG9SxLJq+nGQ47eYfpVJFXW58JxUCi7utCiJ6Rax n3NvS7I+95qSS8GgNNXj+R/ZepYniUHXxSruqUA7NwDdeq3rVnlXMEnOx/VUe+xk5Fbj WNUInx/Fu9XJL2YhEqavS8XTAUh229zv3ArfTjrNIb1dsVvQMp6suPCHJQ3v3GsMPmt4 1YsBj+YjNS0PPThHbjl6xKv1CIEZNO/vjUgsqiu29Pc/fAQu/40GbRlXvsH0iGcS01uf TatQ== X-Gm-Message-State: ANhLgQ11042GPQsH9w6STqVkndkRVOTWBxCDOjm4d2mupp9OkI4jFpAB FXC2P0xQNj4WuXBOXWX+leHqa/COBLM= X-Received: by 2002:a05:6102:3102:: with SMTP id e2mr877155vsh.179.1582841227731; Thu, 27 Feb 2020 14:07:07 -0800 (PST) Received: from mail-ua1-f45.google.com (mail-ua1-f45.google.com. [209.85.222.45]) by smtp.gmail.com with ESMTPSA id w1sm290369vso.22.2020.02.27.14.07.07 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Feb 2020 14:07:07 -0800 (PST) Received: by mail-ua1-f45.google.com with SMTP id t20so250952uao.7 for ; Thu, 27 Feb 2020 14:07:07 -0800 (PST) X-Received: by 2002:ab0:2006:: with SMTP id v6mr499526uak.22.1582841226616; Thu, 27 Feb 2020 14:07:06 -0800 (PST) MIME-Version: 1.0 References: <20200226210414.28133-1-linux@roeck-us.net> <20200226210414.28133-4-linux@roeck-us.net> In-Reply-To: <20200226210414.28133-4-linux@roeck-us.net> From: Doug Anderson Date: Thu, 27 Feb 2020 14:06:55 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFT PATCH 3/4] usb: dwc2: Abort transaction after errors with unknown reason To: Guenter Roeck Cc: Minas Harutyunyan , Greg Kroah-Hartman , =?UTF-8?B?QW50dGkgU2VwcMOkbMOk?= , Boris ARZUR , linux-usb@vger.kernel.org, LKML , Felipe Balbi , Stefan Wahren , Martin Schiller Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Reviewed-by: Douglas Anderson