Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2658599ioo; Sat, 28 May 2022 22:54:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWCdCmgiAhYJJ4GP2K8xERuv0PLJpVmuky03MVvd3dn4xiVpI3Q3VANC9IEABW6RlR6c9t X-Received: by 2002:a17:90a:9412:b0:1e0:c0cc:8630 with SMTP id r18-20020a17090a941200b001e0c0cc8630mr16338643pjo.77.1653803647808; Sat, 28 May 2022 22:54:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653803647; cv=none; d=google.com; s=arc-20160816; b=uAztMQNX9LwLD0t09ILRw8VaFGdqYAUsitMPqYfxwkqT8F/4mN3XUnc3+K86ZQ0GHB LhOfTkqdcD4iyi1OAi6clOte05GpEVov7ZiSgsiUI9ju+NcFd0zGfE5echiBEzTlwQ81 A43YJkycBYPdiqOagaUCAZ3kJvVXxuogpopr2BtweJY969UeKb66sZkvO5Sc5cPk5J23 SElJb+Tvi6cb4ojqtgfAVylG1OYHZAELOcXx8RjYHKohXIL2aHtMQOqpUB7qRxZjd9cw 5+gRqo6ocynnHGCOAknhlPo14bgCuxKP649OkiEprcqH5MUaF+NA9n2zQc/IuJ+fSwsd E6vA== 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:dkim-signature; bh=VIS+wex15RjJjnP3IC3f+DeaURA34+e1K2Y/VUb1vUE=; b=H2tpXbQ5HDN2p56uLG5fLL8bcATsHFMWpMclwNcI4lxIYNkRwWOQ1wVZVSCe8oXfW9 hXty+PsEvCsjCMHD4G8WG7lJFVO3ppHv/ECVoOhN7wuSIWv6SbXQdpkJC/PMwAynANAL 2O3jv7XzzKqI2naMw4yN3h72zt3oZe1MlWmyp2JLRiBVLcCPAMecJPQRiRG8X/WTPyrg 3ZHnOKNj9w06J8NuXpSKe+S7Yq+4REctr+gkhTFRGuCoqqdm21Fpt+fvZg1ETmBZuHY0 dQKG1iL11R4dHoV5Z5veOVYzbiBIM4zfjOiNFx/G5GhVfQTcpNtraC8uvK8EGQSzEU4/ gI+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=URJX4oD2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id y11-20020a170902700b00b0015c96aea0c1si9712343plk.270.2022.05.28.22.54.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 22:54:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=URJX4oD2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2B4DA59B9F; Sat, 28 May 2022 22:54:05 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230371AbiE2FyA (ORCPT + 99 others); Sun, 29 May 2022 01:54:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230201AbiE2Fx7 (ORCPT ); Sun, 29 May 2022 01:53:59 -0400 Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A84B95622C for ; Sat, 28 May 2022 22:53:58 -0700 (PDT) Received: by mail-oi1-x233.google.com with SMTP id w130so10505415oig.0 for ; Sat, 28 May 2022 22:53:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=VIS+wex15RjJjnP3IC3f+DeaURA34+e1K2Y/VUb1vUE=; b=URJX4oD2EgfSpoNO+0r5dLKdtue5Ifu5Wkh2KLAOMO1BMlgqrAeSv9HwBc1Zbq0apc K4AZxDONmeGcY+ck/I6bBI74Kg5+faK0bHiZ8b7sYAOTkC/pNZcp05aqjdvqcD5SBPGb 4I3JjllsLScaFUqEOEgQmUh/XsgaJe9xRqdOHwMWpSNrmRPALedRr3RfbPt4gQIuaZ04 6yb61j+Gatf/Ck0EvA+xErsPW8FiiF3NUHBWfUXG1c8T4S61/kS6DcPMYdfrkmpsv03c ICbY4Dpw/vHcKHUiWl+Tg3Hz2BZU3Nud+DbcfbzAyi5/kCU4pLyazjyl+nvpVaRXiA4y IlEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=VIS+wex15RjJjnP3IC3f+DeaURA34+e1K2Y/VUb1vUE=; b=iVRdbC7GDQ77OnhOkTxX6yv9OCKROY6DC/sy5j8JYUWi2FFQGYsNuEBA8Evm9hMa2o YPWTpCvOOANMKFarJLvxhuyj5FX6Zt1I1S5OhETXdzatggfL4+8lVRevuO/ENSM8xWu7 nnvzK1WDtfT7M2hVRFT4qfjiq6S6Gfl+B3MYZB45M7JD2T2HMvyyaoP3LfFjXEvVDJE4 nUJCsCVq4OhAytMx3L/P1YHdCJmhrd3+AjNheZYByVvPiGJE/a1dunnGDiFMlP3gYnKp efGjF7YeNFBYK9T/eMUWc5MiwrX5ad+0fgiXEHkW2a+682qcrrT4YW9KwojyWu8SREW8 43aw== X-Gm-Message-State: AOAM533EBImSuJhSrW0yR775v/4EFff0HGTtNCrVhK0yOMoEA5tDTos9 a9poH0TDbY1qwFgHCLTv16oc8jJR9AY= X-Received: by 2002:aca:110c:0:b0:32b:bb17:80d with SMTP id 12-20020aca110c000000b0032bbb17080dmr6961430oir.186.1653803637394; Sat, 28 May 2022 22:53:57 -0700 (PDT) Received: from geday ([2804:7f2:8006:5ec0:8108:8ab5:1f16:73fe]) by smtp.gmail.com with ESMTPSA id n8-20020a056820054800b0035e9f149b90sm3817596ooj.3.2022.05.28.22.53.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 22:53:57 -0700 (PDT) Date: Sun, 29 May 2022 02:53:39 -0300 From: Geraldo Nascimento To: Tejun Heo Cc: Lai Jiangshan , LKML Subject: Re: [PATCH] workqueue: missing NOT while checking if Workqueue is offline Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 Sat, May 28, 2022 at 07:24:41PM -1000, Tejun Heo wrote: > On Sun, May 29, 2022 at 01:29:32AM -0300, Geraldo Nascimento wrote: > > I would like very much to hear the opinion of the maintainers! > > I have a hard time understanding what you're trying to do. Can you please > slow down and start from describing the problem itself? Hi Tejun, Sorry for the hurry. The problem is best described in https://gitlab.freedesktop.org/drm/amd/-/issues/1898 From my understanding from the context of __cancel_work_timer() we should not ever call __flush_work() but I may be wrong. In the present case as described in AMD's GitLab __cancel_work_timer() is being called by cancel_delayed_work_sync() inside kfd_process_notifier_release() from drivers/gpu/drm/amd/amdkfd/kfd_process.c:1157 (Linux 5.18). We should only call __flush_work() from __cancel_work_timer() if workqueue_init() is not yet initialized, that's possible during early boot though not very likely. Anyway that's before kthreads are spwaned, so we are sure that particular work isn't executing, hence why it's safe to call __flush_work() in this particular case. The comment on kernel/workqueue.c:3157 (for Linux 5.18) says it best: /* * This allows canceling during early boot. We know that @work * isn't executing. */ if (wq_online) __flush_work(work, true); If __flush_work() is ever called during early boot it will result in a WARN_ON because workqueue is not online. I have no idea if that's OK though it hasn't harmed my machine. Of course I don't want to introduce bugs, I wanna solve them, and I appreciate your cautious approach. Thank you for the work. What is not OK apparently is trying to use amdkfd without HSA_AMD_SVM configured! :) Thank you, Geraldo Nascimento > > Thanks. > > -- > tejun