public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v4 0/4] New Fuzzy Sync library API
Date: Thu, 22 Nov 2018 16:35:45 +0100	[thread overview]
Message-ID: <20181122153545.GA907@rei.lan> (raw)
In-Reply-To: <20181105154217.18879-1-rpalethorpe@suse.com>

Hi!
I've finally pushed the first three patches, thanks.

I will have a look at the final patch soon enough, quite likely
tomorrow.

The second one was pushed with mostly typo fixes (see below), I really
do like the comments and explanations now, it's much better explained
than the first version. There are a few things that I want to possibly
adjust but these are quite minor so I applied the patchset as it it for
now.

diff --git a/include/tst_fuzzy_sync.h b/include/tst_fuzzy_sync.h
index 59b5917f8..03f69b78b 100644
--- a/include/tst_fuzzy_sync.h
+++ b/include/tst_fuzzy_sync.h
@@ -1,28 +1,15 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
- * Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * Copyright (c) 2017-2018 Richard Palethorpe <rpalethorpe@suse.com>
  */
 /**
  * @file tst_fuzzy_sync.h
- * Fuzzy Synchronisation - abreviated to fzsync
+ * Fuzzy Synchronisation - abbreviated to fzsync
  *
  * This library is intended to help reproduce race conditions by synchronising
  * two threads at a given place by marking the range a race may occur
  * in. Because the exact place where any race occurs is within the kernel,
- * and therefor impossible to mark accurately, the library may add randomised
+ * and therefore impossible to mark accurately, the library may add randomised
  * delays to either thread in order to help find the exact race timing.
  *
  * Currently only two way races are explicitly supported, that is races
@@ -51,7 +38,7 @@
  *
  * The calls to tst_fzsync_start/end_race and tst_fzsync_run_a/b block (at
  * least) until both threads have enter them. These functions can only be
- * called once for each iteration, but further sychronisation points can be
+ * called once for each iteration, but further synchronisation points can be
  * added by calling tst_fzsync_wait_a() and tst_fzsync_wait_b() in each
  * thread.
  *
@@ -80,6 +67,9 @@
 #include "tst_timer.h"
 #include "tst_safe_pthread.h"
 
+#ifndef TST_FUZZY_SYNC_H__
+#define TST_FUZZY_SYNC_H__
+
 /** Some statistics for a variable */
 struct tst_fzsync_stat {
 	float avg;
@@ -183,7 +173,7 @@ struct tst_fzsync_pair {
 	int exec_loops;
 	/** Internal; The current loop index  */
 	int exec_loop;
-	/** Internal; The second thread or NULL */
+	/** Internal; The second thread or 0 */
 	pthread_t thread_b;
 };
 
@@ -527,7 +517,7 @@ static inline void tst_fzsync_pair_wait(int *our_cntr,
 		/*
 		 * We are about to break the invariant that the thread with
 		 * the lowest count is in front of the other. So we must wait
-		 * here to ensure the other thread has atleast reached the
+		 * here to ensure the other thread has at least reached the
 		 * line above before doing that. If we are in rear position
 		 * then our counter may already have been set to zero.
 		 */
@@ -641,9 +631,9 @@ static inline int tst_fzsync_run_b(struct tst_fzsync_pair *pair)
  *
  * This should be placed just before performing whatever action can cause a
  * race condition. Usually it is placed just before a syscall and
- * tst_fzsync_end_race_a() is placed just afterward.
+ * tst_fzsync_end_race_a() is placed just afterwards.
  *
- * A corrosponding call to tst_fzsync_start_race_b() should be made in thread
+ * A corresponding call to tst_fzsync_start_race_b() should be made in thread
  * B.
  *
  * @return A non-zero value if the calling thread should continue to loop. If
@@ -707,3 +697,5 @@ static inline void tst_fzsync_end_race_b(struct tst_fzsync_pair *pair)
 	tst_fzsync_time(&pair->b_end);
 	tst_fzsync_pair_wait(&pair->b_cntr, &pair->a_cntr, &pair->spins);
 }
+
+#endif /* TST_FUZZY_SYNC_H__ */



-- 
Cyril Hrubis
chrubis@suse.cz

      parent reply	other threads:[~2018-11-22 15:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-05 15:42 [LTP] [PATCH v4 0/4] New Fuzzy Sync library API Richard Palethorpe
2018-11-05 15:42 ` [LTP] [PATCH v4 1/4] tst_timer: Add nano second conversions Richard Palethorpe
2018-11-05 15:42 ` [LTP] [PATCH v4 2/4] fzsync: Simplify API with start/end race calls and limit exec time Richard Palethorpe
2018-11-22 15:41   ` Cyril Hrubis
2018-11-23 14:55     ` Richard Palethorpe
2018-11-05 15:42 ` [LTP] [PATCH v4 3/4] Convert tests to use fzsync_{start, end}_race API Richard Palethorpe
2018-11-05 15:42 ` [LTP] [PATCH v4 4/4] fzsync: Add delay bias for difficult races Richard Palethorpe
2018-11-29 15:19   ` Cyril Hrubis
2018-11-16 14:33 ` [LTP] [PATCH v4 0/4] New Fuzzy Sync library API Li Wang
2018-11-20 11:35   ` Richard Palethorpe
2018-11-20 13:09     ` Cyril Hrubis
2018-12-03 11:40       ` Richard Palethorpe
2018-11-22 15:35 ` Cyril Hrubis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181122153545.GA907@rei.lan \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox