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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D4B26C00140 for ; Thu, 18 Aug 2022 08:39:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8OzhgQyw1NgEaqjJWo7ZW5dxnu3cEHJYU2UAm9O5eQM=; b=SEah3PcmYocx0R Wu78+vGRwxCt6YIuFfnbvfaQmwagoV2g7VmAM+LrFlghWePjTppy8EdRn/EzfQlaOHol49s87goZ8 0S0fIBM5aCHFOpGa/0E1rP6XHqMmbrI7HcfLae3pvCaXMe9UelcfC7k3cG8ujC7wf7EqZjox7lFa3 3nghhXZR20QaEn7SmDfCSXZGoKgROmBDmHs/jTyIcVnno7Lo8Gq3w98qNEix3PuhoTPkFc2TgCGKC qsfMeGFqBFC4WlfdgbQd5YP/IsuyDrtJow9sQ9jiQrHy+RiQM1Ej2q777DRraLtl42ZmHjPtQeFI4 OcXPC6oP92owzI267xOg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oOb2M-000zEb-OY; Thu, 18 Aug 2022 08:37:58 +0000 Received: from out30-45.freemail.mail.aliyun.com ([115.124.30.45]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oOb2J-000z7i-0N for linux-arm-kernel@lists.infradead.org; Thu, 18 Aug 2022 08:37:57 +0000 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=liusong@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0VMZx3Mr_1660811864; Received: from 30.178.80.93(mailfrom:liusong@linux.alibaba.com fp:SMTPD_---0VMZx3Mr_1660811864) by smtp.aliyun-inc.com; Thu, 18 Aug 2022 16:37:46 +0800 Message-ID: Date: Thu, 18 Aug 2022 16:37:44 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.0.3 Subject: Re: [PATCH v2] mm/dmapool.c: avoid duplicate memset within dma_pool_alloc To: Christoph Hellwig , Robin Murphy , akpm@linux-foundation.org Cc: Marek Szyprowski , "linux-arm-kernel@lists.infradead.org" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, "iommu@lists.linux.dev" References: <1658125690-76930-1-git-send-email-liusong@linux.alibaba.com> <1dbe63ff-5575-745b-653a-a992ae53e1aa@samsung.com> <413d8666-7a82-efd7-6716-13658016ca10@arm.com> <20220817053628.GA28747@lst.de> From: Liu Song In-Reply-To: <20220817053628.GA28747@lst.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220818_013755_365927_E97CEB10 X-CRM114-Status: GOOD ( 11.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org A helper function "use_dev_coherent_memory" is introduced here to >>>> determine whether the memory is allocated by "dma_alloc_from_dev_coherent". >>>> >>>> And use "get_dma_ops" to determine whether the memory is allocated by >>>> "dma_direct_alloc". > WTF? get_dma_ops is privat to the DMA API layer, and dmapool has no > business even using that. Even independent of this particular case, > consumers of an API never have any business looking at the implementation > of the API, that is the whole point of the abstraction. > >> It's not even that, the change here is just obviously broken, since it ends >> up entirely ignoring want_init_on_alloc() for devices using dma-direct. >> Sure, the memory backing a dma_page is zeroed *once* by its initial >> dma-coherent allocation, but who says we're not not reallocating pool >> entries from an existing dma_page? > And yes, in addition to that it also is completely broken. After reading everyone's comments, I found that fixing this patch will make the code look strange, so the benefits of the changes will be dispensable, so I also agree to discard this patch. Sorry for this trouble again. Thanks _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel