From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95904C432BE for ; Sat, 28 Aug 2021 03:10:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 72B0760ED5 for ; Sat, 28 Aug 2021 03:10:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233183AbhH1DLJ (ORCPT ); Fri, 27 Aug 2021 23:11:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233167AbhH1DLI (ORCPT ); Fri, 27 Aug 2021 23:11:08 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DE94C061796 for ; Fri, 27 Aug 2021 20:10:18 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id b6so13219707wrh.10 for ; Fri, 27 Aug 2021 20:10:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rtst-co-kr.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=y527krCDKEsx0ChQP3KqPNsQAyNPKFXncMJNmo17VWs=; b=dgsNlA3g3eXW2MkNa/+cZhqT/7ECRL9+46yAuRJlZUpoh6PhGCsQjdIeqz7GTF+eHc HRySG3VjgQeTYhUzXiPQTl75oX8CdG8yOTMeSTC3wB1S0PJmtzMR306lXDSOnTbjFoSc npvri3Z14MKg+/w5U6LIDi8RnQyVG4yiHS3rwzMMZWWkCB78vElcBedD7UXx00WvD82J x+QAX4sAoIb0gUO8bafwUqgxVIL0EOE8qn+hUeRTHBuauk3fzs+6tMUS3NSsJOjzt31R 9vktrqUdkfSdfWGZGvilAQyUIZUv8JQwVK65cbk3mx34028K12a92Cmzz0Konq40iebJ yDvQ== 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:content-transfer-encoding; bh=y527krCDKEsx0ChQP3KqPNsQAyNPKFXncMJNmo17VWs=; b=jnkZG16wbjR5CPblc0N5oe+kI8j2cUJCCIqXF5t4ZfSwzRZu46OUzwSaFmbbjqGjbO 2W6C89Q6WY8shqRabPQkew5QaRSQ9zDfBbpTgwrrK5P9VEZDmcYCjFWDbx7kfBEpiz7u bpBYAtPj9h5vjskJDT0uw/NLwesjUesU7jWjD2XFb5xfdSPbeahDIkU3ekImoOciGbFF AlKrFLZTZIBkHZb+sAxCo10ojZk7vX8U4o6oSpov6+FPlHC2Pqj3EKux4lMhyCMf8DvE +uGg0vn5biVfLI8TUGjTHQhmOQ01IBpQI8ciKVOVc1u9kR6j2MD6sT8rnJJVBMumpDG7 gIHg== X-Gm-Message-State: AOAM532rrnHo1VctaPpKZOxCGlbD72JoObvzGrnAeYo+UROf4VoRTO3K I6UBR08X6JDbHcaSl/qAygY88nvLlPGAQL6ZtEJE4A== X-Google-Smtp-Source: ABdhPJy9gONy2gALGHWfXhx9Yau7+ZLZy0pqdCTKgLmcruFnoO3c99DOpMYDV7uYMmyyOTty7ZcEeGcN2Gp2tvByCfo= X-Received: by 2002:adf:ba4d:: with SMTP id t13mr13576388wrg.424.1630120216876; Fri, 27 Aug 2021 20:10:16 -0700 (PDT) MIME-Version: 1.0 References: <20210817064353.GA669425@ubuntu> <20210826230658.GB4335@Peter> <20210828013811.GA3590@Peter> In-Reply-To: <20210828013811.GA3590@Peter> From: Jeaho Hwang Date: Sat, 28 Aug 2021 12:10:05 +0900 Message-ID: Subject: Re: [PATCH v2] usb: chipidea: add loop timeout for hw_ep_set_halt() To: Peter Chen Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Linux team , =?UTF-8?B?67OA66y06rSRKEJ5ZW9uIE1vbyBLd2FuZykv7J6Q64+Z7ZmU7JewKUF1dG9tYXRpb24gUGxhdGZvcm0=?= =?UTF-8?B?7Jew6rWs7YyA?= , =?UTF-8?B?7LWc6riw7ZmNKENob2kgS2kgSG9uZykv7J6Q64+Z7ZmU7JewKUF1dG9tYXRpb24gUGxhdGZvcm3sl7A=?= =?UTF-8?B?6rWs7YyA?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org 2021=EB=85=84 8=EC=9B=94 28=EC=9D=BC (=ED=86=A0) =EC=98=A4=EC=A0=84 10:38, = Peter Chen =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > > On 21-08-27 10:35:05, Jeaho Hwang wrote: > > 2021=EB=85=84 8=EC=9B=94 27=EC=9D=BC (=EA=B8=88) =EC=98=A4=EC=A0=84 8:0= 8, Peter Chen =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > > > > > > On 21-08-24 17:31:44, Jeaho Hwang wrote: > > > > 2021=EB=85=84 8=EC=9B=94 17=EC=9D=BC (=ED=99=94) =EC=98=A4=ED=9B=84= 3:44, Jeaho Hwang =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84= =B1: > > > > > > > > > > If ctrl EP priming is failed (very rare case in standard linux), > > > > > hw_ep_set_halt goes infinite loop. waiting 100 times was enough > > > > > for zynq7000. > > > > > > > > > > > > > Hi Peter. > > > > I found from zynq7000 TRM that the hardware clears Stall bit if a > > > > setup packet is received on a control endpoint. > > > > I think hw_ep_set_halt goes infinite loop since: > > > > > > > > 1. hw_ep_prime for control EP which is called from > > > > isr_tr_complete_handler -> isr_setup_status_phase is failed due to = a > > > > setup packet received. > > > > > > How do you know that? Do you observe the new setup packet on the bus > > > before the current status stage? Usually, the host doesn't begin new = setup > > > transfer before current setup transfer has finished. > > > > > > Peter > > > > > > > I found an error return from the second ENDPTSETUPSTAT checking > > routine, then setting the stall bit(TXS) kept failing. So I guessed it > > is due to a setup packet received. > > I didn't observe the setup packet by e.g. HW probes. Any other reason > > to produce that symptom? > > I guess two possible reasons for that: > - The new setup is coming after priming > - The interrupt occurs after prime, and when the back from interrupt, > other thread for USB transfer is scheduled, eg, usb_ep_queue from RNDIS > > From your experiments and observation, it seems the first reason is not p= ossible. I will check if any other thread calls udc. but the only workload using RNDIS was the host side ping sender. Thanks for the advice. > Did your get failure with UP system? I'm sorry I don't understand what UP system means. > > Peter > > > > > For reminder, only reproduced on preemp_rt kernel and with Windows(10) > > RNDIS host. > > > > thanks. > > > > > > > > 2. in isr_tr_complete_handler it tries to call _ep_set_halt if eith= er > > > > isr_tr_complete_low or isr_setup_status_phase returns error. > > > > 3. Since the control EP got a setup packet, HW resets TXS bit just = as > > > > the driver sets inside hw_ep_set_halt so it goes infinite loop. > > > > > > > > Does it make sense? If it is right, we shouldn't call _ep_set_halt = if > > > > the err is -EAGAIN, which could be returned ONLY due to the setup > > > > packet issue described above. > > > > And the loop timeout is not required anymore. > > > > > > > > Can I ask your opinion on this, Peter and USB experts? > > > > > > > > Thanks. > > > > > > -- > > Thanks, > Peter Chen > --=20 =ED=99=A9=EC=9E=AC=ED=98=B8, Jay Hwang, linux team manager of RTst 010-7242-1593