Received: by 10.192.165.148 with SMTP id m20csp80695imm; Fri, 20 Apr 2018 03:25:23 -0700 (PDT) X-Google-Smtp-Source: AIpwx49nVVTKaZlMBNY2vpMM3F+MN2BwmFk0lgLKQx6hAXjd+YjFGhmAyI77cs6YMg4xjzPdj3u9 X-Received: by 10.99.188.9 with SMTP id q9mr7994794pge.381.1524219922970; Fri, 20 Apr 2018 03:25:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524219922; cv=none; d=google.com; s=arc-20160816; b=t2xfIEVhpNP1MrhQa23bwaogSWyvrPKLUHHVBnkksYterLTC7m1yfQjMT0uDDkwGgj iyVeNB79HcCDqmjLhkY8FTncxT81jC6j2RiLAZuEJSofo2M/ReoVZvY7XgCJy+/BHCIt 4KqaGpWrOmnw/GL8vezZzfeJkYTnBi5NFTp3CNsN3mzyhvkAdiOjDuLJDO+TkEN77giG 7LKOIAgASFrdWApbJ0qlR+BtoLDAK3ONiiVQP+b8dzaP3fZd3hXGznyVFxcjZzVfGW3g iRv+yr5kQFcWMMqmmaJ2pxi5BaCkeoGvRdw38qbVMtUioOn22mUdIo8nWmSr1v2LHFDn rnVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=uLpbmoCw2Id/p4nWEuk403XSG0L89mmGnm9v3tQ2oqs=; b=Xlc8yxbovnPrfu2j0iXDQbomPZvWJU39iPZR8+WE9/LR1GUTc5qjyGuc6Jjw+gE1BJ mfnobV/ayOQ8Y7jHbolJNx0Bvk4EkPBstWw2Fm6L7OYWtGxSTDenSFjBqYGg7yyDAw+G ZPBVCWORcTplZUP0eNaSSD/Dgad30WibNrbQCnIOl+nuJgyAze/tsM/gkK/AInucMBza luV/W11tnPI/2HldwGLEdYmkw4YwDspl6Gql3oZsxh0qPNOz/XDdK/u4yT5+LexpFMQa ZI5v1GUVaOKb6MDfdO4ft3YcMGAPKqEKMlNwxaJTsN8LowewrvxcNep1kfTAcxanI3gM pX8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q7-v6si5533889plk.129.2018.04.20.03.25.08; Fri, 20 Apr 2018 03:25:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754621AbeDTKXy (ORCPT + 99 others); Fri, 20 Apr 2018 06:23:54 -0400 Received: from foss.arm.com ([217.140.101.70]:47582 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754321AbeDTKXs (ORCPT ); Fri, 20 Apr 2018 06:23:48 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2EB1080D; Fri, 20 Apr 2018 03:23:48 -0700 (PDT) Received: from [10.1.210.88] (e110467-lin.cambridge.arm.com [10.1.210.88]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5A7563F25D; Fri, 20 Apr 2018 03:23:45 -0700 (PDT) Subject: Re: [PATCH 01/22] dma-debug: move initialization to common code To: Christoph Hellwig Cc: linux-arch@vger.kernel.org, linux-xtensa@linux-xtensa.org, Michal Simek , Vincent Chen , linux-c6x-dev@linux-c6x.org, linux-parisc@vger.kernel.org, linux-sh@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, openrisc@lists.librecores.org, Greentime Hu , linux-alpha@vger.kernel.org, sparclinux@vger.kernel.org, nios2-dev@lists.rocketboards.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org References: <20180420080313.18796-1-hch@lst.de> <20180420080313.18796-2-hch@lst.de> From: Robin Murphy Message-ID: <294a1469-01d6-10fb-5de1-b1d4513a066c@arm.com> Date: Fri, 20 Apr 2018 11:23:43 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180420080313.18796-2-hch@lst.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Christoph, Nice cleanup! Looks good overall, just a couple of nits. On 20/04/18 09:02, Christoph Hellwig wrote: [...] > diff --git a/lib/dma-debug.c b/lib/dma-debug.c > index 7f5cdc1e6b29..712a897174e4 100644 > --- a/lib/dma-debug.c > +++ b/lib/dma-debug.c > @@ -41,6 +41,11 @@ > #define HASH_FN_SHIFT 13 > #define HASH_FN_MASK (HASH_SIZE - 1) > > +/* allow architectures to override this if absolutely required */ > +#ifndef PREALLOC_DMA_DEBUG_ENTRIES > +#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16) > +#endif > + > enum { > dma_debug_single, > dma_debug_page, > @@ -1004,18 +1009,16 @@ void dma_debug_add_bus(struct bus_type *bus) > bus_register_notifier(bus, nb); > } > > -/* > - * Let the architectures decide how many entries should be preallocated. > - */ > -void dma_debug_init(u32 num_entries) > +static int dma_debug_init(void) > { > + u32 num_entries; Maybe initialise it to PREALLOC_DMA_DEBUG_ENTRIES? > int i; > > /* Do not use dma_debug_initialized here, since we really want to be > * called to set dma_debug_initialized > */ > if (global_disable) > - return; > + return 0; > > for (i = 0; i < HASH_SIZE; ++i) { > INIT_LIST_HEAD(&dma_entry_hash[i].list); > @@ -1026,17 +1029,19 @@ void dma_debug_init(u32 num_entries) > pr_err("DMA-API: error creating debugfs entries - disabling\n"); > global_disable = true; > > - return; > + return 0; > } > > if (req_entries) > num_entries = req_entries; > + else > + num_entries = PREALLOC_DMA_DEBUG_ENTRIES; > > if (prealloc_memory(num_entries) != 0) { > pr_err("DMA-API: debugging out of memory error - disabled\n"); > global_disable = true; > > - return; > + return 0; > } > > nr_total_entries = num_free_entries; > @@ -1044,7 +1049,9 @@ void dma_debug_init(u32 num_entries) > dma_debug_initialized = true; > > pr_info("DMA-API: debugging enabled by kernel config\n"); > + return 0; > } > +core_initcall(dma_debug_init); I think it's worth noting that for most users this now happens much earlier than before. In general that's probably good (e.g. on arm64 it should prevent false-positives from the Arm SMMU drivers under ACPI), and I can't imagine it's high-risk, but it is a behaviour change. Robin. > > static __init int dma_debug_cmdline(char *str) > { >