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 X-Spam-Level: X-Spam-Status: No, score=-7.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17567C433E0 for ; Fri, 5 Mar 2021 10:41:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C4A2564FF0 for ; Fri, 5 Mar 2021 10:41:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229611AbhCEKkx (ORCPT ); Fri, 5 Mar 2021 05:40:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229597AbhCEKkw (ORCPT ); Fri, 5 Mar 2021 05:40:52 -0500 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 799B3C061574 for ; Fri, 5 Mar 2021 02:40:49 -0800 (PST) Received: by mail-wr1-x431.google.com with SMTP id e10so1503644wro.12 for ; Fri, 05 Mar 2021 02:40:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=H95xvo9vQWpBEjEoM4WW8sLMHdulWjpm44uHAKvsKSE=; b=QtBqNgGK1tiNxAChBsd1aMaBD1tQwbJY/Y01r4QpFdNzSwhEdTAFrNcdOSfnN+mpSd HACc/kmLxu3a/1obQ4GecNWSU1EhumLdaj2ZboTieVoSzTIhP0ect1Zgm92jxdKEfgFR EYqqy6mjj8fFr7XeaPzjBRZZ8ezGvaNEj3G9Jpzt/drD0zztzsjoHuUYsbGMGpeLMtH8 nWstmcT4DgvF7tTutcvIS6P5fZfuft3R1W4fhXXWkasnuSCMUMs1ewiR824mFUYwANyL 7a9YrGCzFSmOiRqG2ceI2MDSKRi5PcUYAFgfHJH9mYtkptflumP1DXFaiKMvDWX3Pxsy XkWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=H95xvo9vQWpBEjEoM4WW8sLMHdulWjpm44uHAKvsKSE=; b=buBYKGExNfQ0VCExve6++GrKfDDiz+DuGjmwtwpGPZG0YNHBW3iSkbwnQreLbij985 nMyyh586rBC/TsjsS/AOOvIs6B+w9uUVWB/kUPxnkfiVALW52oegI4Cd/FUhVWZwWwXK wKBd3tuyhvdyoyvF+zUatUiwZAWCU0hAJgZYjXCy9+aiIRdeoBF25FO75loSAPEnkSNw UTyXlpjDKFKaO8q55IOVG0C3dh0QEbRzNK73CGC4V1QCHe43fI+f/GkNhP4LGZ9QU7Hk lJ6VKRe+nuihSPPxW7CSpEX/7cwf0h1oCjCADw3+uerQxUUBZBnutsa1sfT6x/yXBIev 2bYA== X-Gm-Message-State: AOAM531rUkyMpWwlz3HCQvu9IZ5BryQGMYqGLGZ7gxFtS+jt7A+jvLCI PK/hVv63ypmLAk5XR1owvGQzaYB2YVzHBCye2iA= X-Google-Smtp-Source: ABdhPJzPG/VE3eG4qnhLsT5LJ0GWlh20Mud+oLZU78uOjs5eDa1trxFOV58DpuC8BivumJPHjM2SwFudyifiDA5Db4E= X-Received: by 2002:a5d:56d0:: with SMTP id m16mr8473834wrw.355.1614940848299; Fri, 05 Mar 2021 02:40:48 -0800 (PST) MIME-Version: 1.0 References: <20210302160734.99610-1-joshi.k@samsung.com> <20210302160734.99610-3-joshi.k@samsung.com> In-Reply-To: From: Kanchan Joshi Date: Fri, 5 Mar 2021 16:10:22 +0530 Message-ID: Subject: Re: [RFC 2/3] nvme: passthrough helper with callback To: Chaitanya Kulkarni Cc: Kanchan Joshi , "axboe@kernel.dk" , "hch@lst.de" , "kbusch@kernel.org" , "io-uring@vger.kernel.org" , "linux-nvme@lists.infradead.org" , "anuj20.g@samsung.com" , "javier.gonz@samsung.com" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org On Fri, Mar 5, 2021 at 9:44 AM Chaitanya Kulkarni wrote: > > On 3/4/21 03:14, Kanchan Joshi wrote: > > On Wed, Mar 3, 2021 at 8:52 PM Chaitanya Kulkarni > > wrote: > >> On 3/2/21 23:22, Kanchan Joshi wrote: > >>> -void nvme_execute_passthru_rq(struct request *rq) > >>> +void nvme_execute_passthru_rq_common(struct request *rq, > >>> + rq_end_io_fn *done) > >>> { > >>> struct nvme_command *cmd = nvme_req(rq)->cmd; > >>> struct nvme_ctrl *ctrl = nvme_req(rq)->ctrl; > >>> @@ -1135,9 +1136,17 @@ void nvme_execute_passthru_rq(struct request *rq) > >>> u32 effects; > >>> > >>> effects = nvme_passthru_start(ctrl, ns, cmd->common.opcode); > >>> - blk_execute_rq(disk, rq, 0); > >>> + if (!done) > >>> + blk_execute_rq(disk, rq, 0); > >>> + else > >>> + blk_execute_rq_nowait(disk, rq, 0, done); > >>> nvme_passthru_end(ctrl, effects); > >> This needs a detailed explanation in order to prove the correctness. > > Do you see something wrong here? > > blk_execute_rq() employs the same helper (i.e. nowait one) and uses > > additional completion-variable to make it sync. > > > > There is no gurantee that command will finish between call to > blk_execute_rq_nowait() > and nvme_passthru_end() is there ? Got your concern now, thanks for elaborating. I will move the passthru_end to when completion actually occurs, and get it processed via workqueue. And perhaps I should send a micro-optimization patch which will call passthru_end only for non-zero command-effects. Currently we do three checks.