Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp38391rwb; Mon, 26 Sep 2022 14:22:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6mfIDM8Ygc2txcWHXI07k7u9qJ+WQFrvZoZsMS2AwS2eWHQte0rUbvM7ZMCmk8OLfUxQ9O X-Received: by 2002:a17:907:724b:b0:782:f2bb:24d3 with SMTP id ds11-20020a170907724b00b00782f2bb24d3mr11926527ejc.555.1664227360995; Mon, 26 Sep 2022 14:22:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664227360; cv=none; d=google.com; s=arc-20160816; b=dJM85yCkOS3JzFfW5SD+ZbbTG4aYYB2eou3d3FARakCSByDnlx5QiCr+LC5NrbahtT IPGpobeuGduc+kTiRB9eDdhZK+MTPJjmt9fOG6aw12sQd5dTXcyEHCCai9gx1y10/woN BUWqfjJco/aDxNTK7Z3Vy08YUcL46OJtxGEw/yroifxcpp/+0GO0Wd7LvnSH0mXJDh0A ItnWuf9TRcMva65F1Q2eLlBHWAoDlLm5dMQrGBnjyJslKNQgn6CGe4N0/o01Q0usQHSP Owvp9uRxWl+ympoIBtIRNKaq3qElrYJQtc9fyJNbh6Z5gxCKHyH0RY+ufV2tLKr4oqH2 0wng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=YS0JM37x41Hs+Zsw/Rkr6g59/J52wo2FJJr5wT1ONS4=; b=HUbHGC5oxryeUj2KOw3RgJP/Sjd9XwFQxpACeHZ1ix4hxozw1cAYBdlKxJmGwEdIom HwxlYetPDfK9fb8TCYnsfShIwEHSlQblLxlDvqUGwZljnM1zD3uf7wyoJJLpe9+4xyRs ZXB/46Muvwn3RyMrggxpPv5ek6Ea0kGfK5d2xohq7r8SUQQu5IwWGe6Y7UcudH8KTVWZ qExyE0kgK3DcFiEwO8Vt5izierlstawcSmQOF53YegS7MVFLF63yC8WA5unc1yoHtVVO FKLV71f0YmJ3u19cDl0rpQ24xayUX7QTVnyMptXoVXmVZBZM7flYWV6Cs0dxVwl+VLl1 vLsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20210112.gappssmtp.com header.s=20210112 header.b=nBjZ3uEO; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g11-20020a056402090b00b00454fe0d579dsi17314046edz.586.2022.09.26.14.22.15; Mon, 26 Sep 2022 14:22:40 -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=@kernel-dk.20210112.gappssmtp.com header.s=20210112 header.b=nBjZ3uEO; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231176AbiIZU7A (ORCPT + 99 others); Mon, 26 Sep 2022 16:59:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230490AbiIZU67 (ORCPT ); Mon, 26 Sep 2022 16:58:59 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24C8DA0323 for ; Mon, 26 Sep 2022 13:58:58 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id j6-20020a17090a694600b00200bba67dadso8131105pjm.5 for ; Mon, 26 Sep 2022 13:58:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date; bh=YS0JM37x41Hs+Zsw/Rkr6g59/J52wo2FJJr5wT1ONS4=; b=nBjZ3uEORo02yUpAZrYg8mKa5fzhgTcxuRcisFr9M2ijvVDEATfwfbbh+th/v3mT5b 8i+JTV5VWk6P80cJBvNfKSzn9Tv6Hs8X9ubFlJtevii51MW6fq3Xqfgfo7cTxbwNETaX CGbfLx37NCo+2AnZuTIPX+8H62KX0MEftNXioQt0YPIgQGwooPKBdIFecqkyUGeuGDhM 5wdKH7Emi9oF6cp3tMYZ54IWA/JiljCOR9FZ3kYbZYo501xJtcqzaX8ZWnggCnNlS73l SoGkqrQoAtzK1VPAP0BzfO92gVv4uhRQ7pZ/Hxi8bF2YaO/HPkuR4D9U83tTwc/NAxVy 8G5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=YS0JM37x41Hs+Zsw/Rkr6g59/J52wo2FJJr5wT1ONS4=; b=jP143HwVK9XOtS7oP2lVaLfanqf2tiIJFW+Ip1FNCqEgC2JHKyO6lXwJeuyDay9Xv9 vaC+GiWzZBO5nClYnIU4d+AejLC5U6MNxDV95dPhRxwGyOFFLeKF1HJwJt4Ruu9G6gNh osf1vJ2BKsQesn+l1kijhqFKVDV8DGUMqaz/sq2MgTRDIJSrkI14O14abNpnQoPZ+a2d ADQ/ptBJGZGZYUGyxrNzM81vxVik4CSPqLsfHJobmfkg2f0zR1NqfSBVCTCCLVwR8iCX Q22D3X5s6QQRq/AgeSzAlmi1Zl54SqXBvuPuHT3R6Fi6KX4Qkvf+HwoQD80+USt3O6DJ mcTQ== X-Gm-Message-State: ACrzQf1Id/8RIOo88lfSvQ25uTd2vEzR6/qhCHJ2VZZ6Ca5kdh9KbXEC 8OB1hURAMTaHWvxSEX4ZIKrIfw== X-Received: by 2002:a17:90b:350d:b0:202:ff91:a0bd with SMTP id ls13-20020a17090b350d00b00202ff91a0bdmr728520pjb.46.1664225937638; Mon, 26 Sep 2022 13:58:57 -0700 (PDT) Received: from [192.168.1.136] ([198.8.77.157]) by smtp.gmail.com with ESMTPSA id b130-20020a621b88000000b0053e468a78a8sm12665430pfb.158.2022.09.26.13.58.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 26 Sep 2022 13:58:57 -0700 (PDT) Message-ID: <9419ed33-5df2-9c4d-ae54-07bde5e3f4ff@kernel.dk> Date: Mon, 26 Sep 2022 14:58:56 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH v2 1/3] io_uring: register single issuer task at creation To: Pavel Begunkov , Dylan Yudaken Cc: io-uring@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com References: <20220926170927.3309091-1-dylany@fb.com> <20220926170927.3309091-2-dylany@fb.com> <35d9be6b-89ca-f2a1-ce5f-53e72610db6e@gmail.com> <4623be74-d877-9042-f876-09feba2f0587@kernel.dk> <3a582199-7ee6-caf7-0314-a8a32a17b980@gmail.com> Content-Language: en-US From: Jens Axboe In-Reply-To: <3a582199-7ee6-caf7-0314-a8a32a17b980@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,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 9/26/22 2:29 PM, Pavel Begunkov wrote: > On 9/26/22 20:40, Jens Axboe wrote: >> On 9/26/22 1:12 PM, Pavel Begunkov wrote: >>> On 9/26/22 18:09, Dylan Yudaken wrote: >>>> Instead of picking the task from the first submitter task, rather use the >>>> creator task or in the case of disabled (IORING_SETUP_R_DISABLED) the >>>> enabling task. >>>> >>>> This approach allows a lot of simplification of the logic here. This >>>> removes init logic from the submission path, which can always be a bit >>>> confusing, but also removes the need for locking to write (or read) the >>>> submitter_task. >>>> >>>> Users that want to move a ring before submitting can create the ring >>>> disabled and then enable it on the submitting task. >>> >>> I think Dylan briefly mentioned before that it might be a good >>> idea to task limit registration as well. I can't think of a use >>> case at the moment but I agree we may find some in the future. >>> >>> >>> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c >>> index 242d896c00f3..60a471e43fd9 100644 >>> --- a/io_uring/io_uring.c >>> +++ b/io_uring/io_uring.c >>> @@ -3706,6 +3706,9 @@ static int __io_uring_register(struct io_ring_ctx *ctx, unsigned opcode, >>>       if (WARN_ON_ONCE(percpu_ref_is_dying(&ctx->refs))) >>>           return -ENXIO; >>>   +    if (ctx->submitter_task && ctx->submitter_task != current) >>> +        return -EEXIST; >>> + >>>       if (ctx->restricted) { >>>           if (opcode >= IORING_REGISTER_LAST) >>>               return -EINVAL; >> >> Yes, I don't see any reason why not to enforce this for registration >> too. Don't think there's currently a need to do so, but it'd be easy >> to miss once we do add that. Let's queue that up for 6.1? > > 6.1 + stable sounds ok, I don't have an opinion on how to how > to merge it. That's the plan. If you can just send it out as a separate commit, I'll stage it up behind the two others from Dylan. -- Jens Axboe