From patchwork Sun Dec 29 17:03:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 305647 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id EE8092C00BA for ; Mon, 30 Dec 2013 04:04:02 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 3437633152; Sun, 29 Dec 2013 17:04:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6eY9yg0Lm9nj; Sun, 29 Dec 2013 17:04:00 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id D354626E6C; Sun, 29 Dec 2013 17:03:59 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 1EF991C20F2 for ; Sun, 29 Dec 2013 17:03:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 18FFF93DF6 for ; Sun, 29 Dec 2013 17:03:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id x7zGBcAro1fO for ; Sun, 29 Dec 2013 17:03:57 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.free-electrons.com (top.free-electrons.com [176.31.233.9]) by hemlock.osuosl.org (Postfix) with ESMTP id EC7F893DEC for ; Sun, 29 Dec 2013 17:03:56 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 106) id 2107E89C; Sun, 29 Dec 2013 18:04:11 +0100 (CET) Received: from localhost (AToulouse-651-1-180-103.w109-222.abo.wanadoo.fr [109.222.115.103]) by mail.free-electrons.com (Postfix) with ESMTPSA id D2BF57CD; Sun, 29 Dec 2013 18:04:10 +0100 (CET) From: Thomas Petazzoni To: Buildroot List Date: Sun, 29 Dec 2013 18:03:55 +0100 Message-Id: <1388336635-18374-1-git-send-email-thomas.petazzoni@free-electrons.com> X-Mailer: git-send-email 1.8.3.2 Cc: Mischa Jonker Subject: [Buildroot] [PATCH] iozone: add fix for missing pthread_setaffinity_np() X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net The iozone code uses the pthread_setaffinity_np() function, but with uClibc this function is only available when the NPTL thread implementation is used. Some architectures, such as AVR32 and ARC do not support the NPTL thread implementation, and therefore lack the pthread_setaffinity_np() function. This commit adds a patch that provides an empty implementation of pthread_setaffinity_np() when we're using uClibc, but not with the NPTL thread implementation. The reasoning is that there is a very high chance that the few architectures that do not implement NPTL are non-SMP architectures, and therefore setting the affinity is not very useful. In addition to this, this commit: * Renames the existing patch to use a sequence number, in order to guarantee a proper ordering when applying patches. * Removes the Kconfig dependency on !uClibc 0.9.31, which was introduced to prevent AVR32 from failing due to the pthread_setaffinity_np(). This conditional is no longer necessary due to the new patch, and the conditional was anyway not completely working since it was not taking into account the case of external toolchains. Signed-off-by: Thomas Petazzoni --- package/iozone/Config.in | 1 - ...ozone-targets.patch => iozone-01-targets.patch} | 0 package/iozone/iozone-02-no-nptl-support.patch | 37 ++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) rename package/iozone/{iozone-targets.patch => iozone-01-targets.patch} (100%) create mode 100644 package/iozone/iozone-02-no-nptl-support.patch diff --git a/package/iozone/Config.in b/package/iozone/Config.in index 33e12ca..26d4daa 100644 --- a/package/iozone/Config.in +++ b/package/iozone/Config.in @@ -1,7 +1,6 @@ config BR2_PACKAGE_IOZONE bool "iozone" depends on BR2_USE_MMU # fork() - depends on !BR2_UCLIBC_VERSION_0_9_31 # no pthread_setaffinity_np help IOzone is a filesystem benchmark tool. The benchmark generates and measures a variety of file operations diff --git a/package/iozone/iozone-targets.patch b/package/iozone/iozone-01-targets.patch similarity index 100% rename from package/iozone/iozone-targets.patch rename to package/iozone/iozone-01-targets.patch diff --git a/package/iozone/iozone-02-no-nptl-support.patch b/package/iozone/iozone-02-no-nptl-support.patch new file mode 100644 index 0000000..493f52c --- /dev/null +++ b/package/iozone/iozone-02-no-nptl-support.patch @@ -0,0 +1,37 @@ +Dummy pthread_setaffinity_np() when not available + +On uClibc configurations that do not use the NPTL thread +implementation, pthread_setaffinity_np() is not available. This patch +defines a dummy (empty) implementation of this function for such +cases. + +The only few architectures that do not provide the NPTL thread +implementation are very likely to be non-SMP architectures, and +therefore, setting the affinity of the thread is not doing anything +useful, so having an empty stub for pthread_setaffinity_np() is not a +problem. + +Signed-off-by: Thomas Petazzoni + +Index: b/src/current/iozone.c +=================================================================== +--- a/src/current/iozone.c ++++ b/src/current/iozone.c +@@ -306,6 +306,17 @@ + #endif + #endif + ++#if defined (__linux__) ++#include ++#if defined (__UCLIBC__) && !defined (__UCLIBC_HAS_THREADS_NATIVE__) ++static int pthread_setaffinity_np(pthread_t thread, size_t cpusetsize, ++ const cpu_set_t *cpuset) ++{ ++ return 0; ++} ++#endif ++#endif ++ + #if ((defined(solaris) && defined(__LP64__)) || defined(__s390x__)) + /* If we are building for 64-bit Solaris, all functions that return pointers + * must be declared before they are used; otherwise the compiler will assume