From patchwork Wed Oct 19 08:35:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5001 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp229011wrs; Wed, 19 Oct 2022 02:54:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ppxsBSQBoW7V0UNzEC9ZC1i4H//pBt5n4mycsOxnMno8d7WnncmxvF2O/DoROc6jLJCe3 X-Received: by 2002:a63:5d4e:0:b0:41d:dcc3:aa85 with SMTP id o14-20020a635d4e000000b0041ddcc3aa85mr6410117pgm.324.1666173241610; Wed, 19 Oct 2022 02:54:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666173241; cv=none; d=google.com; s=arc-20160816; b=s/YpxUlBAZVti+qFenIUz6d0Fze0lrHK6PR2RoXYnTNcrvHZOD4Z80DpxR099vUxtq 22NS56a8I4kMwWfXXQKXYIftw4AYO3wxCQ8+wF+z0RevpNFSyvodhbnW0R5RybH2bWrq uMVTXBrM4v6WaJI9f8DAoq/Vh0M5/mK6pcb5syamZkKw9aIa6DtIqltMH12QKqScTDe/ 6uAswQ5ujzpKQYO4LFb8TwKCQRxrA4+TGF6Zl2CJwjXz5wR+Op95RSI8Gfn+oEsOnwM0 IbMd+mnZoFh4vhJYA9oRUr/yncTuGc6XTbFbk5FboywQvhOpmcvlYe593BOFs3xuvg+t zGjA== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=q7nA9IVWl361R5KiY1R0XaqbDId0OUi6Dnq5RGVAyws=; b=cmPEtmoEEKryZloBSXTXLyMc18PgQqUUxDNbBwXemXNwv4jEo2A8W8KA1ineoFeCU4 SMz3RsJ3+gv4/Fggo9uFaFYfNH2JIq+ySo/v7bqdrOa3+E4umE7kGQi2vqYKMFYPMALw Nuaj+Bs6OI3dFMOQwrOP2+3a/7xXimQ+aWJoHgz89ioawv5h8wwIptXo1AH+B3Z/zIYv Pnm/Fl94VZ1CqhBHboqB2RdduhzZLvgEFbQKVlirh1JNh/xALR/p/m0CiBd3BIuJWu7F HreO2AC8Acn2o0nJM6aM82fW8qViJmwC5wl4cHFTdGJKdZ4Mgy3+7tkv6aMuYDSrSfsV gPqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LsqaxDul; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q18-20020a631f52000000b0043447486c84si17616616pgm.875.2022.10.19.02.53.48; Wed, 19 Oct 2022 02:54:01 -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=@linuxfoundation.org header.s=korg header.b=LsqaxDul; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234370AbiJSJqG (ORCPT + 99 others); Wed, 19 Oct 2022 05:46:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235165AbiJSJmX (ORCPT ); Wed, 19 Oct 2022 05:42:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A9DC13D50; Wed, 19 Oct 2022 02:19:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 16B6B61826; Wed, 19 Oct 2022 09:15:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BBA7C433C1; Wed, 19 Oct 2022 09:15:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170951; bh=furww8hO+9bHJEvRn56IiQow58Lk26dZ+/cLHdxJFq8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LsqaxDulwYNQKiHFlDg78rv9Td3L8OqOVhkDNIkOD9iN6F7hdNFfQwpb/kVeu9oIY rHyGWBeJIjPZn8z9nOUwFde1/PkYOEFt2ivOoL2mMgumpEVYeR4rA0Se7an7RMWK/6 WEtPyMpt8k/Nza+V0uQeEe3fjV2bbIS9nMHvmb0M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Pavel Begunkov , Jens Axboe Subject: [PATCH 6.0 847/862] io_uring/net: fix notif cqe reordering Date: Wed, 19 Oct 2022 10:35:34 +0200 Message-Id: <20221019083327.298431964@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747109272947784237?= X-GMAIL-MSGID: =?utf-8?q?1747109272947784237?= From: Pavel Begunkov [ upstream commit 108893ddcc4d3aa0a4a02aeb02d478e997001227 ] send zc is not restricted to !IO_URING_F_UNLOCKED anymore and so we can't use task-tw ordering trick to order notification cqes with requests completions. In this case leave it alone and let io_send_zc_cleanup() flush it. Cc: stable@vger.kernel.org Fixes: 53bdc88aac9a2 ("io_uring/notif: order notif vs send CQEs") Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/0031f3a00d492e814a4a0935a2029a46d9c9ba06.1664486545.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/net.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/io_uring/net.c +++ b/io_uring/net.c @@ -1073,8 +1073,14 @@ int io_send_zc(struct io_kiocb *req, uns else if (zc->done_io) ret = zc->done_io; - io_notif_flush(zc->notif); - req->flags &= ~REQ_F_NEED_CLEANUP; + /* + * If we're in io-wq we can't rely on tw ordering guarantees, defer + * flushing notif to io_send_zc_cleanup() + */ + if (!(issue_flags & IO_URING_F_UNLOCKED)) { + io_notif_flush(zc->notif); + req->flags &= ~REQ_F_NEED_CLEANUP; + } io_req_set_res(req, ret, IORING_CQE_F_MORE); return IOU_OK; }