Message ID | 20240123000604.1211486-6-irogers@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-34440-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp43527dyi; Mon, 22 Jan 2024 16:38:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IE1Aey0sZyzWK9qyNcLr52B3FPGT4D2AG81TW0ugJOfCL2UfRaQaxBYoPC+UN89LkeWynZI X-Received: by 2002:a17:90a:4c82:b0:28f:f70b:a272 with SMTP id k2-20020a17090a4c8200b0028ff70ba272mr2332648pjh.21.1705970289485; Mon, 22 Jan 2024 16:38:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705970289; cv=pass; d=google.com; s=arc-20160816; b=m8ttc61Mp/tz1bcP1M2xEfK0x3/oBnM4NmoWWHvzhTGF04b769I7pe9YFSW08mbaDC m2NI32J3g2Q3HqOY8LoBUaN8QFEhg25aDM6ZRQ9b9+DehkyOuQub7wAgeVYBRcUb+jOK WIX/MJPy5gXvbF0KPgm+mwaeQBVhxg59py77agkPuFqwBg3Lj1byb1IX4Shn2n98Bi9n /S/P8YnmmhtQW8NbdS5aG3BklyLzUIE+AKBMDuRXGH5pnE0UPQgAcOQNlcncZYqP49R5 bkijlltfIQLXC7ADn88ChRD4xFWtRk16RsI5TBE1FwLUIRRR5UiCaljuwJ+yoRxcT/mw 6Tpw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:from:subject:references:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:in-reply-to:date :dkim-signature; bh=rdBgE5wIVLj6TuJkMA8Og1unwB8wxsizIZfcekxtMQI=; fh=OSPvvrodhCXrbS0tgWY7ZQ1FjQjyOgKyIFsZYsPrQ8s=; b=mlN6A8juJEER+izsNXvsEIZz1p6Al9v8V+UObNcvASh9jY8+8Yxf+LBWY9Nd4qeGGo QToIx4pd4OQQpr8hFKnjCsvoUbetYdltN52RUlptqzcq3ohhOWxGdrAltmmzqB+zBsX6 bXExIhO32EVUyOFKADfD55OSpRdgIx4LJGqo6FTH+Vfv5oZdtwRJfgdsvpLxCrc41j4/ 43wYN+RwaoPwIlfO0sS1Omh9kd+no8INO198eT23zy9rNphlZNXr19hR9w4R4/0GnbZb OXXcU813HobzXw3O7gVLxl0LYCvpfy3yMnU+N+r09+5va5pQ7yLxwf+WukUjCRXsAkxd y5DQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=nH3pPjWn; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-34440-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34440-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id cq16-20020a17090af99000b0028ffc9c1453si8908017pjb.21.2024.01.22.16.38.09 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 16:38:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34440-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=nH3pPjWn; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-34440-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34440-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 0C17128C124 for <ouuuleilei@gmail.com>; Tue, 23 Jan 2024 00:28:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A85514830B; Tue, 23 Jan 2024 00:06:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="nH3pPjWn" Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 086AF1474D5 for <linux-kernel@vger.kernel.org>; Tue, 23 Jan 2024 00:06:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705968385; cv=none; b=IHdZfi59TuEdhzRQHXk4OpwacUrtVPCxYR0QwZ9aZAnCIltDBMliEEIBHwRZDPTdyy0qmVDNXbf1cVlle7QQWFDOIHsdUdcynPTf+znsA+kWjhRKWWrf/49bIzyd6HO6St+wOywKIJj79jLkjYpRga1yWmB3pa/6VGoiC5cZ270= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705968385; c=relaxed/simple; bh=FCUxXLEqX6wbauWA6R/m3LLJXqQAbHJBX+CMyQoYlc0=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=PQvnfx+abIkwwt8q/+XDIZNozIfJ8GDGNuyooVModRQj7gWLLl9mkYftbMxJTqK0ZEvvdLekZOGCpmhg8jV1MGjMUivfnXLpG1Fm7+XAZEg3uzXrzpcWkMn4eotVNWiDRVZ7+WjaGH8f9btIiLv2jzYmCcLLEr2tCnItvtp+03E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=nH3pPjWn; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-5f325796097so65306467b3.1 for <linux-kernel@vger.kernel.org>; Mon, 22 Jan 2024 16:06:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1705968383; x=1706573183; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=rdBgE5wIVLj6TuJkMA8Og1unwB8wxsizIZfcekxtMQI=; b=nH3pPjWnwi6JgAGKa/p8fnkmY3+bZgE8U7E6wBrSOJqAivLHmyX05OjLpEHvmVEG5k bl2iUPOlNsAbcYuOK2zY4cC3EdknIRdD7au0Re22vRhn0bo8xZS3R+u1EJM5zmzH1+Ej J/A2NMoaUQQMPxudflVyR8xDV8UoDWiA3jgsdD+q76uwCRkyi5iXfr/d92WDK0cgnUT9 BEhnNXYla4pvLBqTPl0SsIwQ7c6/GU7aBQpvUVsZFr6lIQEtWnAazK+DVr1X31fkPGWg ngOCy6O8jEE4g7iu+KlFsNs456iRmlC7Ri7CEEb3HiVA98w2ePzIt8VnyiP83/kHEEuZ tGGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705968383; x=1706573183; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rdBgE5wIVLj6TuJkMA8Og1unwB8wxsizIZfcekxtMQI=; b=AHiLcJt+qHgRAXANn+Dj5Ccf0izhJ3Ai8l6471j5aGC+ukRKeIg4bLcEGM/EtqSEuB 2Gxh8yyUMFGmeMZvhRPmsDGRNioLffqXIITMxUsLcjtiPEExPW2ABb/fgKaGomNkWSMZ zrBT68ibledBvqyX+2FV0C9M71JRQ8MCairmwfYmnmVSnnZxGglAMbB8WSL1UVYM2xlp vbfXvwVk0mZFa9SsVIfEWkonsQ8YCs9lEN6JkaQacl5e03JURn/HJZzClUhmQBJWVZKY 9yc3gzVNXZ55yu+b0/zWE94pipEar7Ezw1XExm4T2feUsAVoNhTAhvhZBTnLTF84YSCN xZDA== X-Gm-Message-State: AOJu0YwTSpdd2pyes230Y3V4Y81efCOHkt0xCc0t2/FzqwJEUhWvHVhv sJCiG3ZJk/zE3mMvOQmKYImOJn9Wa0QwuR+cQlnTvc5seqII7kvcwm7fJzpdn9utYewE9Lehmpz o6EUVmw== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:6aba:f97a:4dc7:7e92]) (user=irogers job=sendgmr) by 2002:a0d:cc52:0:b0:5ff:a9fa:2722 with SMTP id o79-20020a0dcc52000000b005ffa9fa2722mr2416222ywd.3.1705968383026; Mon, 22 Jan 2024 16:06:23 -0800 (PST) Date: Mon, 22 Jan 2024 16:06:04 -0800 In-Reply-To: <20240123000604.1211486-1-irogers@google.com> Message-Id: <20240123000604.1211486-6-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> Mime-Version: 1.0 References: <20240123000604.1211486-1-irogers@google.com> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Subject: [PATCH v1 5/5] perf test: Make daemon signal test less racy From: Ian Rogers <irogers@google.com> To: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Arnaldo Carvalho de Melo <acme@kernel.org>, Namhyung Kim <namhyung@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>, Adrian Hunter <adrian.hunter@intel.com>, Ravi Bangoria <ravi.bangoria@amd.com>, Ross Zwisler <zwisler@chromium.org>, Athira Rajeev <atrajeev@linux.vnet.ibm.com>, Shirisha G <shirisha@linux.ibm.com>, Kajol Jain <kjain@linux.ibm.com>, Kan Liang <kan.liang@linux.intel.com>, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788839502076309048 X-GMAIL-MSGID: 1788839502076309048 |
Series | Fixes for 6.8 PR1 | |
Commit Message
Ian Rogers
Jan. 23, 2024, 12:06 a.m. UTC
The daemon signal test sends signals and then expects files to be
written. It was observed on an Intel Alderlake that the signals were
sent too quickly leading to the 3 expected files not appearing. To
avoid this send the next signal only after the expected previous file
has appeared. To avoid an infinite loop the number of retries is
limited.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/tests/shell/daemon.sh | 34 ++++++++++++++++++++++----------
1 file changed, 24 insertions(+), 10 deletions(-)
Comments
On Mon, Jan 22, 2024 at 4:06 PM Ian Rogers <irogers@google.com> wrote: > > The daemon signal test sends signals and then expects files to be > written. It was observed on an Intel Alderlake that the signals were > sent too quickly leading to the 3 expected files not appearing. To > avoid this send the next signal only after the expected previous file > has appeared. To avoid an infinite loop the number of retries is > limited. > > Signed-off-by: Ian Rogers <irogers@google.com> > --- > tools/perf/tests/shell/daemon.sh | 34 ++++++++++++++++++++++---------- > 1 file changed, 24 insertions(+), 10 deletions(-) > > diff --git a/tools/perf/tests/shell/daemon.sh b/tools/perf/tests/shell/daemon.sh > index 4c598cfc5afa..de61e7898578 100755 > --- a/tools/perf/tests/shell/daemon.sh > +++ b/tools/perf/tests/shell/daemon.sh > @@ -414,16 +414,30 @@ EOF > # start daemon > daemon_start ${config} test > > - # send 2 signals > - perf daemon signal --config ${config} --session test > - perf daemon signal --config ${config} > - > - # stop daemon > - daemon_exit ${config} > - > - # count is 2 perf.data for signals and 1 for perf record finished > - count=`ls ${base}/session-test/*perf.data* | wc -l` > - if [ ${count} -ne 3 ]; then > + # send 2 signals then exit. Do this in a loop watching the number of > + # files to avoid races. If the loop retries more than 600 times then > + # give up. > + local retries=0 > + local signals=0 > + local success=0 > + while [ ${retries} -lt 600 ] && [ ${success} -eq 0 ]; do > + local files > + files=`ls ${base}/session-test/*perf.data* | wc -l` Wouldn't it show error messages for 'file not found' for the first round? I think we can add '2> /dev/null' to suppress that. Thanks, Namhyung > + if [ ${signals} -eq 0 ]; then > + perf daemon signal --config ${config} --session test > + signals=1 > + elif [ ${signals} -eq 1 ] && [ $files -ge 1 ]; then > + perf daemon signal --config ${config} > + signals=2 > + elif [ ${signals} -eq 2 ] && [ $files -ge 2 ]; then > + daemon_exit ${config} > + signals=3 > + elif [ ${signals} -eq 3 ] && [ $files -ge 3 ]; then > + success=1 > + fi > + retries=$((${retries} +1)) > + done > + if [ ${success} -eq 0 ]; then > error=1 > echo "FAILED: perf data no generated" > fi > -- > 2.43.0.429.g432eaa2c6b-goog >
diff --git a/tools/perf/tests/shell/daemon.sh b/tools/perf/tests/shell/daemon.sh index 4c598cfc5afa..de61e7898578 100755 --- a/tools/perf/tests/shell/daemon.sh +++ b/tools/perf/tests/shell/daemon.sh @@ -414,16 +414,30 @@ EOF # start daemon daemon_start ${config} test - # send 2 signals - perf daemon signal --config ${config} --session test - perf daemon signal --config ${config} - - # stop daemon - daemon_exit ${config} - - # count is 2 perf.data for signals and 1 for perf record finished - count=`ls ${base}/session-test/*perf.data* | wc -l` - if [ ${count} -ne 3 ]; then + # send 2 signals then exit. Do this in a loop watching the number of + # files to avoid races. If the loop retries more than 600 times then + # give up. + local retries=0 + local signals=0 + local success=0 + while [ ${retries} -lt 600 ] && [ ${success} -eq 0 ]; do + local files + files=`ls ${base}/session-test/*perf.data* | wc -l` + if [ ${signals} -eq 0 ]; then + perf daemon signal --config ${config} --session test + signals=1 + elif [ ${signals} -eq 1 ] && [ $files -ge 1 ]; then + perf daemon signal --config ${config} + signals=2 + elif [ ${signals} -eq 2 ] && [ $files -ge 2 ]; then + daemon_exit ${config} + signals=3 + elif [ ${signals} -eq 3 ] && [ $files -ge 3 ]; then + success=1 + fi + retries=$((${retries} +1)) + done + if [ ${success} -eq 0 ]; then error=1 echo "FAILED: perf data no generated" fi