From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 482FCC433EF for ; Mon, 14 Mar 2022 10:16:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238189AbiCNKRz (ORCPT ); Mon, 14 Mar 2022 06:17:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238469AbiCNKRp (ORCPT ); Mon, 14 Mar 2022 06:17:45 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E92B3CFFD; Mon, 14 Mar 2022 03:16:34 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id 25so21051070ljv.10; Mon, 14 Mar 2022 03:16:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=g2kQQWoGvuzCNOwjCUHmsQiT1YFlZWmN+JspGoJIih0=; b=YYqjj7+S3GqSJBq9m6ML8fw6ENbwQ1C/XWkiDQj2yHu56ewmkX9IZ9vj8EVgD4OjTI WajUYxbk4LBdICy7HjinH37zpRvejN6liVIW1ZmghZSNQJIxNtRFrvRQ+BiPNrlG0B/x di/g6+ee4yxwJHTCtIyhRV8eA+iBgEBj3ACLJqmOOauRC6xi56AqL383tApYngiTD0px 7Bru39Ifrxu7bDqNkJOfYlXi3NkQUnuiz9yZJqWW7n7DiPJUhjzWYE1akrxHCnj9mZlJ 5MiP85uhjXuoTbbI7iUdFcrWlt7zVmuJeyJAMbzGSaWCZcIoNsHBG72+5DChhNlwQ03v FllA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=g2kQQWoGvuzCNOwjCUHmsQiT1YFlZWmN+JspGoJIih0=; b=sowiaAyPmyQdiq9OXPTvvX5NFRWarN2VN/HDJ1cebXON0QytZSWmEccGsPeBpz+Uez ERQmj+VPQ19nr6a+YXytUP1B3597BsiZ4xU4tnXequtlRmFvY2LeT6XdXHXgspOrKTT7 wdRqZqGOW5acwPjt8LFBagJDoUqZZwgTk3i0c/pMvawunpSBf3lYobSNWgQVsiZlRBZE 6Un11Xqnx3PfmNdMFmu0KigekGBcss2Od8DU396pL+Jj3BiNUpgxBxRtj9K1pn5VV9b4 Enj8EKM2ZrcJWRGq/nsUJdUOLmjIYGUsOt494S+FGo5VXekKmtOjVeFN8c/oy0aM3xas nG/Q== X-Gm-Message-State: AOAM530t2udKsZNIDzatoRXcrrOyL5lgnTU6nPncybr+u5NYXsFFcQfj QgMCI8aYm0jhG1FugVLGw32XtvuV1AO6Cijvnws= X-Google-Smtp-Source: ABdhPJzgJYIjQH+0jeYRbDg1V9Ghvt/wr18ldnhnYbEGosFiu3tJA4Gv3/AFX2+8vkkE+/syD1C9PBAz7mj6J7oTP/I= X-Received: by 2002:a2e:808d:0:b0:23e:f35:506b with SMTP id i13-20020a2e808d000000b0023e0f35506bmr14196580ljg.285.1647252992365; Mon, 14 Mar 2022 03:16:32 -0700 (PDT) MIME-Version: 1.0 References: <20220308152105.309618-1-joshi.k@samsung.com> <20220308152105.309618-15-joshi.k@samsung.com> <20220311065007.GC17728@lst.de> In-Reply-To: <20220311065007.GC17728@lst.de> From: Kanchan Joshi Date: Mon, 14 Mar 2022 15:46:08 +0530 Message-ID: Subject: Re: [PATCH 14/17] io_uring: add polling support for uring-cmd To: Christoph Hellwig Cc: Kanchan Joshi , Jens Axboe , Keith Busch , Pavel Begunkov , io-uring@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, sbates@raithlin.com, logang@deltatee.com, Pankaj Raghav , =?UTF-8?Q?Javier_Gonz=C3=A1lez?= , Luis Chamberlain , Adam Manzanares , Anuj Gupta Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org On Fri, Mar 11, 2022 at 12:20 PM Christoph Hellwig wrote: > > On Tue, Mar 08, 2022 at 08:51:02PM +0530, Kanchan Joshi wrote: > > + if (req->opcode == IORING_OP_URING_CMD || > > + req->opcode == IORING_OP_URING_CMD_FIXED) { > > + /* uring_cmd structure does not contain kiocb struct */ > > + struct kiocb kiocb_uring_cmd; > > + > > + kiocb_uring_cmd.private = req->uring_cmd.bio; > > + kiocb_uring_cmd.ki_filp = req->uring_cmd.file; > > + ret = req->uring_cmd.file->f_op->iopoll(&kiocb_uring_cmd, > > + &iob, poll_flags); > > + } else { > > + ret = kiocb->ki_filp->f_op->iopoll(kiocb, &iob, > > + poll_flags); > > + } > > This is just completely broken. You absolutely do need the iocb > in struct uring_cmd for ->iopoll to work. But, after you did bio based polling, we need just the bio to poll. iocb is a big structure (48 bytes), and if we try to place it in struct io_uring_cmd, we will just blow up the cacheline in io_uring (first one in io_kiocb). So we just store that bio pointer in io_uring_cmd on submission (please see patch 15). And here on completion we pick that bio, and put that into this local iocb, simply because ->iopoll needs it. Do you see I am still missing anything here? -- Kanchan