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 15354ECAAD5 for ; Sat, 10 Sep 2022 05:32:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229607AbiIJFcH (ORCPT ); Sat, 10 Sep 2022 01:32:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229601AbiIJFcG (ORCPT ); Sat, 10 Sep 2022 01:32:06 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7A7080496; Fri, 9 Sep 2022 22:32:05 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id 3939F68B05; Sat, 10 Sep 2022 07:32:03 +0200 (CEST) Date: Sat, 10 Sep 2022 07:32:03 +0200 From: Christoph Hellwig To: Serge Semin Cc: Jonathan Derrick , Revanth Rajashekar , Jens Axboe , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Rafael Antognolli , Scott Bauer , Serge Semin , Alexey Malahov , Pavel Parkhomenko , Thomas Bogendoerfer , linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] block: sed-opal: Cache-line-align the cmd/resp buffers Message-ID: <20220910053203.GB23052@lst.de> References: <20220909191916.16013-1-Sergey.Semin@baikalelectronics.ru> <20220909191916.16013-3-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220909191916.16013-3-Sergey.Semin@baikalelectronics.ru> User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org On Fri, Sep 09, 2022 at 10:19:16PM +0300, Serge Semin wrote: > In accordance with [1] the DMA-able memory buffers must be > cacheline-aligned otherwise the cache writing-back and invalidation > performed during the mapping may cause the adjacent data being lost. It's > specifically required for the DMA-noncoherent platforms. Seeing the > opal_dev.{cmd,resp} buffers are used for DMAs in the NVME and SCSI/SD > drivers in framework of the nvme_sec_submit() and sd_sec_submit() methods > respectively we must make sure the passed buffers are cacheline-aligned to > prevent the denoted problem. Same comment as for the previous one, this should work, but I think separate allocations for the DMAable buffers would document the intent much better. Given that the opal initialization isn't a fast path I don't think that the overhead should matter either.