Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp2804456rwb; Mon, 5 Sep 2022 01:33:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR5FnEXwtOGSk2z4r96u+ycxTGwLI8PSMT1IvlZ1w6Bkppcq2kUtXkRfqFAxrVWUwXyyE5wW X-Received: by 2002:a17:906:cc13:b0:73d:d22d:63cd with SMTP id ml19-20020a170906cc1300b0073dd22d63cdmr35469430ejb.741.1662366820128; Mon, 05 Sep 2022 01:33:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662366820; cv=none; d=google.com; s=arc-20160816; b=anNol48pwEnI8TLAvNEgAL46ytav0OGvfpUdk0FihZ6zVB2MyH99HeF50lvzzDh5IR coYfh38rSmrA75YBrnflP7MzhK/TiG40lVCmyOeH0OUx7Zqg8prYrvxZVCeuUT0G5L4I zhpeIStcbYmWcwmoU243KFjUV7Cag2AdsSZk+81RmjVmak+Bxmrx8xpoMQWdgigjygIM EdA5mgCNFk6hvD5RkAmkM+53gkJwvzeiPCHpMOXWtsJ97WVrxh+0tHnuiQXgHA5UO1iQ 86AwY9Dlsf+I/uGUYLaOHsHVugoAwGZJaE9auZ0xSKzqOIusXKt08cCz7T9ddWBK4Bel ++bA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:in-reply-to:date:subject :cc:to:from:user-agent:references:dkim-signature; bh=tPd9b7KpNUkFOZOqNXWb0cJaT1vmg0PM/YxQ/a9zN6w=; b=Jaj4QuCdboSacQZF8PZS4JFSQGt57kRP2TTs0kfoyOA6WwNzL+p/qM/qLacYPjVMwp DxUjAnejzeD6M5YhQP46x2yI9lZpFGjrLzUMfM5+7VKLxV727DRXsyLXGw6rl/EqifIB hUZ43yP5wokwPet5THi0bA3rK65PgwJ7J9qIjYwlPSsuiq9f17e5tY8hHQadQUT/ITCr 4cMgXfq13pjEBiQ2SjeHlnpzfL6Kl9nyc2P+/ZotiUwHaOmeA6CYMxLHOkjYixervC4Q 4+6oqG2pKht/tJxjIxOL4KgrATKE0tUHWIxjUOFiBttkuNmeyafJQb09FAhR6uyBe/Vi Jt+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ltfA0Xbz; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q13-20020a170906940d00b00738399b2bc9si6323842ejx.166.2022.09.05.01.32.53; Mon, 05 Sep 2022 01:33:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-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=ltfA0Xbz; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237748AbiIEIcd (ORCPT + 99 others); Mon, 5 Sep 2022 04:32:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237763AbiIEIcH (ORCPT ); Mon, 5 Sep 2022 04:32:07 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBC0B19C for ; Mon, 5 Sep 2022 01:31:24 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id t6-20020a17090a950600b0020063f8f964so1499135pjo.0 for ; Mon, 05 Sep 2022 01:31:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:from:to:cc:subject:date; bh=tPd9b7KpNUkFOZOqNXWb0cJaT1vmg0PM/YxQ/a9zN6w=; b=ltfA0Xbz8AQsSlcUSBw1z2ccIHm9iW1693cCpit/rTzINMWE6lrAdlPyt6ahGQBTf/ KDYbrVZQZGUWw1TnEn9s8UXDhrNFci0uRtK8ENScIuTn8bmUSvz7voMI55epPBkEM54p orKsxr6FGOCD5C9Ky2UfxTlvaeZs6/6eqoqzrMXNjwWG9HcfZMjidYj1D1oEfnSKu8UN PQ2BgtdgkAYWLYg116vMeyyhArqy2jL/Qf4BLrFyd+prqFACUl6FjRD0g0naAsAdP82X /Yek15SAF5127VLIiihNXQcsaU+tG8J9DHRPcC/M9cGfNTbn05nNPoweLSLn+K5ubUE8 dQ4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:x-gm-message-state:from:to:cc:subject:date; bh=tPd9b7KpNUkFOZOqNXWb0cJaT1vmg0PM/YxQ/a9zN6w=; b=xLCRDbRjt6L3FoR/2/Knq1J7IcJ1lX5rMnv4QDBOOIlQelRVq8mM9Oj4llQeHESuwY NiycKghPlrvir9KwyV6XO5t2EjJcOpauFEMXqflMkAIN2o36nTxuDEoxOgdAZbyQd/Kl p9oM/SHxCL8XiDdA0W+iEcdHbyQQVp8bP+wz13uIWKU+fXzlAoY99YoC6GJLOl27F37w +0wJsv/cZROxm5vKs/pheR+ruk6d8KFH3KDTi/M1P/Yqt9ee2KaAiu6qFLT8PME8cmmr CIbTISdix7HCULjoB8ard2gfDeOuJHxpxnrmdGuvL2AGC4iFZGGrd1+EJoXPud4YZ/EQ 261w== X-Gm-Message-State: ACgBeo0DupYu2vHx0MecS7eXs70cCRKSHUaW+fFFfvU4xbBAjbuaf8tD dRkoSRG6tUujkXEOJk48N3UG6Ym7yg/Epw== X-Received: by 2002:a17:903:1c8:b0:171:2ed3:6780 with SMTP id e8-20020a17090301c800b001712ed36780mr49189876plh.30.1662366683893; Mon, 05 Sep 2022 01:31:23 -0700 (PDT) Received: from MBP ([39.170.101.209]) by smtp.gmail.com with ESMTPSA id q14-20020a170902eb8e00b001750361f430sm6728333plg.155.2022.09.05.01.31.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 01:31:23 -0700 (PDT) References: <00000000000016512d05e76bd837@google.com> <733e6931-aa66-5295-d8a8-49063b7347f1@I-love.SAKURA.ne.jp> <289ba1a9-e4f7-d0b5-545e-a98dcf365c68@I-love.SAKURA.ne.jp> User-agent: mu4e 1.6.10; emacs 27.2 From: Schspa Shi To: Tejun Heo Cc: Luiz Augusto von Dentz , Tetsuo Handa , Marcel Holtmann , Johan Hedberg , syzbot , syzkaller-bugs@googlegroups.com, Lai Jiangshan , "linux-bluetooth@vger.kernel.org" Subject: Re: [PATCH] Bluetooth: use hdev->workqueue when queuing hdev->{cmd,ncmd}_timer works Date: Mon, 05 Sep 2022 16:24:06 +0800 In-reply-to: Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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-bluetooth@vger.kernel.org Tejun Heo writes: > Hello, > > On Sat, Sep 03, 2022 at 07:11:18PM -0700, Luiz Augusto von Dentz wrote: >> And we can check for __WQ_DRAINING? Anyway checking > > Please don't do that. That's an internal flag. It shouldn't be *that* > difficult to avoid this without peeking into wq internal state. > > Thanks. It seems we only need to change hdev->{cmd,ncmd}_timer to hdev->workqueue, there will be no race because drain_workqueue will flush all pending work internally. Any new timeout work will see HCI_CMD_DRAIN_WORKQUEUE flags after we cancel and flushed all the delayed work. -- BRs Schspa Shi