Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp4964304rwn; Mon, 12 Sep 2022 02:02:29 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Clyh9h93Ng3xmQ6xI6Rr5knMYw9FS9ulKTwqzKG0KE2/PuCkneNwTuqtQ8qxlTJAO6jMZ X-Received: by 2002:a17:906:cc56:b0:779:ed37:b59e with SMTP id mm22-20020a170906cc5600b00779ed37b59emr9913326ejb.536.1662973349559; Mon, 12 Sep 2022 02:02:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662973349; cv=none; d=google.com; s=arc-20160816; b=PdXp8eLkD7FTeERiXDOJQxRY/CWRvLJp/RidSIUaB05fNO/jVfBZxOSjvjsJYJABZJ d6DW3PQqQSdAtwY4gz8mRO47OEUap9rpzYj5/vP69/yu8WQ/5WSQg2gZLgU9tBJj5V5I xDatgRyclpzqXeUdspdQgZaE+sPw6Ai27FtihhcP3HbmyoM7gPfzjYch3G7a3QksIGma ogtvyMqRASaZeIQwHKK7ZKwnQhmWyl+0s50wsnxqdUwfSGN4MJ4rsnmY6DH4QqM/PaB0 iIWVMyGyEGwdzbwcGvuf3p3zG/mtSyFWwVAzQIdt5ulHLReaRpWcPSEkfITn/zMVUCk2 39lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=jS4gbaE25b5FwtpAi5acCSAtwOGNDfO2kXInNNv4wXw=; b=XuraJ5XmylGtz3i0BbCbyK42VslBYmedYuD1u3SrPeBc7fXHSnSgwdPEU+AjDGw0Ry YGBNlltIx3VLifb3kREP+prWmAbvG+ZKKfFGY6leuZxHkDqEyMmgPbt2Egmn78P35RfO ++0F53znghXn6NTYmVfrJ+G0ixDCVW/rSz+SGGLTnUJv+byxNU/47ZfINbqz15zMXJ94 GScK2BEWkZTmC9TV93Jq4OMb2t7z+tYtSS+H1X1NkE4s2nuvVnfdXC7Ci1lVaUHCwRFo Q+uSIRoldz1LbSWvDeuWFAMUqYbW/YHyscfjyKf1/VTKmBJjXJnEbF9OuMBpLtAWcvvc bomw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn5-20020a1709070d0500b0077cc5693fe3si3472600ejc.682.2022.09.12.02.02.02; Mon, 12 Sep 2022 02:02:29 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229569AbiILIaH (ORCPT + 99 others); Mon, 12 Sep 2022 04:30:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230368AbiILI3k (ORCPT ); Mon, 12 Sep 2022 04:29:40 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C59262ADE; Mon, 12 Sep 2022 01:29:14 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id 5141568B05; Mon, 12 Sep 2022 10:29:10 +0200 (CEST) Date: Mon, 12 Sep 2022 10:29:10 +0200 From: Christoph Hellwig To: Serge Semin Cc: Christoph Hellwig , Serge Semin , Jonathan Derrick , Revanth Rajashekar , Jens Axboe , Keith Busch , Jens Axboe , Sagi Grimberg , Guenter Roeck , Alexey Malahov , Pavel Parkhomenko , Thomas Bogendoerfer , linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] nvme-hwmon: Cache-line-align the NVME SMART log-buffer Message-ID: <20220912082909.GA10666@lst.de> References: <20220909191916.16013-1-Sergey.Semin@baikalelectronics.ru> <20220909191916.16013-2-Sergey.Semin@baikalelectronics.ru> <20220910053045.GA23052@lst.de> <20220910123542.tzxg2blegw55z5fj@mobilestation> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220910123542.tzxg2blegw55z5fj@mobilestation> User-Agent: Mutt/1.5.17 (2007-11-01) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Sat, Sep 10, 2022 at 03:35:42PM +0300, Serge Semin wrote: > Well, both approaches will solve the denoted problem. I am just > wondering why do you think that the kmalloc-ed buffer is more > preferable? Because it clearly documents the intent. Here is one buffer that is just a data buffer, and here is one with kernel internal structure. The concept of embedding on-disk / on-the-wire structures into internal stuctures always seemed rather weird and unexpected to me, as we now need to ensure that the alignment works right on both sides. With the right annotations (as done in this series) this will work, but it feels a little fragile to me. > What would be the best solution if we had a qualifier like this: > #ifdef CONFIG_DMA_NONCOHERENT > #define ____dma_buffer ____cacheline_aligned > #else > #define ____dma_buffer > #endif > and used it instead of the direct ____cacheline_aligned utilization. So independent of my preference for separate allocations, this suggested additional would still be very useful for the places where we need to use the alignment for performance or other reasons. I'd use something like __dma_alligned or similar, though.