Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp898069rdb; Tue, 23 Jan 2024 20:31:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IGfPL8jY+lRuEQHjndU5Zrh0aS2piyfjTn9H7tBqD/bGT8sSpmFMfrmy03h/RBwh7vZxLWO X-Received: by 2002:ac8:7e8d:0:b0:42a:4a36:d237 with SMTP id w13-20020ac87e8d000000b0042a4a36d237mr2253642qtj.12.1706070698101; Tue, 23 Jan 2024 20:31:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706070698; cv=pass; d=google.com; s=arc-20160816; b=dYwzlIQFg5MgMaFm8et0B17Wc36q9B/0OFgA47h9j5LmXcgjBARIvtpbFzQ4QgMLnm mOv6BX+craDWmyprO7AfnzIEdfSP7Uox/KmxpXIqHlGVt4TO88ELuwLvwq5OVYes8Mzh idgXbqQRi4EWfHy+0zUS9D0sbOTYXc4SHKZpioCWrXt2+HZME+QVifvT+xHAdmu9G1Km HXtgs+umfb8MWM8yi2cm+h4bEmbl/Sg1ui9m2N3/pVs1pqMY1q7QO1kSj30Q1INN3yQt ypJixCzf21dINGDHmax5xOtq8fD30FJB2Oy86PV3MEjACgwmaaiU85El5/GBgRNvAZSC IwFQ== 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=+SLazpc0GwSHvqXNx6aE49dIdTieh1SbCFqUC1qSvB0=; fh=OSPvvrodhCXrbS0tgWY7ZQ1FjQjyOgKyIFsZYsPrQ8s=; b=ImAJGcOAnxJPCoYH4ADkfRZn3a9rA4Q8ZV76Zxdhdh+JNiF2qAJ8Nmx2i4afrUxDhw nKo4KMXys0DL5t3tDZx+0L8rRO3oSfS/10G/RKZY+tXRFSibnkGe/tPD0KukWsV1+FMI dPVWneSkPlA2nYpQZGNKMjyZN9B7aCmbo9Gy+5fJaUqB954a9EIXsdfOeZJANFkpJTio Zc1OeGuqtHpeWma6gemJLsGWcLojVBJrRhFiawr+vV2tZBbvhJMcwoxL1hTj1YikWcey 181txB8tZHUjQZFhK0yd8WKrGU3ry5LVhLCpJTDWQ5L9YHalt20JbET9hSTewnGAkHsU ZXMg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=w9rYoI0V; 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-36431-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36431-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id n16-20020a05622a11d000b0042a5f412fedsi274278qtk.604.2024.01.23.20.31.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 20:31:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36431-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=w9rYoI0V; 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-36431-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36431-linux.lists.archive=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 8F89D1C27220 for ; Wed, 24 Jan 2024 04:31:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D066F168D0; Wed, 24 Jan 2024 04:30:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="w9rYoI0V" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.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 911AA16423 for ; Wed, 24 Jan 2024 04:30:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706070633; cv=none; b=KPz/BilwzaZObbKF3C5wwlAuA5IzJSvbBaYPQwttU5CPU/RyqYUnBTpAVwF9957CRf4DZ63WszJZKP7sXfC+tEO1qAL2/ceLbtwQQvWD4bCBkIzir9mlxy2PgjGewNzSGW+xndh8h/TneugKFJ9SivCjXXztEp7FrKJYNyz467I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706070633; c=relaxed/simple; bh=ktGpNrNpovCGFIfJRaOQi+xr2H2KIZoGJ+VlEz/s/Vo=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=RQ1Jtu8PIgMuT8XuFQ2syOSYv8YzWOG+qhG65cmOmw3WnTxOyZDgHXa1HiMo89Qtp97VT5jr3Yk0nIcSu1ZY7PhQLyGA8GepWs53kRHvPI71UFON86crGGPnhE/wzmDVzFb+BYDajtTeszqz79p8LSBIU8L9/2VSAsQRZ7IpbJQ= 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=w9rYoI0V; arc=none smtp.client-ip=209.85.219.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-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc237543b74so6293675276.2 for ; Tue, 23 Jan 2024 20:30:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706070630; x=1706675430; 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=+SLazpc0GwSHvqXNx6aE49dIdTieh1SbCFqUC1qSvB0=; b=w9rYoI0VC/n0+N1BXqN0wR5GvES+itnZSlgYVYhf+hBkztuWcrR/lLol7E3iCVOxxt Jsds3SjJfmUw+buZDuSaU2VTyOynjwqZRQnKo2UqXXyc8M/J70H8aPhbIyfMudziRUc2 6TyH3bwTESexsmpMfQIBQOW44bMKptUAfGH2xNTYUK9n/NVglx7gKzz2V4FChBXfTP0f rS1mnX114luPPooIVsC34tZFi7d52xGz4lECMt7clnyQb4Uz8uH/qGz/2X0iz+Q74viq 3uS5Wx0eK29slo4CF0Y4NfxvhN0eTI5VqpWK5he5bgzuZDLmbhBR9ftxELzoZdcXFrON h7RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706070630; x=1706675430; 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=+SLazpc0GwSHvqXNx6aE49dIdTieh1SbCFqUC1qSvB0=; b=S7FICteoyopw5pXbT5NElQLDMBY7cvOaXz5KZaEgjxkbfmdr1B42PilIsttTG6x9f9 i7CNJQySl1BqCJxBeEqhQMAFnmAX3cZEy9KzsStvMYPsaYNjiXX7OCQgoL0Q7JL7p/WD VzRbfezLlsgVFOO6NgN+ureg+MwnQvc99c6ZXWl9iqgyalslzvPJR1z8mcBu0jHvzb8k 9QXSLhqOoFNGZh0NKusq9cdieq3A9tPOF6elCY2EFpUTnzFvP0LqPUQUd4H5SIEG6gv0 KuX0DzJMleafpxNGRqRuBsVwnmiwf39BO8ATOJ0jxHYbIREWYhPLLwYC/chfTT3B/nxa HdqQ== X-Gm-Message-State: AOJu0Yw6j0N5qf/CE3BYvoJ/vqkpnNhUajFI33UUhyoWmENDBYQucH1Q z0/GFzRExf8rxSEMThFdHlJUf3+fq5jETmgD8BAyJRmlnQKksNk7fpOiQ84fC5pI4QFP/u43V1e WMMg81w== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:b37:2438:2b2f:daae]) (user=irogers job=sendgmr) by 2002:a25:d683:0:b0:dc2:57c9:b44d with SMTP id n125-20020a25d683000000b00dc257c9b44dmr14640ybg.8.1706070630536; Tue, 23 Jan 2024 20:30:30 -0800 (PST) Date: Tue, 23 Jan 2024 20:30:15 -0800 In-Reply-To: <20240124043015.1388867-1-irogers@google.com> Message-Id: <20240124043015.1388867-6-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240124043015.1388867-1-irogers@google.com> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Subject: [PATCH v2 5/5] perf test: Make daemon signal test less racy From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Ravi Bangoria , Ross Zwisler , Athira Rajeev , Shirisha G , Kajol Jain , Kan Liang , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" 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 Acked-by: Namhyung Kim --- 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..e5fa8d6f9eb1 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* 2> /dev/null | 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 -- 2.43.0.429.g432eaa2c6b-goog