Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2911971pxb; Tue, 19 Jan 2021 08:57:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJzX5YiY5s28WM6D+x+w1BNliOH/PWJWKaqWxW2benO3wJXMjLXFwrKPAPRFeMuud34cB48g X-Received: by 2002:a17:906:58c8:: with SMTP id e8mr3568535ejs.475.1611075474663; Tue, 19 Jan 2021 08:57:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611075474; cv=none; d=google.com; s=arc-20160816; b=C6LmaP1HJ+Rnc+Fx3fo37yEizt8v4ICJj0gFXHxe6bm3jh4+/+X05FGPcDjFquQczx fqdwcHLU2MoMb7nfCSrZ47js5ctXiU77A2A9pmaiG/HRgjgjajy6g7CLyDKP/o1rcGzv ZfPMAbQ+hfYAeNcnUSR6dgEWj2jP5SCfxDJJTMARgP6jKqS3EfNMQ/+67oWYYS6R17z1 KhIhO/nPmCG2r84YIDtICG9Q5bk6NtaWVgtRbG2ROag/ByHfBcDTm9Egk1r7rm89DECG dyoqJ7uwJ+IEGhIw0COcYHk/uZPHxtV33RXYAi5qhRRaurB//zxzln4JF0ywI/HdiVvH x1BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=HK4nAJ3T6oXK1ONWdl9zHivMWs2pVZ45ipCqU6He5eg=; b=DKyNGODdPYzBl/gvUIQMj+QFavSMhiqzTuXnWSGT9lEgxPq5BcJAlvT4npm37hBv3M 0lBivDJcCX0EKvLFNXmesj8koLmfnzlUQau8r0Cozm0k4gdg5qyewfGYi41mGUtsd4dO Bk9cx/hQpX6FHa5wGQqDU07YfuI72+QgGv3lggk6D04nY2mhhO+wXAnkvEFwNn84uVbQ cFlqYixDrutjRnQ9egEa8XS1GMCzh5vt0qgjX3WZypYfkkTZqP8SBn5Mf69VRx8Yw1GE paTTqoj9hJU5pxI1zORpqhGeweNEKLMbKvYMux6DpsOrwmjuLHRd6ZcrUH94LjmD7OME gw0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="M/JULRFD"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o26si9530903edw.74.2021.01.19.08.57.21; Tue, 19 Jan 2021 08:57:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="M/JULRFD"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2391062AbhASQz7 (ORCPT + 99 others); Tue, 19 Jan 2021 11:55:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:38135 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390426AbhASQyg (ORCPT ); Tue, 19 Jan 2021 11:54:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611075189; 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=HK4nAJ3T6oXK1ONWdl9zHivMWs2pVZ45ipCqU6He5eg=; b=M/JULRFDF1gEPbSOAowUUqk5UHOclfRbFIsi9SRKyv/8YCclQ0T+1JDzFIJvheHkQnvr3J Bi97rm+vTw5GtvRg6aVIarDeL5jwMPr9cjYMl/usS4JcrwDkGXt7FeShRvZX1xO7Io6u1h SIlj42HfuhIh2J1VeKfuspqpAstS1rI= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-140-cQg_A79oOi-uhudHURkm9A-1; Tue, 19 Jan 2021 11:53:07 -0500 X-MC-Unique: cQg_A79oOi-uhudHURkm9A-1 Received: by mail-lj1-f198.google.com with SMTP id r22so5306314ljd.4 for ; Tue, 19 Jan 2021 08:53:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HK4nAJ3T6oXK1ONWdl9zHivMWs2pVZ45ipCqU6He5eg=; b=E2Xo3bdZXBaGGEzdlSYYpt1BDEbtOJdJqepsgjvyXyUFdPh6wHwhklipr9B7ZwJbfp llLHgksKVcOZsbVo50BiWIMd6OsezCzvq8LYLuaupvZ6gNYzYH0Rml3BPoptpBjIOA5r LO67KGadM+yhxItDcR4dqLAQ94HQISb38ISws7jmFnNPO5B98GiCz7ADBaIY6X89GXq1 Ffb2mirtTltrwn6iyboIsHatpdWMDVSHX73r3K5+jX/DEpmp0v0YJoMK6mShqXbaGi/O 6Uq4szIx+MMmqz3VXJVr2IvOY9e2u3bmk/49066SJ3Ffgk8O0LI8fzdyfySh87vjbtAc CqDA== X-Gm-Message-State: AOAM530cWTB07MRlx+1fT/ALem90S8XZoOPrSqXG4ksabREz3EnJQpJ8 4w+7pxPyB8j0u6l5RzA3i1OtSHPJJZBBuXOwU5wcJmN6ed/Y9456GPvtDAvBiyxfhmgdxrkuEyp MWFy3PWvHy3ITqVv2gvHpDJKIzpkVmX9an95b25o9 X-Received: by 2002:a19:58a:: with SMTP id 132mr2288990lff.355.1611075186344; Tue, 19 Jan 2021 08:53:06 -0800 (PST) X-Received: by 2002:a19:58a:: with SMTP id 132mr2288974lff.355.1611075186136; Tue, 19 Jan 2021 08:53:06 -0800 (PST) MIME-Version: 1.0 References: <20201203171431.256675-1-aklimov@redhat.com> <20201207083827.GD3040@hirez.programming.kicks-ass.net> <87k0tritvq.fsf@oracle.com> <87im7yc2bu.fsf@oracle.com> In-Reply-To: <87im7yc2bu.fsf@oracle.com> From: Alexey Klimov Date: Tue, 19 Jan 2021 16:52:55 +0000 Message-ID: Subject: Re: [RFC][PATCH] cpu/hotplug: wait for cpuset_hotplug_work to finish on cpu online To: Daniel Jordan Cc: Peter Zijlstra , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, yury.norov@gmail.com, tglx@linutronix.de, jobaker@redhat.com, audralmitchel@gmail.com, arnd@arndb.de, gregkh@linuxfoundation.org, rafael@kernel.org, tj@kernel.org, lizefan.x@bytedance.com, qais.yousef@arm.com, hannes@cmpxchg.org, Alexey Klimov Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 15, 2021 at 6:54 AM Daniel Jordan wrote: > > Daniel Jordan writes: > > Peter Zijlstra writes: > >>> The nature of this bug is also described here (with different consequences): > >>> https://lore.kernel.org/lkml/20200211141554.24181-1-qais.yousef@arm.com/ > >> > >> Yeah, pesky deadlocks.. someone was going to try again. > > > > I dug up the synchronous patch > > > > https://lore.kernel.org/lkml/1579878449-10164-1-git-send-email-prsood@codeaurora.org/ > > > > but surprisingly wasn't able to reproduce the lockdep splat from > > > > https://lore.kernel.org/lkml/F0388D99-84D7-453B-9B6B-EEFF0E7BE4CC@lca.pw/ > > > > even though I could hit it a few weeks ago. > > oh okay, you need to mount a legacy cpuset hierarchy. > > So as the above splat shows, making cpuset_hotplug_workfn() synchronous > means cpu_hotplug_lock (and "cpuhp_state-down") can be acquired before > cgroup_mutex. > > But there are at least four cgroup paths that take the locks in the > opposite order. They're all the same, they take cgroup_mutex and then > cpu_hotplug_lock later on to modify one or more static keys. > > cpu_hotplug_lock should probably be ahead of cgroup_mutex because the > latter is taken in a hotplug callback, and we should keep the static > branches in cgroup, so the only way out I can think of is moving > cpu_hotplug_lock to just before cgroup_mutex is taken and switching to > _cpuslocked flavors of the static key calls. > > lockdep quiets down with that change everywhere, but it puts another big > lock around a lot of cgroup paths. Seems less heavyhanded to go with > this RFC. What do you all think? Daniel, thank you for taking a look. I don't mind reviewing+testing another approach that you described. > Absent further discussion, Alexey, do you plan to post another version? I plan to update this patch and re-send in the next couple of days. It looks like it might be a series of two patches. Sorry for delays. Best regards, Alexey