From patchwork Tue Mar 25 16:17:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 3888291 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id F3021BF540 for ; Tue, 25 Mar 2014 16:17:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4457020173 for ; Tue, 25 Mar 2014 16:17:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 86E3020131 for ; Tue, 25 Mar 2014 16:17:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753910AbaCYQRm (ORCPT ); Tue, 25 Mar 2014 12:17:42 -0400 Received: from mail-bk0-f50.google.com ([209.85.214.50]:50230 "EHLO mail-bk0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753399AbaCYQRl (ORCPT ); Tue, 25 Mar 2014 12:17:41 -0400 Received: by mail-bk0-f50.google.com with SMTP id w10so277120bkz.37 for ; Tue, 25 Mar 2014 09:17:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=kI77848UGoXy3MMcCK9D6ZRvIUZsjNyepjzbtVbjAHU=; b=xWntE6PowP9ydJW20SyhRT9wEuPmUTCPmFOJVE2mFNRnZBF+ELLfIolZ+Cia+fu9CO Q4n2mxSm4LmQ4yRnUW1GLywDURAgeJjnkUjypLDfwEsmjvQMsyocs8DHdwkC056f/C03 ItYGgKQnRonPG9ZEv/VHtEHq0TSL5+CVOeuRUq5TqdlJ3sbWkgj1hFzhVSlWR1Ysbsen vjNkEQjmo9ipODAGzAtphhttnJi8yC3NsVBpH9PIJFnnucpn8iU7qXtyIfETyjlrTKQi tmKBgrj46XjI7qb1iTASjsg8DAyk/JhgECXxKcD/fI8tgVSG93IuIAG1TMqjLEjLgYh8 8VXA== X-Received: by 10.205.1.136 with SMTP id nq8mr40637734bkb.21.1395764259784; Tue, 25 Mar 2014 09:17:39 -0700 (PDT) Received: from localhost (port-21158.pppoe.wtnet.de. [46.59.144.79]) by mx.google.com with ESMTPSA id xk2sm18424291bkb.9.2014.03.25.09.17.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Mar 2014 09:17:38 -0700 (PDT) Date: Tue, 25 Mar 2014 17:17:24 +0100 From: Thierry Reding To: Greg Kroah-Hartman Cc: Sumit Semwal , dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org, Michal Marek , linux-kbuild@vger.kernel.org Subject: Re: [RFC] dma-buf: Implement test module Message-ID: <20140325161722.GA23842@ulmo> References: <1386858989-1487-1-git-send-email-treding@nvidia.com> <20131212144210.GA1527@ulmo.nvidia.com> <20131213020258.GC13333@kroah.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20131213020258.GC13333@kroah.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, T_TVD_MIME_EPI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Thu, Dec 12, 2013 at 06:02:58PM -0800, Greg Kroah-Hartman wrote: > On Thu, Dec 12, 2013 at 03:42:12PM +0100, Thierry Reding wrote: > > On Thu, Dec 12, 2013 at 03:36:29PM +0100, Thierry Reding wrote: > > > This is a simple test module that can be used to allocate, export and > > > delete DMA-BUF objects. It can be used to test DMA-BUF sharing in > > > systems that lack a real second driver. > > > > > > Signed-off-by: Thierry Reding > > > --- > > > drivers/base/Kconfig | 4 + > > > drivers/base/Makefile | 1 + > > > drivers/base/dma-buf-test.c | 308 ++++++++++++++++++++++++++++++++++++++++++++ > > > 3 files changed, 313 insertions(+) > > > create mode 100644 drivers/base/dma-buf-test.c > > > > And attached is a small test program that I've been using to test this > > new module. It can be built with: > > > > $ gcc -O2 -g -Wall -Werror -I/usr/include/libdrm -o dma-buf-test dma-buf-test.c -ldrm > > Please put this in the patch as well (scripts/tests/ ?) Sorry for taking so long to get back on this. I've tried various ways to make this work, but always ended up with something that didn't quite work. What I attempted was to put the test program into the samples/dma-buf subdirectory and use something along these lines: There are two things that don't work too well with this. First this causes the build to break if the build machine doesn't have the new public header (include/uapi/linux/dma-buf.h) installed yet. So the only way to make this work would be by building the kernel once with SAMPLES disabled, install the headers and then build again with SAMPLES enabled. Which really isn't very nice. One other option that I've tried is to modify the include path so that the test program would get the in-tree copy of the public header file, but that didn't build properly either because the header files aren't properly sanitized and therefore the compiler complains about it (include/uapi/linux/types.h). One other disadvantage of carrying the sample program in the tree is that there's only infrastructure to build programs natively on the build machine. That's somewhat unfortunate because if you want to run the test program on a different architecture you have to either compile the kernel natively on that architecture (which isn't very practical on many embedded devices) or cross-compile manually. I think a much nicer solution would be to add infrastructure to cross- compile these test programs, so that they end up being built for the same architecture as the kernel image (i.e. using CROSS_COMPILE). Adding Michal and the linux-kbuild mailing list, perhaps this has been discussed before, or maybe somebody has a better idea on how to solve this. Thierry diff --git a/samples/dma-buf/Makefile b/samples/dma-buf/Makefile new file mode 100644 index 000000000000..bcaa117474d7 --- /dev/null +++ b/samples/dma-buf/Makefile @@ -0,0 +1,8 @@ +obj- := dummy.o + +HOSTCFLAGS_dma-buf-test.o += $(shell pkg-config --cflags libdrm) +HOSTLOADLIBES_dma-buf-test += $(shell pkg-config --libs libdrm) + +hostprogs-y := dma-buf-test + +always := $(hostprogs-y)