Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3752027pxb; Fri, 4 Feb 2022 15:56:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJyW3wBeLTPC+wXUvx3wz6XhdDh5xcrRU7aAtFNN3ySGSK1tJIz5CNLRN4cVL3Xi1iKHV4g1 X-Received: by 2002:a17:906:498b:: with SMTP id p11mr1085414eju.119.1644019013245; Fri, 04 Feb 2022 15:56:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644019013; cv=none; d=google.com; s=arc-20160816; b=rKTCoipJiTbd5FtESnkUxB6YeDuGvQr6K+TWlQ5f+NDcV+v/TBOH8oml0W8pa/MKma d5kt5BO4M3nSsY+4xPl/6tEbW4lk6JVupSrZb6Bn0eCnl0/DXYYAAgaVAyUbMR2ePTf1 +BdeeJc+GT49bmZE6/z8O5EE8x48J0SmLB9b9MwdE2BiEYMOdG2LYm1HhPW25hBfcllK JIpb/+WLIS7XkPb4HDr0hYor1NEnIdmMr++9fSo5Fu34bvj3DSztusen7yqWakHmdX0E jPYtNAwWLPEAZyyAvnjAHPiugBZDz9f3tEWEk46lPeVKk04dWbpxqotQ0GrySEmHZrTf jUyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=isPf5pWODhchjIdDKRlZ9sM1phUTccItVZeEeb/fnXY=; b=gq162Sexm9psBh1xriuwgCRx4HUihrWDzF+DihVsIPgL978IAUYo7Ca846fMYa3esS 0JDhFKb/Rpx3J00m/Pd0I07OAXmnRfLshVIwfcPYqBrGmKgcBfW7QmU9NVCBnfEmdfDT uQwVSPyeTBLJ9bwmorTDBOO9wtTK2LyoPcrb4E4Cym3f2kkvov9bumKANMn+2HpvQJy4 /4IZsA5/zJa5EnIayiq6VchnfkQnC65/UpHcZbn8MXIgIMpPp/lgf/GHtcZ7AAvlNj7m JSCxTfSbjMLXdibpEeuEHF9ktYLT4UaYa3I5uYeZOlOIu5rgl1EDD/kxd3cfFHJ5uar4 Trpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20210112.gappssmtp.com header.s=20210112 header.b=D7jDz68U; 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 mp19si2205600ejc.260.2022.02.04.15.56.28; Fri, 04 Feb 2022 15:56:53 -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-dk.20210112.gappssmtp.com header.s=20210112 header.b=D7jDz68U; 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 S1353674AbiBCTGn (ORCPT + 99 others); Thu, 3 Feb 2022 14:06:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353659AbiBCTGm (ORCPT ); Thu, 3 Feb 2022 14:06:42 -0500 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7349FC061714 for ; Thu, 3 Feb 2022 11:06:42 -0800 (PST) Received: by mail-il1-x12e.google.com with SMTP id y17so2967609ilm.1 for ; Thu, 03 Feb 2022 11:06:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20210112.gappssmtp.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=isPf5pWODhchjIdDKRlZ9sM1phUTccItVZeEeb/fnXY=; b=D7jDz68UbCjuXRZlBndHn5VO13XZykRc3DLEpq1uPy6gQiCKc0jx2Ak5WwcImSAQxt LxSkd64B1PHKCYGyZzJgGvupZOLP4cVWmNj994YNRInDu0cgfC2PDhW8aSE6a8hc6oyd ocbFLphQiveV+HpIfiprfDGY8bbwZLpkSxA/DL6ePXpx/DYAjc0/tGAbgX1gp9ih+FaB 1bqnicW2JfvZM9XI61PP1YB0pn+n+Ij6txwcXjDPfpUErnL6PvjUPYbQlJt2RtLbgmHx mwVKsUO3Aoz3xmt9ePwbVuR+k4pL0ygM/nqq3RHbzkeG3l7Sh/GCNDAgzyEN4GZ4mx3E vagw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=isPf5pWODhchjIdDKRlZ9sM1phUTccItVZeEeb/fnXY=; b=zt7SmCauqGK6xDVc0KuXs3n+xsMpvnZzT+lDpi44w4p5ufyFvQ+yl10wJvEziZY9Pc FvQp7sMqAmcs9pHOCMWToQH8iaW9jbGDKH6iZF8Abison+4thxknZpJGQdizaLKOQnBE +pOQhy0/pqgxuXv2X4jjqUnL/7e3sIOce21CmmZvP78awKsKp/BxZDCTIahT9aoT0Tps C72f0If/5LL1tIzdlV0EqDjDpS5U2/53BTmVu7TnIk8xveQjvOAaQZYMALRFw3Zmv1io U70wCkzotCgXTRjvgFLf1oAK11hlfqLNnAh8mYZB33iYNpLKrqg0nBIQxvP2Gu+Hm7Ho Uj3w== X-Gm-Message-State: AOAM5338E3a3hvRXpIWSA2jQFxfVva3TKjnTDPrp/qgAiWXapV2Vop4/ s+JGvt1iqtprtO+u02BnlTS3vGfCb8IhZg== X-Received: by 2002:a05:6e02:1887:: with SMTP id o7mr6090806ilu.128.1643915201895; Thu, 03 Feb 2022 11:06:41 -0800 (PST) Received: from [192.168.1.30] ([207.135.234.126]) by smtp.gmail.com with ESMTPSA id f13sm22754536ion.18.2022.02.03.11.06.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Feb 2022 11:06:41 -0800 (PST) Subject: Re: [External] Re: [PATCH v3 2/3] io_uring: avoid ring quiesce while registering/unregistering eventfd To: Pavel Begunkov , Usama Arif , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org Cc: fam.zheng@bytedance.com References: <20220203174108.668549-1-usama.arif@bytedance.com> <20220203174108.668549-3-usama.arif@bytedance.com> <877d54b9-5baa-f0b5-23fe-25aef78e37c4@bytedance.com> From: Jens Axboe Message-ID: Date: Thu, 3 Feb 2022 12:06:40 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/3/22 12:00 PM, Pavel Begunkov wrote: > On 2/3/22 18:29, Jens Axboe wrote: >> On 2/3/22 11:26 AM, Usama Arif wrote: >>> Hmm, maybe i didn't understand you and Pavel correctly. Are you >>> suggesting to do the below diff over patch 3? I dont think that would be >>> correct, as it is possible that just after checking if ctx->io_ev_fd is >>> present unregister can be called by another thread and set ctx->io_ev_fd >>> to NULL that would cause a NULL pointer exception later? In the current >>> patch, the check of whether ev_fd exists happens as the first thing >>> after rcu_read_lock and the rcu_read_lock are extremely cheap i believe. >> >> They are cheap, but they are still noticeable at high requests/sec >> rates. So would be best to avoid them. >> >> And yes it's obviously racy, there's the potential to miss an eventfd >> notification if it races with registering an eventfd descriptor. But >> that's not really a concern, as if you register with inflight IO >> pending, then that always exists just depending on timing. The only >> thing I care about here is that it's always _safe_. Hence something ala >> what you did below is totally fine, as we're re-evaluating under rcu >> protection. > > Indeed, the patch doesn't have any formal guarantees for propagation > to already inflight requests, so this extra unsynchronised check > doesn't change anything. > > I'm still more сurious why we need RCU and extra complexity when > apparently there is no use case for that. If it's only about > initial initialisation, then as I described there is a much > simpler approach. Would be nice if we could get rid of the quiesce code in general, but I haven't done a check to see what'd be missing after this... -- Jens Axboe