From patchwork Wed Aug 27 06:01:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Waldemar Brodkorb X-Patchwork-Id: 383332 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id 02EE51400D2 for ; Wed, 27 Aug 2014 16:10:09 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 9DBD794719; Wed, 27 Aug 2014 06:10:08 +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 DVodEY1hDYMq; Wed, 27 Aug 2014 06:10:08 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 0A07C947E5; Wed, 27 Aug 2014 06:10:08 +0000 (UTC) X-Original-To: uclibc@lists.busybox.net Delivered-To: uclibc@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 84F771C107A for ; Wed, 27 Aug 2014 06:10:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 7F80790DFB for ; Wed, 27 Aug 2014 06:10:06 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4DADv-VYNCDO for ; Wed, 27 Aug 2014 06:10:06 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from helium.waldemar-brodkorb.de (helium.waldemar-brodkorb.de [89.238.66.15]) by whitealder.osuosl.org (Postfix) with ESMTPS id D466B90D54 for ; Wed, 27 Aug 2014 06:10:05 +0000 (UTC) Received: by helium.waldemar-brodkorb.de (Postfix, from userid 1000) id 9113910533; Wed, 27 Aug 2014 08:02:13 +0200 (CEST) From: Waldemar Brodkorb To: uclibc@uclibc.org Subject: [PATCH 05/12] sync WRITE_BUFFER_SIZE with glibc test Date: Wed, 27 Aug 2014 08:01:42 +0200 Message-Id: <1409119310-22929-5-git-send-email-wbx@openadk.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1409119310-22929-1-git-send-email-wbx@openadk.org> References: <1409119310-22929-1-git-send-email-wbx@openadk.org> X-BeenThere: uclibc@uclibc.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Discussion and development of uClibc \(the embedded C library\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: uclibc-bounces@uclibc.org Sender: uclibc-bounces@uclibc.org Test on Linux 3.16.1 in Qemu ARM fails with: TEST_EXEC nptl/ tst-cancel4 ret == 1 ; expected_ret == 0 make[1]: *** [tst-cancel4.exe] Error 1 The output of failed test is: minimum write buffer size too large ../Test.mak:89: recipe for target 'tst-cancel4.exe' failed Signed-off-by: Waldemar Brodkorb --- test/nptl/tst-cancel4.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/test/nptl/tst-cancel4.c b/test/nptl/tst-cancel4.c index e711958..53abf83 100644 --- a/test/nptl/tst-cancel4.c +++ b/test/nptl/tst-cancel4.c @@ -83,7 +83,30 @@ static pthread_barrier_t b2; # define IPC_ADDVAL 0 #endif -#define WRITE_BUFFER_SIZE 4096 +/* The WRITE_BUFFER_SIZE value needs to be chosen such that if we set + the socket send buffer size to '1', a write of this size on that + socket will block. + + The Linux kernel imposes a minimum send socket buffer size which + has changed over the years. As of Linux 3.10 the value is: + + 2 * (2048 + SKB_DATA_ALIGN(sizeof(struct sk_buff))) + + which is attempting to make sure that with standard MTUs, + TCP can always queue up at least 2 full sized packets. + + Furthermore, there is logic in the socket send paths that + will allow one more packet (of any size) to be queued up as + long as some socket buffer space remains. Blocking only + occurs when we try to queue up a new packet and the send + buffer space has already been fully consumed. + + Therefore we must set this value to the largest possible value of + the formula above (and since it depends upon the size of "struct + sk_buff", it is dependent upon machine word size etc.) plus some + slack space. */ + +#define WRITE_BUFFER_SIZE 16384 /* Cleanup handling test. */ static int cl_called; @@ -758,7 +781,6 @@ tf_sigpause (void *arg) pthread_cleanup_push (cl, NULL); - /* Just for fun block the cancellation signal. */ sigpause (SIGCANCEL); pthread_cleanup_pop (0);