Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1307186imn; Sun, 31 Jul 2022 01:35:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tjSQY5wrBdUZUZSYm6OeqzjOeI9stQ8oR6EvjBOLri6g+bGLk6KuTVh39tWv6kGzdyxlMr X-Received: by 2002:a05:6402:c47:b0:437:ce2d:c30d with SMTP id cs7-20020a0564020c4700b00437ce2dc30dmr10640912edb.395.1659256552563; Sun, 31 Jul 2022 01:35:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659256552; cv=none; d=google.com; s=arc-20160816; b=Wt8vbpuFTpZjogxEnDOf1Ps0tYpKbTqC4uEjmRuWRHKtPWVFltaV2prBWNAUhAUnZS q6xYTSdvIpcuXgAO/2hQ1o7edrQ+fhLfruaPVwTLkH/QK4l3sQkClIIqBeSiP7rxKo9o 7RpYJkEjV0t+2ehEbURe4R02cfl73nVn5feq+cIdjrzoQdRR2TcEtWVS8GbAKbNt0Zyt Cj0oxTYcZsAXTovcE1lJmbFAsX6LfMbyW5G+v3QOqS67apepBsencMIzBZzjwANXDKWx r7HPQNkltZwnrOrsQbkvW1PIKqN7evft8tc2SOtwoaD0tAaMCpO+KiDxrmrXpD4fBKZ1 5xTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=BbeBlEzfKIoYoxJLsvPnu3kkJcCgSyIMRtJaW6dfGQ8=; b=F5RO4dRBgG8zHArbFxN1a2X/KybLmUYa35+uRFxW/8rDo9WKStEYFZCeZyEnHSjMRr xKvxez0gYcGfa/Knd5efZ86QyszSL1W/a9XVBcYTULsG5yr0QvX3TkTkWb6MoxsnV/kN ELKZ/XuKoOiBcFaBoFKMYSCQ7OUFUSW+vvRmXC8xEVQ7C2uffnXBq10PMgxe8p8l+8Ee f1jNesktcBNoSM4Cgf6R0iiWQljrHoRiropmgJxDXLLlathf0sXz4FNhkICvu+k30Hzj Cce1L8XlI6wUIjEv4jSG3tepA389AmRnWEYvhUXN/Cyi3I556+nWa/Q+KPTnykCEf3vQ bF8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=DwlQaS0S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d7-20020a50cd47000000b0043ce06640e3si7020386edj.351.2022.07.31.01.35.22; Sun, 31 Jul 2022 01:35:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=DwlQaS0S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236214AbiGaIVB (ORCPT + 99 others); Sun, 31 Jul 2022 04:21:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbiGaIVA (ORCPT ); Sun, 31 Jul 2022 04:21:00 -0400 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5457211C3F; Sun, 31 Jul 2022 01:20:59 -0700 (PDT) Received: by mail-pg1-x52e.google.com with SMTP id bf13so7210927pgb.11; Sun, 31 Jul 2022 01:20:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc; bh=BbeBlEzfKIoYoxJLsvPnu3kkJcCgSyIMRtJaW6dfGQ8=; b=DwlQaS0SFmnCA0HfARMIGxP7uBp1xj4BX520kd14TIoa70J6rUWEuN+xSAk0XL9pon TY+1nHBz9Pqe5RVg8sAnpUda5pDnLkz/Cs0LNCguKWpOmna7e2aiX2evt8OFtECY6i2K ET1nYkqetnI5R8Mw1sOQaSsDAAZQ5W2ZdfFcH+VD2Ez7h9+fhHKUEDFR6JwQXQOid418 LFN5ZpgMBsfavfte8BtTZeKm4CvbnMrkIC27/jnrbh0712bOxpg6pZ1JplqHwrpU4XgY 1RP4vkS6K56hCRRATwFgftqcLYeOvaghfl1zDgYzr+8ESe7ftHy1eCBRFlDIVqziEgAd y72w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc; bh=BbeBlEzfKIoYoxJLsvPnu3kkJcCgSyIMRtJaW6dfGQ8=; b=X0PLvCWdWiS1igMOVd6sJn4+bU5L28pMN8ZIr47ipnQIT3gH2pjjeY0A/qQFnTRtmb LDmHwMxk9T0JyxM/XejiL7XieWghH8gVC0bYgWC0Yg7qfLRcDqpzaiq7QpGIlhlSPQBK oRl5qe+4y7mUqiS8+XWXcr3dH7V+CjTH6CJpJjhxdFDz0vWjDUhxwlTRUgNHMxd8EvPd RmT/+ZSeesFj4IjI5rMLbrlEtbJagxJ3QdFy1wXVYBb/6M2PGbZGxsFCrgb581UAWlrp VlS9bJ1U7hfdf4LQJs/c9SlQ+3fqQBwVsE4O/l9MWCLUEyiguBMlAqjkJI28staq+nDY yIzA== X-Gm-Message-State: ACgBeo19SiuryTv2Uu6Uh46OXU/Zi/a2sRhzTq2HD2IKB/JuvbE+xzx1 NG/M9rYgzgXXkrurI1f/624= X-Received: by 2002:a63:8049:0:b0:41b:e8db:d912 with SMTP id j70-20020a638049000000b0041be8dbd912mr1923025pgd.380.1659255658841; Sun, 31 Jul 2022 01:20:58 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id l13-20020a170903120d00b0016b8746132esm7127339plh.105.2022.07.31.01.20.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Jul 2022 01:20:57 -0700 (PDT) Sender: Guenter Roeck Date: Sun, 31 Jul 2022 01:20:55 -0700 From: Guenter Roeck To: Alexey Klimov Cc: Oliver Neukum , Greg KH , linux-watchdog@vger.kernel.org, wim@linux-watchdog.org, USB list , Linux Kernel Mailing List , atishp@rivosinc.com, atishp@atishpatra.org, Yury Norov , Alexey Klimov , Aaron Tomlin Subject: Re: [PATCH v5] watchdog: add driver for StreamLabs USB watchdog device Message-ID: <20220731082055.GA4008925@roeck-us.net> References: <20220725030605.1808710-1-klimov.linux@gmail.com> <7770401d-fe3d-bda4-a2e2-55cd004a2d07@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 31, 2022 at 03:34:16AM +0100, Alexey Klimov wrote: > On Tue, Jul 26, 2022 at 8:48 AM Oliver Neukum wrote: > > > > On 26.07.22 02:21, Alexey Klimov wrote: > > > On Mon, Jul 25, 2022 at 9:51 AM Greg KH wrote: > > >> > > >> On Mon, Jul 25, 2022 at 04:06:05AM +0100, Alexey Klimov wrote: > > > > > > [..] > > > > > >> Anyway, driver looks good to me, nice work! > > >> > > >> Reviewed-by: Greg Kroah-Hartman > > > > > > Thanks, Greg. If you don't mind I'll use your tag in next version > > > after making changes suggested by Guenter since there will be no > > > significant functional changes. If code will change a lot, then the > > > process (Documentation/process/submitting-patches.rst) will require me > > > to drop the tag. > > > > Hi, > > > > while thinking about this a question arose. How does this > > device react to a USB reset? A watchdog that can be disabled > > by a simple reset does not like very reliable to me. > > Do you need to implement pre/post_reset() ? > > You're right. Upon reset the watchdog is disabled even if it was active before. > Adding empty ->pre_reset() and ->post_reset() helps to avoid that, but > looking at Documentation and other drivers it seems that I need to do: > in pre_reset(): > mutex_lock() to block any other I/O to the usb device; > __usb_streamlabs_wdt_cmd(STOP) to stop the watchdog; > and do not unlock the mutex; > > in post_reset(): > if (watchdog_active()) > __usb_streamlabs_wdt_cmd(START); > mutex_unlock() to allow other's I/O to the usb deivce. > > Seems right? > Not necessarily. Is other code doing something similar ? Using a mutex like this creates the risk for hung tasks. Guenter > Best regards, > Alexey