Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp259390imn; Thu, 4 Aug 2022 05:02:17 -0700 (PDT) X-Google-Smtp-Source: AA6agR7L8Rr0npAEmscjuhxcOnSgLWMNACWCjbwzhEyqizZUqajY1ax8HZv9EZ8MRlvrZ5s0Ne1p X-Received: by 2002:a17:902:d2c6:b0:16e:eeac:29bc with SMTP id n6-20020a170902d2c600b0016eeeac29bcmr1617623plc.76.1659614536929; Thu, 04 Aug 2022 05:02:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659614536; cv=none; d=google.com; s=arc-20160816; b=TVj4RhymaUPj6ZnXgVt5xQ5YJRM0cg/li7CYOoPl1NPhsWk46AxBdSsV3vXnQuN0w+ M5NYwzI5J2MkHOrpd/U9Wjfo6gE7u09MqQL5e+Nhiop/J5yTPYfzuPxYCOgQLzsJwb1C rJzYYdOM7yo4MPEC3K3akh9bnzPEN7GKBYKPFrzOAJPwJhmcNj5AZCSxeH9d80cyJvuk 5hSlH+IMq46HWzdFhlvcgiwCNlISrahf4Su4Qd8s2dXa1p2uVM9JJT71bRqa9US69Qka 66aKIk5HWrk8maqJF5JxH9LqA27n6mTOjjZfRou8xeCW4/LVf1E+EH4Acomco3GHO/op o7IA== 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:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=jbYCfDx16AQ9sgwijlUuh401ek0hMQBtuoovmaTnARM=; b=Yl7SlCkVXT49a7kJre8EQl5P+TyyopD77XaA2I+SjcashxUvWYZ+8nmy2+sIewrG32 tDjjUHBW57C+s48tS8OzM8cQaigHnmyly/mFM8RS6gJbmTOnB9nV1jdpLQcKdrUFhNgL YbjtNI787kXG1w9SeqBa2KEYBuwgCGCpjoM5gGFC2cXB6GBlQI742zio8EebbqcUiyRK tRcvIzUjAn0GR2+07oULpC+4elJEJsshKyf5XmJJIQY44oVQb4DIVhHQRTqCAf3U2vQ+ uJXVt/PYm9GRpTChkWwW/KW5G6RpgW+Ws1rQ+KTs+ayUEudDVg4AsCxC8FviXp1dP/GI RhLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Qruzck46; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g6-20020a636b06000000b00419cb1b88fcsi1030256pgc.859.2022.08.04.05.02.01; Thu, 04 Aug 2022 05:02:16 -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=@redhat.com header.s=mimecast20190719 header.b=Qruzck46; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238427AbiHDLk2 (ORCPT + 99 others); Thu, 4 Aug 2022 07:40:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230457AbiHDLk0 (ORCPT ); Thu, 4 Aug 2022 07:40:26 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 39944BCAB for ; Thu, 4 Aug 2022 04:40:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659613225; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=jbYCfDx16AQ9sgwijlUuh401ek0hMQBtuoovmaTnARM=; b=Qruzck462GaWq4hoF2Qvr24WsJxwPbqrTKM1cO5PEYx8HpyIGYxYGJq9D5B9FPK4PvN1Qb FKuMrrtBOmE2BIXpqn1GoPtJ5m31534lQqp8F+ZlwJ8ixfj/GB4nYz5o90b5pg7nxPUCO7 EB3ekpu46mBTGwMs8yloEDh+Ki9LpiI= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-668-N_Y8QoZEMZyD46BRsMmVAw-1; Thu, 04 Aug 2022 07:40:24 -0400 X-MC-Unique: N_Y8QoZEMZyD46BRsMmVAw-1 Received: by mail-wr1-f70.google.com with SMTP id n7-20020adfc607000000b0021a37d8f93aso4778101wrg.21 for ; Thu, 04 Aug 2022 04:40:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc; bh=jbYCfDx16AQ9sgwijlUuh401ek0hMQBtuoovmaTnARM=; b=rRmIv0xn+muazEcOyyHY2l2AWzIsD0FWKpso6rtSBKtIemafAnZggY72DrmbMhqTzF qH2qOM652ROHpY7Nz3PCvW6s+b0H9CHl5kpMG4oY0W7Qq79tlF6DoErY+5pNbDBixj1t 6wbnbdchXS8+lICqJyT5Y0HPz010GloUzFZqptj87LB0Bu8XJurDFmU+0AhK6cHx8P47 TZsBf0dbTs/dQ8RjnohY/DBDZwNZOHmWTn0n/1QfIa2lWNG6d5W2Vjoz0n+Hx7RIgti/ fqwi2A6zhyaUcbWdXOUgXXL7o+9APVg7kiIngcou8blsVWt6vs0FKsmVdjbAl3OnDzfW DXOA== X-Gm-Message-State: ACgBeo2ydZDNT5epvO1MtZSAuBrdKtz03PaEth9BcpeevdN4wFYq4Mgs FjpexK0krzfDrjCCqSqFwPs9yNeN1nSfNU0r1gQhARxN8juQBntu+y0EF0miSxh2MdXwcwngENH 0HL9zLUqF/evJJU1EFe+jt8E3 X-Received: by 2002:a05:600c:4f0e:b0:3a3:44ee:d40b with SMTP id l14-20020a05600c4f0e00b003a344eed40bmr5939828wmq.199.1659613223103; Thu, 04 Aug 2022 04:40:23 -0700 (PDT) X-Received: by 2002:a05:600c:4f0e:b0:3a3:44ee:d40b with SMTP id l14-20020a05600c4f0e00b003a344eed40bmr5939818wmq.199.1659613222877; Thu, 04 Aug 2022 04:40:22 -0700 (PDT) Received: from vschneid.remote.csb ([185.11.37.247]) by smtp.gmail.com with ESMTPSA id u11-20020adfeb4b000000b0021f15514e7fsm1128588wrn.0.2022.08.04.04.40.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 04:40:22 -0700 (PDT) From: Valentin Schneider To: Lai Jiangshan , linux-kernel@vger.kernel.org Cc: Tejun Heo , Peter Zijlstra , Frederic Weisbecker , Juri Lelli , Phil Auld , Marcelo Tosatti Subject: Re: [RFC PATCH v3 1/3] workqueue: Hold wq_pool_mutex while affining tasks to wq_unbound_cpumask In-Reply-To: References: <20220802084146.3922640-1-vschneid@redhat.com> <20220802084146.3922640-2-vschneid@redhat.com> Date: Thu, 04 Aug 2022 12:40:21 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE 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-kernel@vger.kernel.org On 03/08/22 11:40, Lai Jiangshan wrote: > On 2022/8/2 16:41, Valentin Schneider wrote: >> When unbind_workers() reads wq_unbound_cpumask to set the affinity of >> freshly-unbound kworkers, it only holds wq_pool_attach_mutex. This isn't >> sufficient as wq_unbound_cpumask is only protected by wq_pool_mutex. >> >> This is made more obvious as of recent commit >> >> 46a4d679ef88 ("workqueue: Avoid a false warning in unbind_workers()") >> >> e.g. >> >> unbind_workers() workqueue_set_unbound_cpumask() >> kthread_set_per_cpu(p, -1); >> if (cpumask_intersects(wq_unbound_cpumask, cpu_active_mask)) >> cpumask_copy(wq_unbound_cpumask, cpumask); >> WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task, wq_unbound_cpumask) < 0); >> >> Make workqueue_offline_cpu() invoke unbind_workers() with wq_pool_mutex >> held. > > I would prefer to protect wq_unbound_cpumask with wq_pool_attach_mutex. That looks alright to me, do you want to push that separately as it's a standalone patch, or should I carry it with this series?