Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2943041ybc; Thu, 14 Nov 2019 01:22:41 -0800 (PST) X-Google-Smtp-Source: APXvYqyYbJ9o+TkDj3iePVtN3H0HATjyCt4EkL+aIDYnkQyhQwlqAbiXki52SrOdp3S4IRl8JK/C X-Received: by 2002:a17:906:4a43:: with SMTP id a3mr7186037ejv.311.1573723361029; Thu, 14 Nov 2019 01:22:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573723361; cv=none; d=google.com; s=arc-20160816; b=OPVXrs4lnQVfCqil5PwBj2MFNhNIqcQ0qvZlviulFgYQ9iPBoLqDkDQq3xL1tvVF5/ 1PiLLzhjqp6sAD6JIIUftJIvS4AddGi88Iv5ON9I0SwUd8iOyCB0N6WtvTE3wbA9ZNgL 2rQuIc7uc9vl4DORXuZ66YRs0vDkq6kyznF/razKKV+jGS9NKwCLZS1zlleWbdAyVEIC KS2uj/ugiU7shkWGf0OO93IgveHEVD/AQk6RAvirErsT484BVvnV4hVEJxDsqgr9PDSt HOW6oWNJYd2cpK1kflIk7a9AOcou88JdGbL3m31mhTKBMwUaEMdGK8r3RXu+ad1mIjRp 1YzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=VWOUZ424cqLg2kuzZsAep0k1VB5L7ThfcMMEDK+H8tc=; b=qxfFpxSi86LyzB3TPdrvNjxrhYAyaCLVhw9ZJQ1JZn4AragBRLDf/3wtmyx5RuIHrU Qp3fTx47csrfas+V/SRZ0UjVL0cFDMH4tbGHEDKvY29weD28FKw2FORpOl3J+7s+nWzT UpIGmticg/Cc2M6UzX9B9FugotXtplH9T6MAjQxAg7/HFUOeaQbGSbI6GhHP1SjhgON8 hOqb7FtgBwJ3eSRtQdTrUCiAgJoAGqxFvHh9JUnNAL/FPdktcumqmuI7DqlGX6nTrwl1 csoeg3A/xNKSYb7KyGYTjd8oxFItGoe7NrydZcTahIQDPb8St/uopiJqIolaPyZ2Rvjb TDvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=HUIEkJPB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v6si2898159ejw.412.2019.11.14.01.22.16; Thu, 14 Nov 2019 01:22:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=HUIEkJPB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726491AbfKNJUC (ORCPT + 99 others); Thu, 14 Nov 2019 04:20:02 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:36890 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726057AbfKNJUC (ORCPT ); Thu, 14 Nov 2019 04:20:02 -0500 Received: by mail-lf1-f67.google.com with SMTP id b20so4451641lfp.4 for ; Thu, 14 Nov 2019 01:20:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=VWOUZ424cqLg2kuzZsAep0k1VB5L7ThfcMMEDK+H8tc=; b=HUIEkJPB/6glFajby5ySDEps1DnotXVu1qEtQ0BwJWhu32tz/9zrUk7HdFdvFdnNHH dxO3Rk/YldlDxbgdprqwpmmDNlU0fPIxF97ZmXNrwyUWh/QgNIbKxhMUIrEaKZy8LBu6 f1wjBruA5fQCQetB0h1yhtxHaFdrfrDDMCpmg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=VWOUZ424cqLg2kuzZsAep0k1VB5L7ThfcMMEDK+H8tc=; b=AYwTvOHb343aFmzpwIuU7WIw/Nkwqyso0raabAIsjpDNuv7sydUznBXxkEQy8qpL7t 1b7KfpCOzPwdvLNueB1DZs9nRFtaIDb8u0Xl2XKGe4O5j2Z+UXf97cVWF55IPRdKzYot uC9NP3RK5jIPGsltkVQvdHgMpDUMCNBQ3tA3EbaZfBn6RtF2pnayheo2DJlw0YBWqvh+ 4vkmSAiZF9LaJwKReEp3Mc/WEEuiIO8hy15XwzxKMR257WM2wIhmVOGrUUg53Q7opVP3 li+hcKUQ8iiPuLIxfzWuI4qH73K3M3pgRKAD8eJsYgWCEbbAKyLHZG4Srhqcn+qNszCD jgAg== X-Gm-Message-State: APjAAAWjQ+3PCJfuEl+4dkXW7bSvRvV2oIkw+o5KrPLEwWxjaG38g6yc IJNYNfd89i5caIJm3pN/m3PWBQ== X-Received: by 2002:ac2:5c4e:: with SMTP id s14mr6047944lfp.23.1573723199828; Thu, 14 Nov 2019 01:19:59 -0800 (PST) Received: from [172.16.11.28] ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id 190sm2535102ljj.72.2019.11.14.01.19.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Nov 2019 01:19:59 -0800 (PST) Subject: Re: [PATCH RFC] io_uring: make signalfd work with io_uring (and aio) POLL To: Jens Axboe , io-uring@vger.kernel.org, "linux-kernel@vger.kernel.org" Cc: Alexander Viro , Andrew Morton , linux-fsdevel , Christoph Hellwig References: <58059c9c-adf9-1683-99f5-7e45280aea87@kernel.dk> <58246851-fa45-a72d-2c42-7e56461ec04e@kernel.dk> From: Rasmus Villemoes Message-ID: Date: Thu, 14 Nov 2019 10:19:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <58246851-fa45-a72d-2c42-7e56461ec04e@kernel.dk> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14/11/2019 05.49, Jens Axboe wrote: > On 11/13/19 9:31 PM, Jens Axboe wrote: >> This is a case of "I don't really know what I'm doing, but this works >> for me". Caveat emptor, but I'd love some input on this. >> >> I got a bug report that using the poll command with signalfd doesn't >> work for io_uring. The reporter also noted that it doesn't work with the >> aio poll implementation either. So I took a look at it. >> >> What happens is that the original task issues the poll request, we call >> ->poll() (which ends up with signalfd for this fd), and find that >> nothing is pending. Then we wait, and the poll is passed to async >> context. When the requested signal comes in, that worker is woken up, >> and proceeds to call ->poll() again, and signalfd unsurprisingly finds >> no signals pending, since it's the async worker calling it. >> >> That's obviously no good. The below allows you to pass in the task in >> the poll_table, and it does the right thing for me, signal is delivered >> and the correct mask is checked in signalfd_poll(). >> >> Similar patch for aio would be trivial, of course. > > From the probably-less-nasty category, Jann Horn helpfully pointed out > that it'd be easier if signalfd just looked at the task that originally > created the fd instead. That looks like the below, and works equally > well for the test case at hand. Eh, how should that work? If I create a signalfd() and fork(), the child's signalfd should only be concerned with signals sent to the child. Not to mention what happens after the parent dies and the child polls its fd. Or am I completely confused? Rasmus