Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp758069ybm; Tue, 21 May 2019 03:06:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqxckbSnosUOIgV2vx0eOJcdQE7iyHA/qQ1ajb1Hva590QBgWYNUqA+VB5lF0zueJ6T5HvAt X-Received: by 2002:a63:4710:: with SMTP id u16mr70344691pga.447.1558433193652; Tue, 21 May 2019 03:06:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558433193; cv=none; d=google.com; s=arc-20160816; b=LjkjKPAu60sBSb0LgrTi11tfP3om07e6CRG7z8brl+Jlu8Q1WP75588yKo2khp2BeB GpSswI4xMfibmiI+iDKc7AVvBTBmCD1fC1EhbwSjne9EBFXWh/+ZXvmjyYCK5AGD/SCm e0cv1yHWwSE4c+BYWlm+JBydHTfW8hGq0IymhmDTfJ+ONdp7el5nhUcR/aZwJ+fpndyT sONZckvfMBsXeZUvT4R+0ytNZuv6Kefxt23geRhatfy7ja915yu3MwONv1L+AfZiGaaN AoVGDt/jxxgIRMudT1zF42Ta4HCl23Jp7wKfclVSu3TN0B9UkQ6X/fnRScHMHsAR2blh Tyiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=tIfR+CSUDkg9mvtjbuzsVtcADWn2psarWcJmQJwH/84=; b=v9NIAJ2PD19tNL8PxagNNQMbBHDHxAN72SCJXwHHGJBAWLGsx6XWm5JHvp0CSRadmg NbpaH3Gbm6sv+u131ILfva5jgXOciXtr5nICHjbORujuhQaDYwBDXzzBmMSdJYRkWNnB ZjhtE69E0je4BlotOpxSO8riNaQaaZFoXjkJDCP1LxXBVHcgHjB67E0ABlJVGvaCcpjW AcAXULfDuytDg3CPG8kCzUH5k2C0NFmfEukpVkON7wtfiui0zZMjHZ3D91Nh19VPmlbl /4ukwfTtdvchvxsnbmG4rKIPnuua+WFGpsz7bIXI+FQDFtbFnL+jCJX3Q8XFEWsQ6tre MSsA== 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=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x24si12654254pfm.83.2019.05.21.03.06.17; Tue, 21 May 2019 03:06:33 -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; 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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727581AbfEUKEz (ORCPT + 99 others); Tue, 21 May 2019 06:04:55 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:46440 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727547AbfEUKEx (ORCPT ); Tue, 21 May 2019 06:04:53 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: andrzej.p) with ESMTPSA id 4BAA828084D Subject: Re: [REGRESSION] usb: gadget: f_fs: Allow scatter-gather buffers To: "Yang, Fei" , John Stultz Cc: Felipe Balbi , Bjorn Andersson , Chen Yu , lkml , Linux USB List , Amit Pundir , Marek Szyprowski , "kernel@collabora.com" References: <7caebeb2-ea96-2276-3078-1e53f09ce227@collabora.com> <7ec57c29-d1ab-dc4c-755d-a6009b9132b5@collabora.com> <36620156-d119-b1b2-989e-0c13b783296e@collabora.com> <02E7334B1630744CBDC55DA8586225837F884D53@ORSMSX103.amr.corp.intel.com> <02E7334B1630744CBDC55DA8586225837F885FFD@ORSMSX103.amr.corp.intel.com> From: Andrzej Pietrasiewicz Message-ID: <1672b93a-dfe6-acb2-715e-c4a13af54413@collabora.com> Date: Tue, 21 May 2019 12:04:49 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <02E7334B1630744CBDC55DA8586225837F885FFD@ORSMSX103.amr.corp.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, W dniu 20.05.2019 o 23:52, Yang, Fei pisze: >>>>> One question that comes to my mind is this: Does the USB > > One of the problems appears to be that req->num_mapped_sgs was left uninitialized. I made the following change and got a lot more requests completed. > However this change is not sufficient to solve the adb issue, the usb requests would eventually get stuck without getting a matching ffs_epfile_async_io_complete. > > @@ -1067,6 +1067,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) > req->buf = NULL; > req->sg = io_data->sgt.sgl; > req->num_sgs = io_data->sgt.nents; > + req->num_mapped_sgs = req->num_sgs; > } else { > req->buf = data; > } > @@ -1110,6 +1111,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) > req->buf = NULL; > req->sg = io_data->sgt.sgl; > req->num_sgs = io_data->sgt.nents; > + req->num_mapped_sgs = req->num_sgs; > } else { > req->buf = data; > } > Isn't num_mapped_sgs meant to be set by drivers/usb/gadget/udc/core.c? And the comment in include/linux/usb/gadget.h says "internal". One thing that becomes evident now is that adb uses async io. It seems that interaction of async io and s-g mode should be further investigated. Andrzej