Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10125989imu; Wed, 5 Dec 2018 16:53:08 -0800 (PST) X-Google-Smtp-Source: AFSGD/VOTMZvuvG2n4M60GAqflEt2AYqG74YkHTpu1NUWqd4pHaflbElNNlYuYxl96jbDCbBq6LZ X-Received: by 2002:a17:902:12b:: with SMTP id 40mr25728817plb.72.1544057588096; Wed, 05 Dec 2018 16:53:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544057588; cv=none; d=google.com; s=arc-20160816; b=yBaPICDS3JG/wt1kV7KdImD9F2WSI5+T5AWNMGgd6dPicD6eoPDTIOB6YaGhRnBdoe jjHdbFZodazD8febDBPShD1+5/qI1/lHyLN/8Qp7q1UBPYVwBFAnvMSJfWV4pvF8bgO8 lzVEKTM/QKrF9jwrMMUilHhjwggzEL0ZhWpyZnAvCx3knBzyECST7IZrukKjVmAMETmG OySpmdd1bpOhdecs73IhiDWTVgeqSYxfjfvHsBfs8YgB5kaunq0hNarX9ipk582RdF4q SRm7prYGseOmzCwB4QZsm/BVFFq8Nnu1LD7oGa/RT5qKQdSfLkHvz7gkA2P2szmkNfSS UJnw== 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:dkim-signature; bh=27zl8fU/HOr7ybzVb97DC2+fYB7HlvYLVzEmuFxVMmc=; b=KbscglnCm47gfG+cqDTQjZPNv2B7JVz3KbFjouQ9+fr3M0sJLlA1jG8t+tAFU79Kda VB8Vl36X34A15Sxr6X7A8FYz/0jdzdcN/ZdINIReYmSFR7x+nNkh4oJ6hiPDYTfRR2eg 2I1rh92P75tkZVFohymqXwWprviCuZez3kT9TDr8DHvY4ZDYPfpb65tXCxgBbTE1Rort p5NCRB5+l3vbs6QUvnxrKtb4VrrkrOwJ6NeF2YdUW8gXLVfpXcjTkcZiuZreYQ9ePhN9 2FpjwwXXS4QM1jLFygXSjaPwSTPluKV/j9yRgDNKC+KJireXqX3O1SBh2mDOPTio3eiQ 6ufQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=K2tyW42J; 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 133si26935238pfc.61.2018.12.05.16.52.40; Wed, 05 Dec 2018 16:53:08 -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; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=K2tyW42J; 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 S1728331AbeLFAv6 (ORCPT + 99 others); Wed, 5 Dec 2018 19:51:58 -0500 Received: from mail-ed1-f65.google.com ([209.85.208.65]:34361 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727358AbeLFAv6 (ORCPT ); Wed, 5 Dec 2018 19:51:58 -0500 Received: by mail-ed1-f65.google.com with SMTP id b3so18647153ede.1 for ; Wed, 05 Dec 2018 16:51:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=27zl8fU/HOr7ybzVb97DC2+fYB7HlvYLVzEmuFxVMmc=; b=K2tyW42JlQRDYhNaxvTA1ZtGlw5SzlxlVXEwDA2OCJAOjZZKUkBtMQ+kANCcyZ6lh0 +hh3EaovlriX8sLtBwYE+VDgXCDZblBsqp2Ro9Wr6mBsEm1Ol1cwmXBQNGdPDs47y2Vg 1acx/aup5J+TvUF983fdDaOqsrvroFe3YUyws= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=27zl8fU/HOr7ybzVb97DC2+fYB7HlvYLVzEmuFxVMmc=; b=oOAuVLGcEFxxVoEfX8o4+P6KfkbuRSuzpbwsKdw491jDdXLTZ1LFbMD9S5VJLmZweH L1bvT6oFXYvw+Bv12N2Lcew4lKolCmypSsgDa1gpiRmf7KgKp+jZxcYrFriSaYkhjN7K UFjHub4eTB14HsiH2Q4rnubnBIPn9AKUmb46vh2DpyLuD58XbP7bxW0c2P8lNG5mnPGy RPKWMx16uWxK/dDi9X/wr/KTEcz5aoYCHXDhNcC0TNs4OWSyYUKFGnF0GQ2/PCJwJijB qM1Eupv3Wm/PABnBK7ANlLa3ovBYiS9lEP3GmfPjEDTvWnxI8WHTfbxwskMljL9y8k9f IVlQ== X-Gm-Message-State: AA+aEWa75r6zvj5XzCFpVp4JpFtoJY4Z9DRexmoxAFnLtMMxKfYVvwrZ fqiMnCYj8WUGieQSesda0+TYWQ== X-Received: by 2002:a17:906:1a49:: with SMTP id j9-v6mr20349531ejf.45.1544057516294; Wed, 05 Dec 2018 16:51:56 -0800 (PST) Received: from andrea (dynamic-2a00-1028-8386-da8a-eacb-c188-78b9-634c.ipv6.broadband.iol.cz. [2a00:1028:8386:da8a:eacb:c188:78b9:634c]) by smtp.gmail.com with ESMTPSA id i46sm1856384eda.37.2018.12.05.16.51.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Dec 2018 16:51:55 -0800 (PST) Date: Thu, 6 Dec 2018 01:51:47 +0100 From: Andrea Parri To: "Paul E. McKenney" Cc: Josh Triplett , tglx@linutronix.de, mingo@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org Subject: Re: [tip:core/rcu] rcutorture: Make initrd/init execute in userspace Message-ID: <20181206005147.GA3300@andrea> References: <20181204222412.GA6874@localhost> <20181204230423.GP4170@linux.ibm.com> <20181205222523.GA14609@localhost> <20181206000809.GX4170@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181206000809.GX4170@linux.ibm.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > commit 4f8f751961b536f77c8f82394963e8e2d26efd84 > Author: Paul E. McKenney > Date: Tue Dec 4 14:59:12 2018 -0800 > > torture: Explain and simplify odd "for" loop in mkinitrd.sh > > Why a Bourne-shell "for" loop? And why 192 instances of "a"? This commit > adds a shell comment to present the answer to these mysteries. It also > uses a series of factor-of-four Bourne-shell assignments to make it > easy to see how many instances there are, replacing the earlier wall of > 'a' characters. > > Reported-by: Josh Triplett > Signed-off-by: Paul E. McKenney > > diff --git a/tools/testing/selftests/rcutorture/bin/mkinitrd.sh b/tools/testing/selftests/rcutorture/bin/mkinitrd.sh > index da298394daa2..ff69190604ea 100755 > --- a/tools/testing/selftests/rcutorture/bin/mkinitrd.sh > +++ b/tools/testing/selftests/rcutorture/bin/mkinitrd.sh > @@ -40,17 +40,24 @@ mkdir $T > cat > $T/init << '__EOF___' > #!/bin/sh > # Run in userspace a few milliseconds every second. This helps to > -# exercise the NO_HZ_FULL portions of RCU. > +# exercise the NO_HZ_FULL portions of RCU. The 192 instances of "a" was > +# empirically shown to give a nice multi-millisecond burst of user-mode > +# execution on a 2GHz CPU, as desired. Modern CPUs will vary from a > +# couple of milliseconds up to perhaps 100 milliseconds, which is an > +# acceptable range. > +# > +# Why not calibrate an exact delay? Because within this initrd, we > +# are restricted to Bourne-shell builtins, which as far as I know do not > +# provide any means of obtaining a fine-grained timestamp. > + > +a4="a a a a" > +a16="$a4 $a4 $a4 $a4" > +a64="$a8 $a8 $a8 $a8" Mmh, are you sure you don't want s/a8/a16/ here? ;-) Andrea > +a192="$a64 $a64 $a64" > while : > do > q= > - for i in \ > - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \ > - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \ > - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \ > - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \ > - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \ > - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a > + for i in $a192 > do > q="$q $i" > done >