Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp395512iog; Thu, 30 Jun 2022 02:58:50 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uQidCQcT5pHyyIU9Z2Z16ICRVKPYkcmQS7ZgVDsFs7hHQXT9exR2T89jomIsp+of5pbJhR X-Received: by 2002:a17:90b:1bc7:b0:1ee:ffbf:95ad with SMTP id oa7-20020a17090b1bc700b001eeffbf95admr11346668pjb.37.1656583129996; Thu, 30 Jun 2022 02:58:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656583129; cv=none; d=google.com; s=arc-20160816; b=HmxKyu/adHRNw9H5VHrehj2Bx8C8dOYTQIHN34LOTWcUm6sQGX4pEpmjKCxlhoE3Us Vn6XsKGPckHmbGPA0VtzL7/9aorGPi78bdPg+x+j3ZetKB4dfS5Cs1ItXZrdx7X1Kq5E XUXOqd69hCNprRDLrBhY8aMQIusABkzIJxfArs5atf+5+io1bmEdvnnJEdNCLaQZFee2 GyZ8TVSnWJi5rtOXZ2BOAKJSwmUwwH6ux50oryqPH9h8Mzlc9+wUhyx/T6ASP/lFPUrA u0HVCArxmxgTYbOhOEZxEJvuDsIWv02zjo+gQod5S8lWeZYx9Zvxp0hcXsShUAiNIHg+ tqYg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SdW4wVZNo3Qp5TN8YXy0QPxjj9g/Gcv3VdgPGQjq61c=; b=mpwjYJBcC/7xXiYh0C7aFzQZxJ0jFxBuU/hhclSnADC2m6ujaoXSPwpiAO8G3DaDJ+ LDc5B6bP3fnw8D/OVvyRkhQoKniwdSi6pWRzxwMWMefFd31cAoJy71V5Q1etP5ePGkfK zloiHBo/6mka6BCQ9wyn30PCvVhnlatxdlgv/BlqyjATyvd1LaDHp4zeKTvZOS1aK+ZA 0A+O8gI3C1hdL1tiHX6nA75DjtL0iF3GsZdpVYK6CbU/zvaZKGTkoiNbiIofDcuSn1Qt uhbKd/pSs8Xz6MCuxQqz3FILfzPQgqTHJturLfxOSromnknv6FI41fqz7qGYntn7TSjK iYOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fb.com header.s=facebook header.b=Qgfmn4ov; 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=REJECT sp=REJECT dis=NONE) header.from=fb.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mn23-20020a17090b189700b001e345e5d5a3si6146611pjb.21.2022.06.30.02.58.38; Thu, 30 Jun 2022 02:58:49 -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=@fb.com header.s=facebook header.b=Qgfmn4ov; 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=REJECT sp=REJECT dis=NONE) header.from=fb.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234160AbiF3JO5 (ORCPT + 99 others); Thu, 30 Jun 2022 05:14:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234084AbiF3JOZ (ORCPT ); Thu, 30 Jun 2022 05:14:25 -0400 Received: from mx0b-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75C451F2E1 for ; Thu, 30 Jun 2022 02:14:24 -0700 (PDT) Received: from pps.filterd (m0148460.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25U7UOeF006589 for ; Thu, 30 Jun 2022 02:14:23 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=facebook; bh=SdW4wVZNo3Qp5TN8YXy0QPxjj9g/Gcv3VdgPGQjq61c=; b=Qgfmn4ov32UcWuHtbt5Y83qjLJmhz1nd/HsUtH/IqPOU/nAL0e+NSlO6qJF9il7d4B6L 7Peaffv7E+iYhQ4xR/nAi7WZjK4CGxdzW1ShuP0OoNb4NFxKet1ymIdJmI6zCPoO+cT1 O/cS9lIl/aqE88IwHLmvZwP45yR3XL8yNas= Received: from maileast.thefacebook.com ([163.114.130.16]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3h17gerfs6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 30 Jun 2022 02:14:23 -0700 Received: from twshared5640.09.ash9.facebook.com (2620:10d:c0a8:1b::d) by mail.thefacebook.com (2620:10d:c0a8:82::f) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Thu, 30 Jun 2022 02:14:22 -0700 Received: by devbig038.lla2.facebook.com (Postfix, from userid 572232) id 935A62599FD0; Thu, 30 Jun 2022 02:14:08 -0700 (PDT) From: Dylan Yudaken To: Jens Axboe , Pavel Begunkov , CC: , , Dylan Yudaken Subject: [PATCH v2 for-next 02/12] io_uring: restore bgid in io_put_kbuf Date: Thu, 30 Jun 2022 02:12:21 -0700 Message-ID: <20220630091231.1456789-3-dylany@fb.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220630091231.1456789-1-dylany@fb.com> References: <20220630091231.1456789-1-dylany@fb.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-FB-Internal: Safe Content-Type: text/plain X-Proofpoint-ORIG-GUID: OqimZxVwaq_LA2wlA01Y1yvTvMuuiB07 X-Proofpoint-GUID: OqimZxVwaq_LA2wlA01Y1yvTvMuuiB07 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-06-30_05,2022-06-28_01,2022-06-22_01 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 Attempt to restore bgid. This is needed when recycling unused buffers as the next time around it will want the correct bgid. Signed-off-by: Dylan Yudaken --- io_uring/kbuf.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/io_uring/kbuf.h b/io_uring/kbuf.h index 3d48f1ab5439..d9adedac5e9d 100644 --- a/io_uring/kbuf.h +++ b/io_uring/kbuf.h @@ -96,16 +96,21 @@ static inline void io_kbuf_recycle(struct io_kiocb *r= eq, unsigned issue_flags) static inline unsigned int __io_put_kbuf_list(struct io_kiocb *req, struct list_head *list) { + unsigned int ret =3D IORING_CQE_F_BUFFER | (req->buf_index << IORING_CQ= E_BUFFER_SHIFT); + if (req->flags & REQ_F_BUFFER_RING) { - if (req->buf_list) + if (req->buf_list) { + req->buf_index =3D req->buf_list->bgid; req->buf_list->head++; + } req->flags &=3D ~REQ_F_BUFFER_RING; } else { + req->buf_index =3D req->kbuf->bgid; list_add(&req->kbuf->list, list); req->flags &=3D ~REQ_F_BUFFER_SELECTED; } =20 - return IORING_CQE_F_BUFFER | (req->buf_index << IORING_CQE_BUFFER_SHIFT= ); + return ret; } =20 static inline unsigned int io_put_kbuf_comp(struct io_kiocb *req) --=20 2.30.2