Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3309724rwd; Mon, 22 May 2023 11:40:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ694amklhkEu9SaapN6GDLCLqHwTRpHm5OSxeXpB2QIg09Tm5AARZRnWDWGpEWFYBH4ktkP X-Received: by 2002:a05:6a20:1445:b0:101:a459:bb0d with SMTP id a5-20020a056a20144500b00101a459bb0dmr12995656pzi.2.1684780826642; Mon, 22 May 2023 11:40:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684780826; cv=none; d=google.com; s=arc-20160816; b=LjCYbyQ16GP4Ipg6TiOvGvaVaPghCQWdn1ntZWTitmN9QzGcBgpk2E+Z3XRh5otRRI hR8W8+5IeD8N869wjchraL0LKYG/RaAbF1dt3nbl0+xYd1gK1yb89/aRkej+Xe/7bCaS mbKbo50EVzQBcyLhiR+2hEIWV9nMqJaal9ELozfT02dKjQRJlTmxKwfNDFPjp5c4sPV0 mqTsavCD2KTxK5IBrZIzQq75wXKGoNEcHkP9omdgHtxJYoAqUwQW80xSIeYdBivduIQg dzBLcCy4RvT0iQ83Eh+2QzJwl1z6UZbJkBKHN9PnuYHGP5r5Y5Bs06z60vSFgzTUygz5 nt7g== 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=XnNGFZ0Re+VRM8UtKCafqqilhh7RIrL5HAPnivOKzbI=; b=E+sTIl97FZRUZcSXFNd37FJgxOcyMqqdl6hWzBiIrBBobIR5jwU8UD54K2XYzqnUM7 hgdLbZstVKyRoA/mlA/WFELbP78Knc1UY5vdm8IPAf6L/bXvZHqxzrG3c2sS7Wd0DY3X /89bsYasDq1I+X/LHqIW5gNo/oCp70RSuEyKr16TtyisHVBgNVP3ZS5JAak+ZEuxyArY 6gWSpISmaYuPZU5ZeIYX9ixCjQkcBzyZUIWSR1IhzC/VKDdqEcx6HPM6ee31zd+qEVsn +SpGhdaPRhGZGEu1sGQ+S8rNZS5kIIhXpAUfNRQP8YBHtysfdeD4uGmaqQQ/UklSrk+2 QBeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=NzXyvxl+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r191-20020a632bc8000000b005362a68241bsi898838pgr.771.2023.05.22.11.40.11; Mon, 22 May 2023 11:40:26 -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=20221208 header.b=NzXyvxl+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232106AbjEVSUn (ORCPT + 99 others); Mon, 22 May 2023 14:20:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229600AbjEVSUm (ORCPT ); Mon, 22 May 2023 14:20:42 -0400 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D338AF; Mon, 22 May 2023 11:20:41 -0700 (PDT) Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-64d5f65a2f7so1244819b3a.1; Mon, 22 May 2023 11:20:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684779640; x=1687371640; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=XnNGFZ0Re+VRM8UtKCafqqilhh7RIrL5HAPnivOKzbI=; b=NzXyvxl+eSVn+61YhwsdEeeNs478YJ8xN7PSMdxpV/6VzBVVkU5kVSD7zG8Fx3GUnk Z/S4gARmV2kF5gle3UQBkay0WkXphb/SEIJLZGfdhADHFZrv0H9PKv7g3ANWTgJMV2fC AoYExvL/IbYRXK9A57srnMouw5q+tRoI8Wy8kQXbwQvXbNyaZ6w6FSaguMNkNR5KYKSn lOY6/pTuZI8CepbFHsrDCCCM/+agpMkLpPx/3V410dUCYzaXywb7lJf0VtbyKS3aiv1f TtezOHLHlOM/l8thVbZ+r6frmx49L4kplWhlcqckI9Zv3+WkpB1z9eXaJFgF3qKVXbQq GZGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684779640; x=1687371640; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XnNGFZ0Re+VRM8UtKCafqqilhh7RIrL5HAPnivOKzbI=; b=fIivPwJP4PwT2F5RqhA5zknsv/qH0QtDeYuju3ep5nMrolBnzPdz1t60dF8dX1kCIh 2rt8qztb3KiGX5sbUQ8FLj8s2OaiRXsNL0OXvasRNS9fvu9SMBYOhEI6ewUu+Nj3dFM1 QX5KcKsyVxmKUBvB7/H2BWrZGCSVrNqSCnEHlbvMgIj78Oe3BhBbmZVlHKC0h6HMV3nh Si8s3zLRWDnMLX+CfQSFKjirmX1koc+vMfhNs9KstvMvBUsP4qQvt7y6SEb6HfGXp6ff FjFJ3LboElqNvOn03jf3MP+IUevRDG3bbrIzDWv29jRm7nV8MWrAkujXA7xOnlfvVq1I HfnA== X-Gm-Message-State: AC+VfDyOOC5RegLCTXr4Dg39sSuQLoZWphHgdhi7fA3xonj4pfC19tGb f6L7yAQ2SCzzwWZlpCcP56c= X-Received: by 2002:a05:6a00:140b:b0:63d:3339:e967 with SMTP id l11-20020a056a00140b00b0063d3339e967mr14978767pfu.19.1684779640307; Mon, 22 May 2023 11:20:40 -0700 (PDT) Received: from localhost ([2620:10d:c090:400::5:39c]) by smtp.gmail.com with ESMTPSA id 10-20020a63060a000000b00502fd70b0bdsm4721026pgg.52.2023.05.22.11.20.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 11:20:39 -0700 (PDT) Sender: Tejun Heo Date: Mon, 22 May 2023 08:20:38 -1000 From: Tejun Heo To: Z qiang Cc: Naresh Kamboju , open list , Linux-Next Mailing List , lkft-triage@lists.linaro.org, clang-built-linux , Nathan Chancellor , Arnd Bergmann , Dan Carpenter , Nick Desaulniers , Anders Roxell Subject: Re: next: WARNING: CPU: 0 PID: 63 at kernel/workqueue.c:1999 worker_enter_idle+0xb2/0xc0 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.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,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 Hello, On Mon, May 22, 2023 at 09:24:09PM +0800, Z qiang wrote: > diff --git a/kernel/workqueue.c b/kernel/workqueue.c > index 9c5c1cfa478f..f8d739fef311 100644 > --- a/kernel/workqueue.c > +++ b/kernel/workqueue.c > @@ -1060,10 +1060,9 @@ void wq_worker_running(struct task_struct *task) > * and leave with an unexpected pool->nr_running == 1 on the newly > unbound > * pool. Protect against such race. > */ > - preempt_disable(); > + local_irq_disable(); > if (!(worker->flags & WORKER_NOT_RUNNING)) > worker->pool->nr_running++; > - preempt_enable(); > > /* > * CPU intensive auto-detection cares about how long a work item > hogged > @@ -1072,6 +1071,7 @@ void wq_worker_running(struct task_struct *task) > worker->current_at = worker->task->se.sum_exec_runtime; > > worker->sleeping = 0; > + local_irq_enable(); > } Ah, yeah, this is correct. Now we're modifying nr_running from timer tick too, so if don't block irq, the timer tick can ruin the not-irq-protected read-write-modify nr_running update from wq_worker_running(). Naresh, can you please confirm the fix? Thanks. -- tejun