Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5684134pxj; Wed, 23 Jun 2021 06:54:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxO2gdBpE295h0Fl1S2OwiNp3Fov+T+lvhWsyvPolJAVT8tGTzDla59HsQMbSuabWVQwGHu X-Received: by 2002:a5e:d512:: with SMTP id e18mr7278781iom.149.1624456454272; Wed, 23 Jun 2021 06:54:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624456454; cv=none; d=google.com; s=arc-20160816; b=THbi1DTjMIMkhPI21Ng3cdP3GroXLZ4DBp8FfzOEk9tUchcI7LQXQPmkT1ZIh93i/x e/Lez5ghZ3sUDFRSt27M/msMQCMsabza0T4UPk1aNzNaW9fUHTr98dzdunrL/2SbeKfz 1irWBU6LQbmV8ZswVL1JmwgbIU/aB4QJE35moBicSF4WbwyOKmUkOy9trTXU0t6di9gP W2PJsfNYjiWKbH/oOhyEmEMox/vymfzm4buMEA5IPKARZzjM6+J1OBA9dK+liRLVKLEH 5x1bQxsOBOXn7iUW+ImksVBkfMsw2lLsAPfacBgI+IvK9pEboBi66JAfmYSVivfeZSj/ brUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:organization:references:in-reply-to:date:to:from:subject :message-id; bh=xj5vR3acdqcdsU1Vj9L4wQrIhelEW4zUioqir68oRCQ=; b=Tj9r1YPR9Rxp6+YzNGeCYCfjKNFY3yBy2kGnS/ocmI8h1AVdS3WhALyK3JnSWWMGZ9 IuGmO/xiBFRcqRsrJMe6JgJhORhBm408FcAwhAIr5MEwQsGrQHN7Od7BYVa1aQ9CM4Tq ri8l4AXIinTXAFGoXK+pn6G+JSxq4kLhIW4d1Hb18HjEHMBntChMtiruJV2QrnMoyKDJ z/soNCWcebqM2jYn5uWkwwYotx+UN2Hl1+jw1cMl3DWzMFhLDqtMiPwdLMQZBVdYsnDS PgPVnGoNUNbBQKA+4hcAORE0qABKeGfeA/Thry6xWhhfX5f9W2wfxMLTmS6f6qLxtJHj Aw/g== 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 q10si20876090ilu.60.2021.06.23.06.54.02; Wed, 23 Jun 2021 06:54:14 -0700 (PDT) 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 S230449AbhFWNzO (ORCPT + 99 others); Wed, 23 Jun 2021 09:55:14 -0400 Received: from cloud48395.mywhc.ca ([173.209.37.211]:37922 "EHLO cloud48395.mywhc.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230182AbhFWNzN (ORCPT ); Wed, 23 Jun 2021 09:55:13 -0400 Received: from modemcable064.203-130-66.mc.videotron.ca ([66.130.203.64]:33544 helo=[192.168.1.179]) by cloud48395.mywhc.ca with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1lw3JG-0005gz-KD; Wed, 23 Jun 2021 09:52:54 -0400 Message-ID: Subject: Re: [PATCH 1/2 v2] io_uring: Fix race condition when sqp thread goes to sleep From: Olivier Langlois To: Pavel Begunkov , Jens Axboe , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 23 Jun 2021 09:52:53 -0400 In-Reply-To: <2603ffd4-c318-66ed-9807-173159536f6a@gmail.com> References: <67c806d0bcf2e096c1b0c7e87bd5926c37231b87.1624387080.git.olivier@trillion01.com> <60d23218.1c69fb81.79e86.f345SMTPIN_ADDED_MISSING@mx.google.com> <169899caad96c3214d6e380ac7686d054eed3b12.camel@trillion01.com> <2603ffd4-c318-66ed-9807-173159536f6a@gmail.com> Organization: Trillion01 Inc Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.40.2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cloud48395.mywhc.ca X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - trillion01.com X-Get-Message-Sender-Via: cloud48395.mywhc.ca: authenticated_id: olivier@trillion01.com X-Authenticated-Sender: cloud48395.mywhc.ca: olivier@trillion01.com X-Source: X-Source-Args: X-Source-Dir: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2021-06-23 at 00:03 +0100, Pavel Begunkov wrote: > On 6/22/21 11:42 PM, Olivier Langlois wrote: > > On Tue, 2021-06-22 at 18:37 -0400, Olivier Langlois wrote: > > > On Tue, 2021-06-22 at 21:45 +0100, Pavel Begunkov wrote: > > > > > > > > > I can do that if you want but considering that the function is > > > inline > > > and the race condition is a relatively rare occurence, is the > > > cost > > > coming with inline expansion really worth it in this case? > > > > > > On hand, there is the inline expansion concern. > > > > OTOH, the benefit of going with your suggestion is that completions > > generally precedes new submissions so yes, it might be better that > > way. > > > > I'm really unsure about this. I'm just raising the concern and I'll > > let > > you make the final decision... > > It seems it may actually loop infinitely until it gets a signal, > so yes. And even if not, rare stalls are nasty, they will ruin > some 9s of latency and hard to catch. > > That part is quite cold anyway, would generate some extra cold > instructions, meh > I'm not 100% sure to see the infinite loop possibility but I guess that with some badly placed preemptions, it could take few iterations before entering the block: if (sqt_spin || !time_after(jiffies, timeout)) { So I will go ahead with your suggestion. I'll retest the new patch version (it should be a formality) and I'll resend an update once done. Greetings,