Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp90357pxb; Thu, 7 Jan 2021 22:49:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJyh85mm4qgoF8xukdlIsZKy0VG/bKXHXD/FgNNZjtDc1I0Lg86+F3SWCFkYV/DO9mdilV0V X-Received: by 2002:a17:906:d9c7:: with SMTP id qk7mr1747090ejb.384.1610088578752; Thu, 07 Jan 2021 22:49:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610088578; cv=none; d=google.com; s=arc-20160816; b=wv2o4qxHl6x9qnSf4qAukYvuGPUip9FZ4sTNGLUOESsMeMOohHiONPRyzN+UeCmQlA yuzAWXouPIXtZqhakYuQDP9i9iDyEYu2W8Aip9Xk/1bCsSDm0YZyfBcy+d7kxBB+CHgS 6zUTSKBOReFc+nZcfojeCuZFpQISwvXY81yD+djqWAy5SX+bzU2b5x/s1AZfPNwzic7V 54G+JxtLsVaw2IJqCvEUPlYqI55t3h0Fx1ir77PZvlXJNzKm/Ufvb6jF0MTtbE2TVmv8 EFiqDusNWQU4+XzwY5goMW7hLiFZijEkJfZTnvN3s1Ehj6MnmcjllQTdJ0I367nIozoX upnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=yTFhLSnVnQeeSbMnbB81VZfqdA76QzF6Vs/1LGbpAEk=; b=pXrpr7SJz2OTFy6sDZIz51Y9eqImaHAoxEWKxi0oqUB7blHiLEN+RJi0KQL929OSLK C5oyHHkcH4U+bqX4vxzYysrXryy06rqVo1an+VhBjlp70MdbSCGdyGoxjuNBYDLpZEGS uQ4Ztydx81zDXmMqwAtCGJhHh4FSXZ3Gh+A3f5OABYe9IRU7qg33jLVNjtDmJCPo7WgP e2Chdpozzc0BDOeI5DXmA4baU0PtwHgvCm0uaf4MTWZjq0V2YflT9ubmOfwg+V9ZFDaH hakhZS0Omuy5Y65s6jNFKUfFo6nFxUzF8PyiGkVYA1OBAdznw3LSKZzhdbh8rQU6bYnx NWcw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id de20si3160223edb.171.2021.01.07.22.49.04; Thu, 07 Jan 2021 22:49:38 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727159AbhAHGrZ (ORCPT + 99 others); Fri, 8 Jan 2021 01:47:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725308AbhAHGrY (ORCPT ); Fri, 8 Jan 2021 01:47:24 -0500 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58B4BC0612F4; Thu, 7 Jan 2021 22:46:44 -0800 (PST) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kxlXj-008GYs-26; Fri, 08 Jan 2021 06:46:39 +0000 Date: Fri, 8 Jan 2021 06:46:39 +0000 From: Al Viro To: Jens Axboe Cc: linux-fsdevel , "linux-kernel@vger.kernel.org" , Oleg Nesterov , Song Liu Subject: Re: [PATCH] fs: process fput task_work with TWA_SIGNAL Message-ID: <20210108064639.GN3579531@ZenIV.linux.org.uk> References: <20210108052651.GM3579531@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210108052651.GM3579531@ZenIV.linux.org.uk> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 08, 2021 at 05:26:51AM +0000, Al Viro wrote: > On Tue, Jan 05, 2021 at 11:29:11AM -0700, Jens Axboe wrote: > > Song reported a boot regression in a kvm image with 5.11-rc, and bisected > > it down to the below patch. Debugging this issue, turns out that the boot > > stalled when a task is waiting on a pipe being released. As we no longer > > run task_work from get_signal() unless it's queued with TWA_SIGNAL, the > > task goes idle without running the task_work. This prevents ->release() > > from being called on the pipe, which another boot task is waiting on. > > > > Use TWA_SIGNAL for the file fput work to ensure it's run before the task > > goes idle. > > > > Fixes: 98b89b649fce ("signal: kill JOBCTL_TASK_WORK") > > Reported-by: Song Liu > > Signed-off-by: Jens Axboe > > > > --- > > > > The other alternative here is obviously to re-instate the: > > > > if (unlikely(current->task_works)) > > task_work_run(); > > > > in get_signal() that we had before this change. Might be safer in case > > there are other cases that need to ensure the work is run in a timely > > fashion, though I do think it's cleaner to long term to correctly mark > > task_work with the needed notification type. Comments welcome... > > Interesting... I think I've missed the discussion of that thing; could > you forward the relevant thread my way or give an archive link to it? Actually, why do we need TWA_RESUME at all? OK, a while ago you've added a way for task_work_add() to do wake_up_signal(). Fine, so if the sucker had been asleep in get_signal(), it gets woken up and the work gets run fast. Irrelevant for those who did task_work_add() for themselves. With that commit, though, you've suddenly changed the default behaviour - now if you do that task_work_add() for current *and* get asleep in get_signal(), task_work_add() gets delayed - potentially for a very long time. Now the default (TWA_RESUME) has changed semantics; matter of fact, TWA_SIGNAL seems to be a lot closer than what we used to have. I'm too sleepy right now to check if there are valid usecases for your new TWA_RESUME behaviour, but I very much doubt that old callers (before the TWA_RESUME/TWA_SIGNAL split) want that. In particular, for mntput_no_expire() we definitely do *not* want that, same as with fput(). Same, AFAICS, for YAMA report_access(). And for binder_deferred_fd_close(). And task_tick_numa() looks that way as well... Anyway, bedtime for me; right now it looks like at least for task == current we always want TWA_SIGNAL. I'll look into that more tomorrow when I get up, but so far it smells like switching everything to TWA_SIGNAL would be the right thing to do, if not going back to bool notify for task_work_add()...