Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp317042rwb; Mon, 26 Sep 2022 12:48:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Qhtu+rnZaguhsZz7StOcIaifjzBr/l2W/r0ELOFsWjNNrlwiRW8vq2gql6Kw/AjfEeAxo X-Received: by 2002:a63:6c01:0:b0:429:ea6e:486d with SMTP id h1-20020a636c01000000b00429ea6e486dmr21033365pgc.247.1664221683046; Mon, 26 Sep 2022 12:48:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664221683; cv=none; d=google.com; s=arc-20160816; b=lOtsJCnXHv7imFm26pbxT5bNLfuNc8rGrTJ64KrraGiN9MOt9PfihOthJBbViCXHFt 0fZIwMLoOLozFQR5l9+jD/fz5B5va+QMFB8r73CO871JvhiTtABlY9tcd+BBfdtYUbeO Fbm3b9Qm9rLXZXj3DQcnQPQrfRKChgtZKB7i82OWVHk4ddE9JkV1GGkGhlLN2CEPczja G6eTkkzUXqYulXSM39/J0Gpb+IGWQTekBPGDxuNoC9OkPVOJbFW/IbSXQkZZWHyErAdM P5FIuEoMPKdnNUDIyFZwGD6GaCvetZ7Ufay9iIl7G3/bUpGBQSZN4GKrLpZy0OkoyarN Ix0g== 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 :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=j9FDUSegpM2My40Q0GYwrtXUht9x9W4KI4N0s+zvhdA=; b=GOeIYhYTTzdAgpuwO8bAeyDEtx9aAfsGoaTX0v2k4Sor0qTOMW97gW2oWu3Ovg4FuN MCpnJDyOuNaBYsnTq/e4trChE38SmYJL34tlQSCN9W6xnvVkr5MS7jkN9q9dpot5XW5I Q3H9IhNofABG3d/9aZO84mFXO+aNYxQMnIxJsNykDrcaR5fnT+bujZag4Dj8qNivBve6 IpLAZ5eFUIH6NLACuJnnWoEY8Cbu50JaK/91qE45q77U596FAPp8WYhyW5fd3xj+z4j5 asI0rOMCz1ni1YC0UyNwML92V8Kui0SBx+pLeoPnLmIcicgtPmF3x1tloIPhNeK0Bano noEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20210112.gappssmtp.com header.s=20210112 header.b=HtAla7BI; 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 oc15-20020a17090b1c0f00b001f31c65900dsi13811931pjb.150.2022.09.26.12.47.50; Mon, 26 Sep 2022 12:48:03 -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=HtAla7BI; 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 S229896AbiIZTk3 (ORCPT + 99 others); Mon, 26 Sep 2022 15:40:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbiIZTkX (ORCPT ); Mon, 26 Sep 2022 15:40:23 -0400 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 197BD3AE77 for ; Mon, 26 Sep 2022 12:40:23 -0700 (PDT) Received: by mail-il1-x12a.google.com with SMTP id g12so4074893ilj.5 for ; Mon, 26 Sep 2022 12:40:23 -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:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date; bh=j9FDUSegpM2My40Q0GYwrtXUht9x9W4KI4N0s+zvhdA=; b=HtAla7BIeUYXzMZDHVJttG0Yk3NxdOh2RPkjqtpQZpyshosbK33HTckXK7oWSC6tHh X2pVrDEFeUaR/yYNsn8l1kD8RWRODqqN6OZc1D1QJqjLvIRN69/eGJo4+EgJiNEbBTQG /CLbrHu/PVkFeyGoMeViterZDPdtHLUe9QeTSak3GFJj3MAcRPi5FzskAaN0SRhyeOgy 2nAEyW6DTfxjLEs63lf2pLuzptOpRkvMGlC5BRnYRBHzLMIv2p9A520aD1OUyyKHwyGq h0mCJmvFYQBUKl5LW9VBieMRSZHRTA/lsxj06A9Ti/QE91Pr5ws/lJzM6E8qoV+k+T0e H/ZQ== 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:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=j9FDUSegpM2My40Q0GYwrtXUht9x9W4KI4N0s+zvhdA=; b=rhXORrfJHLF6kK2RtSACt2uPcHkFxLJD0ykrFOCh+MmtBtQ2C+NpWCLsMCYmxX1QBi anZihX/oKQ1Km94gBpK2XyTL9mAMSXaTxHcJ31uiGvLmMM1WiYXiSGVgDl7+6QnphM2I HfzmgUrXwdCkGBP3B23T/sR+WSGdrNRrEJtLpUKJil4pi28qxw7jx07ebBhIHLIf3Yj9 QrjEHd8ujoM/MhIpn/VRNThseY+JROMuBFS3d1lfIskNlGOSXg25FzgTCdW7+wIfR/Z7 NYK366UVKraBk50PmjjTa/LKwaqAGNVPS9AeYeTdK0PXdiF/+ONxH+4JQMK9YpNUiW+/ 4KYQ== X-Gm-Message-State: ACrzQf0tmYtjfzHBpdeT2VRAZP6l4mBU3aC2L89iET4cRT5Lj+LAn+zI bn6pmWsPd6er7GW0Cy44RCQFlHSBZS8o2w== X-Received: by 2002:a05:6e02:12e2:b0:2f1:c14a:8a9c with SMTP id l2-20020a056e0212e200b002f1c14a8a9cmr11474915iln.267.1664221222113; Mon, 26 Sep 2022 12:40:22 -0700 (PDT) Received: from [192.168.1.94] ([207.135.234.126]) by smtp.gmail.com with ESMTPSA id x22-20020a0566380cb600b00349d33a92a2sm7510777jad.140.2022.09.26.12.40.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 26 Sep 2022 12:40:21 -0700 (PDT) Message-ID: <4623be74-d877-9042-f876-09feba2f0587@kernel.dk> Date: Mon, 26 Sep 2022 13:40:20 -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 Content-Language: en-US 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> From: Jens Axboe In-Reply-To: <35d9be6b-89ca-f2a1-ce5f-53e72610db6e@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=unavailable 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 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? -- Jens Axboe