Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3154871pxk; Mon, 7 Sep 2020 05:00:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwD5Vkv/cCgLkuEHmF4B/NtfJ4pzggsNoXNqf/9sMxsf6VM/YfS0cH9i3I5k9djyyi1kjjh X-Received: by 2002:a17:906:4305:: with SMTP id j5mr21538951ejm.102.1599480053771; Mon, 07 Sep 2020 05:00:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599480053; cv=none; d=google.com; s=arc-20160816; b=QiWTy43yuy5isyVzTX2cw+GBsYMZJe3GQBi1yDooJFarLDQoSJNeUmJCs8RFJMrUU5 C9d3DyNJN4pDySTrg8RCKdfIk7tnal5Vq5ARAZ2M+gR/p5FeAuwAie3Z1weWnq/GPaYp KIS2SYMW/BESCGJLn2OMueuVhZP7dUcIuW2u3WtzN5O0Abb/vGH2wALy8RomxLRxgbiA EHoJTvsmOYKY2iqtt7IgrKVC8Vh4Cr1wtCkCnZs2Uh0lsoD4u/OKI+LNirbq6NVXN4Av 1hE0FB7n+snKJwSTEfAs67BgR11jn3hwKkVsOMlclv0RJ7KnoQhmITmVkoNNPSB3kCDz T05w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=OR+grx7rkHafCDDiGBz5vMeFbMGhU5jA0sq+dJevcqs=; b=xuswoKjO2Qphky0B0v6kViQlGZcb1XlPkdzIucNEzGM8Kuxsw4Z2I6GDHxp52NubDA aMl0IswmZx/KU2jBp69HjCrMOqOFg75PuP2U9rXtR67g5e3G1t88rgsooHoM7x2WjKZ1 86ulM1sIb36y1Ow6zKXj6g98qT6PCvuYp7z2xo/SF7fK/P43V3NkTOI9fvpwOXtK+Vlr DoD9he/nkkgrHlmEqrn4ezRIHKblFZSqhz1MkgzLRb0Ny7hRna+UoWH1t/onUmQZZiZ3 xVxjtH77R4ocMl6gbTeAmOgm773qvTCZpcToj5dAf3rGpv62NO7ruLrSrGSY+ePrSn0C xmTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=H3Ae1sQM; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gj3si9684575ejb.728.2020.09.07.05.00.31; Mon, 07 Sep 2020 05:00:53 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=H3Ae1sQM; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729178AbgIGL4s (ORCPT + 99 others); Mon, 7 Sep 2020 07:56:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728459AbgIGLzk (ORCPT ); Mon, 7 Sep 2020 07:55:40 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7E0BC061573 for ; Mon, 7 Sep 2020 04:54:46 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id w2so14116540wmi.1 for ; Mon, 07 Sep 2020 04:54:46 -0700 (PDT) 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=OR+grx7rkHafCDDiGBz5vMeFbMGhU5jA0sq+dJevcqs=; b=H3Ae1sQMU3QDMtnyX3+xZtz6s1GPf3SQJ48vMHTrvOqN0P90Bi8at73uXh4Hg13jk3 /o9/3Z1EuejT24OKfqp7aLZnu9lsD9zjP029koxPH7CiWyO11KFnw5CrRCav9GL3VJ8y 35ReUrwanHemCx5mhqF0M22pBQYwq1IYvogw2EZfEp9YyvM95JkR+z9QQ7fJlRJ8+QfN yFDqcFdOCeQfigpb9NgvSaySzkZhGa7WVY4oItULB45o+jmw140QknPxxx8N+9EnUH08 lEAsQ3kP8j6YqWDaf4ETVXWNh8czD0XwxQluGOytQe9Sdp2s0bD8G32b38Eh9ojVa8Bf OPTw== 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=OR+grx7rkHafCDDiGBz5vMeFbMGhU5jA0sq+dJevcqs=; b=WLWdQ4Z9Ps+JbI8BZKXy4r6bmR6w9uNVWmy4K4Bqs94dRai2PB2I/0I8MVEorg22V6 lCJk447uD0RHVJt8bUjPJNYILJQZZFCXA+Rmc/c0Pi8WZUuHqDfrpgU2aIRt1m9tepwx JwxLqIOCJI6RKnYVu+0lJVmDmob+UX4mK/UmbosCZbNnMdGmaOv+6+am4SnSV0X+xThH dk2ZKSrG8ABVryHpt/9Uui2s8C1xRbA8oxutDtqaPD9uh6XKpJRoqBTak37WVIUamqNn aStq3ZunrVlR3bJ/1sbVZAzN1yrCPY9ttsrb8X/Xi6KbzmcYUyuRWvrAmzPuLjpY56+f PLmA== X-Gm-Message-State: AOAM531tY6Rc142ErqrkQcmp8wEAkdxKZ6Do8uEzF08frqHE2pX1r9th Sw7jktz1vhCykO6+ZnsmwhgO4JTOfCpIa58YI3M= X-Received: by 2002:a7b:c384:: with SMTP id s4mr19558190wmj.138.1599479684792; Mon, 07 Sep 2020 04:54:44 -0700 (PDT) MIME-Version: 1.0 References: <20200818052936.10995-1-joshi.k@samsung.com> <20200818052936.10995-2-joshi.k@samsung.com> <20200818071141.GA2544@lst.de> In-Reply-To: From: Kanchan Joshi Date: Mon, 7 Sep 2020 17:24:18 +0530 Message-ID: Subject: Re: [PATCH 1/2] nvme: set io-scheduler requirement for ZNS To: Damien Le Moal Cc: Christoph Hellwig , Kanchan Joshi , Jens Axboe , "sagi@grimberg.me" , Johannes Thumshirn , "linux-kernel@vger.kernel.org" , "linux-nvme@lists.infradead.org" , Keith Busch , Selvakumar S , Javier Gonzalez , Nitesh Shetty Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 7, 2020 at 5:07 PM Damien Le Moal wrote: > > On 2020/09/07 20:24, Kanchan Joshi wrote: > > On Mon, Sep 7, 2020 at 1:52 PM Damien Le Moal wrote: > >> > >> On 2020/09/07 16:01, Kanchan Joshi wrote: > >>>> Even for SMR, the user is free to set the elevator to none, which disables zone > >>>> write locking. Issuing writes correctly then becomes the responsibility of the > >>>> application. This can be useful for settings that for instance use NCQ I/O > >>>> priorities, which give better results when "none" is used. > >>> > >>> Was it not a problem that even if the application is sending writes > >>> correctly, scheduler may not preserve the order. > >>> And even when none is being used, re-queue can happen which may lead > >>> to different ordering. > >> > >> "Issuing writes correctly" means doing small writes, one per zone at most. In > >> that case, it does not matter if the block layer reorders writes. Per zone, they > >> will still be sequential. > >> > >>>> As far as I know, zoned drives are always used in tightly controlled > >>>> environments. Problems like "does not know what other applications would be > >>>> doing" are non-existent. Setting up the drive correctly for the use case at hand > >>>> is a sysadmin/server setup problem, based on *the* application (singular) > >>>> requirements. > >>> > >>> Fine. > >>> But what about the null-block-zone which sets MQ-deadline but does not > >>> actually use write-lock to avoid race among multiple appends on a > >>> zone. > >>> Does that deserve a fix? > >> > >> In nullblk, commands are executed under a spinlock. So there is no concurrency > >> problem. The spinlock serializes the execution of all commands. null_blk zone > >> append emulation thus does not need to take the scheduler level zone write lock > >> like scsi does. > > > > I do not see spinlock for that. There is one "nullb->lock", but its > > scope is limited to memory-backed handling. > > For concurrent zone-appends on a zone, multiple threads may set the > > "same" write-pointer into incoming request(s). > > Are you referring to any other spinlock that can avoid "same wp being > > returned to multiple threads". > > Checking again, it looks like you are correct. nullb->lock is indeed only used > for processing read/write with memory backing turned on. > We either need to extend that spinlock use, or add one to protect the zone array > when doing zoned commands and checks of read/write against a zone wp. > Care to send a patch ? I can send one too. Sure, I can send. Do you think it is not OK to use zone write-lock (same like SCSI emulation) instead of introducing a new spinlock? -- Kanchan