Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3028333imu; Fri, 18 Jan 2019 03:37:05 -0800 (PST) X-Google-Smtp-Source: ALg8bN6xSycpAvGGV/YJSasylNv2+i8dgIvcdD3xr/98fR/O1BtKoJ/5CtAGNGtyW3rFYvmGEivh X-Received: by 2002:a17:902:8c98:: with SMTP id t24mr18884463plo.130.1547811425027; Fri, 18 Jan 2019 03:37:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547811424; cv=none; d=google.com; s=arc-20160816; b=YOaHftpck/Zo7fQ/U+aj0DuSrdpPY0Sk2YoFhZ31GE/maadnaB4HJc9ys06Jv4p2fC EhNseDiTjFVVjN+/GbG4DgSVEEvDAxZzaADq1D9K1memTBmYo/gqduqjcu6vnw8wWeP1 MGVYPlYl4YTDPGSJEnTog6XzsIX50HZ4ynIMD3hFGIJBZkgu08s3c3QcZNNnLvJfwqDc XGYSDwdH3TZ+AVNVY5FXKI1VNzXo175XOddRbkukfRW5SGaZ+ij4PraBKeEi+lRJSGcL QODqejj45xsCz0nVffV6ES5yHFEHw+ZMbzxUYXHTRFGuav8F5duuBm+j9eP+wajVnz6M ZCqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=/So5eP2iqquQe9ncr8nhDxT6P6vh/f+UKBlF31WBVVY=; b=jNBQULAOmQ3oyQxCnB2Pflb3c8T7Q1muDcyNkkmEb212COupo8rYo9bUnQGWccB57o saAYiELwrRocq3qyCKumtr/TpagAK2Pfxehbr1QTnTQ94io6t7Rohxpq6wUP9KZSpvG1 ydbfZlDWq4Mvnx9O1tRPhl3pvh63twut4TNFWDcoN/udxUvzvC7UMOsyyy/813zVWySs trng4MlsFH4dlny0PoG/2ISrjNpXsSL3Hrtp+uguyD+1vya7Z5y/Y3ZVAbkTWAOM/QA8 9plcPsXHsn42HvrxRx0Nsi7EJZJL4qx0lbcYxBhS4rQTrubZGuapvFYhTUPlNpLSAV8R ZC2A== 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 u13si4196921plq.268.2019.01.18.03.36.49; Fri, 18 Jan 2019 03:37:04 -0800 (PST) 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 S1727241AbfARLfp (ORCPT + 99 others); Fri, 18 Jan 2019 06:35:45 -0500 Received: from verein.lst.de ([213.95.11.211]:43011 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727115AbfARLfo (ORCPT ); Fri, 18 Jan 2019 06:35:44 -0500 Received: by newverein.lst.de (Postfix, from userid 2407) id 7B0DF68CEB; Fri, 18 Jan 2019 12:35:43 +0100 (CET) Date: Fri, 18 Jan 2019 12:35:43 +0100 From: Christoph Hellwig To: Robin Murphy Cc: Corentin Labbe , hch@lst.de, m.szyprowski@samsung.com, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, joro@8bytes.org Subject: Re: [PATCH] dma-debug: add dumping facility via debugfs Message-ID: <20190118113543.GA9481@lst.de> References: <1547646265-9414-1-git-send-email-clabbe@baylibre.com> <2f43688f-9c08-a9c4-6175-caa3d2e40261@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2f43688f-9c08-a9c4-6175-caa3d2e40261@arm.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 16, 2019 at 06:10:13PM +0000, Robin Murphy wrote: > It's a shame that this is pretty much a duplication of > debug_dma_dump_mappings(), but there seems no straightforward way to define > one in terms of the other :/ We could always play some macro magic, but I think that is worse than duplicating a little bit of functionality. Btw, the dev argument to debug_dma_dump_mappings is always NULL and could be removed.. > (although given that we'd rather not have that weird external interface > anyway, maybe "now you can use debugfs instead" might be justification > enough for cleaning it up...) One argument against that is the system might be in a shape where you can't easily read a file when it is in that shape. The argument for that is that in many systems the full list of mappings might overwhelm the kernel log. Adding Joerg, who originally wrote the code in case he has an opinion. > >> + >> +static int dump_open(struct inode *inode, struct file *file) >> +{ >> + return single_open(file, dump_read, inode->i_private); >> +} >> + >> +static const struct file_operations dump_fops = { >> + .owner = THIS_MODULE, >> + .open = dump_open, >> + .read = seq_read, >> + .llseek = seq_lseek, >> + .release = single_release, >> +}; >> + > > DEFINE_SHOW_ATTRIBUTE()? > > Robin. > >> static int dma_debug_fs_init(void) >> { >> dma_debug_dent = debugfs_create_dir("dma-api", NULL); >> @@ -894,6 +936,11 @@ static int dma_debug_fs_init(void) >> if (!filter_dent) >> goto out_err; >> + dump_dent = debugfs_create_file("dump", 0444, >> + dma_debug_dent, NULL, &dump_fops); >> + if (!dump_dent) >> + goto out_err; >> + >> return 0; >> out_err: >> ---end quoted text---