Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2791152rwb; Fri, 2 Dec 2022 15:21:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf560+9bHWwXRgySHu5ys2q09c/dgomyB5gd7KU3eM53GGKDFelGNGGpPmPy7/zxZfMTysHk X-Received: by 2002:a63:5762:0:b0:45f:97e8:d8a7 with SMTP id h34-20020a635762000000b0045f97e8d8a7mr65115507pgm.426.1670023316790; Fri, 02 Dec 2022 15:21:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670023316; cv=none; d=google.com; s=arc-20160816; b=zYusMWcImk7VIHNLm7XmRSPFjtG1yqavtLHlOsdLByMxwA+/OMl0nVyUjNdBfa+Id4 ufGq83h2wLMpSsTsZAIGVNZFSDoGlOaPm2Gdq+/kEyxZARlzC16ZZSjZgj312MyrvVCY jirGz1dmUACxFLn520FqAObi81kUJgzbKmM9u1P7S6/LCNL0HDkniCMQFBgYWyU/5HK3 xDH3KZPP1RiHLnwTfV+CA4gaYUps9TpXf4XuYjHw+yOy7ro/O3gFEVAh7ZSN2K9P7NMb lfEGP42EUliVShq/5ENAtnsm+FupJTIoAyz//spKLoSe9ioDpg7LVIBXn1ygkN1GAMwj gsOA== 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=2FkiNoF6tH/tx6+1QcMUKTSACmEEM4wVa8rkiwwe1Os=; b=RAYrPvX+9rkYtfm+/W7NBv1UEgd8mdftQpV/ZpWIV6pqIZufvJsK28av+0jMLAmKXY v5LNs8BmL4D9jgCMY7aDA1gI1ilhy/VvnEUpLsVyqJeY6bn8DUKUvwLBiwvQsvEo3veF zSOOITaRt7/jVUpOVnLEa3M3wyOGjetsfGJ5MimzCVd5if12x5s+mqbar4LyhUjc1dXT F97G1c2EEsy/xLlrOw6Lfh7QN13xdKBrOjuXXcuHat8fbKX1+SdPZ07ekjL9+TPTDyCl XCvyA3bYp+SsQMGAnAgW4flfAfiGMwLG3Bt65KHFQm0DCSc5uwjtGESo4CpYVGgkhSHv NiJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Fpe4GHWW; 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 e12-20020a170902f10c00b00188e5c9e026si7644693plb.102.2022.12.02.15.21.46; Fri, 02 Dec 2022 15:21:56 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=Fpe4GHWW; 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 S234702AbiLBWyh (ORCPT + 82 others); Fri, 2 Dec 2022 17:54:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234550AbiLBWyf (ORCPT ); Fri, 2 Dec 2022 17:54:35 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79BCFE1778; Fri, 2 Dec 2022 14:54:34 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 32E47B822E8; Fri, 2 Dec 2022 22:54:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72C3FC433D6; Fri, 2 Dec 2022 22:54:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670021672; bh=WaMU7Ge0epObyaSSLOJNB/I06TYIj1nhbJdaHZ9nifY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Fpe4GHWWeS2MiaKPw0dHMSVcpInftkQdeTUZ5X/QiJ84qdoWNdWS5dqoXJk1LqL7s /STLtU5eionxQLhWYyM6XPCWHnrIFc/YX2Xe4OCFnQw8nCfDWzezreF5bz9GA4NgBf w6535fLooA+1Wo/umTei7HeU+GKiHai4NXkoT9AMWWVPN/536ywcR7osuU+uNCffSl oIelPB0RW4g58PouANHfHb/6df2Es/ilOKxHIjpvtuGv7JAJofDFeMTzVXOqaoEztw 6YE0aRAqQpRG9Yrv3vXBJexFcNGqlKy9RlCBtYISIHtuJLNnOm7AbNndv5aPanN8Ev ajPFJnby6wx+Q== Date: Fri, 2 Dec 2022 23:54:28 +0100 From: Frederic Weisbecker To: "Eric W. Biederman" Cc: "Paul E . McKenney" , LKML , Neeraj Upadhyay , Oleg Nesterov , Pengfei Xu , Boqun Feng , Lai Jiangshan , rcu@vger.kernel.org Subject: Re: [PATCH 3/3] rcu-tasks: Fix synchronize_rcu_tasks() VS zap_pid_ns_processes() Message-ID: <20221202225428.GA1754872@lothringen> References: <20221125135500.1653800-1-frederic@kernel.org> <20221125135500.1653800-4-frederic@kernel.org> <871qpkqof8.fsf@email.froward.int.ebiederm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <871qpkqof8.fsf@email.froward.int.ebiederm.org> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Wed, Nov 30, 2022 at 12:37:15PM -0600, Eric W. Biederman wrote: > Frederic Weisbecker writes: > Two questions. > > 1) Is there any chance you need the exit_task_rcu_stop() and > exit_tasks_rcu_start() around schedule in the part of this code that > calls kernel_wait4. Indeed it could be relaxed there too if necessary. > > 2) I keep thinking zap_pid_ns_processes() should be changed so that > after it sends SIGKILL to all of the relevant processes to not wait, > and instead have wait_consider_task simply not allow the > init process of the pid namespace to be reaped. > > Am I right in thinking that such a change were to be made it would > make remove the deadlock without having to have any special code? > > It is just tricky enough to do that I don't want to discourage your > simpler change but this looks like a case that makes the pain of > changing zap_pid_ns_processes worthwhile in the practice. So you mean it still reaps those that were EXIT_ZOMBIE before ignoring SIGCHLD (the kernel_wait4() call) but it doesn't sleep anymore on those that autoreap (or get reaped by a parent outside that namespace) after ignoring SIGCHLD? Namely it doesn't do the schedule() loop I'm working around here and proceeds with exit_notify() and notifies its parent? And then in this case the responsibility of sleeping, until the init_process of the namespace is the last task in the namespace, goes to the parent while waiting that init_process, right? But what if the init_process of the given namespace autoreaps? Should it then wait itself until the namespace is empty? And then aren't we back to the initial issue? Thanks.