From patchwork Thu Aug 22 17:31:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ryan B. Sullivan" X-Patchwork-Id: 13774003 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4327A47A60 for ; Thu, 22 Aug 2024 17:31:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724347895; cv=none; b=HSNU21zi+nyqKwI8eLCZNeF6qjVuvGYcEuljN0pwbucmHU8lGZcEEKqSpINyjZp+LE6dmW7e1gtOoRMrO/XvXxPl1hMHRgg6CocDyT5UhmErzfugj7LYpe5IKtIaKpw5GiBAm2DpjE5NJizlTx10lyYnVCmwP1A0/PocXj9TFr0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724347895; c=relaxed/simple; bh=SjFhoCwvPABXmT0ob4IoesfdJHdQ49/eTWzzaUUsCZE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=jhUld8qjdDrGrfPUWsFa8NRnHsmnyiY8eQgh6GrJJ5uVwXVvHeUi2ab/oBc3PA7KE8maspPw9enoHKbrrkgQ09AewtGQCzLYdfF77b42sYCCDpjZpxCnIgLKyA+vc+n9FIp4Wxd5c6aiyNG6aF66yM3+rSOLMrT5EDt39mqOG+8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=AZRhz2FT; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="AZRhz2FT" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724347893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=CVNpDJyXVCWhuewGfxBVKmPR0aHIcDMgy2nP1xmWxjg=; b=AZRhz2FTaNtPIcc8++Q7MeMrXPc7VURYwG3OZiXHnItyMCmGxGZk/3uI0cPvNggegQHZgy ppFk+KOS2qPdCP0DngfeAkqMot7MoFirC1rdDyrVTqk5llcW1Yy/WgX7n0NTJ7okdBMPP/ qHP0SxwgcTDgWoIZH5iiUWKF9MmobNA= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-78-1vfKKIvhNp-BJPmNy9ct0w-1; Thu, 22 Aug 2024 13:31:29 -0400 X-MC-Unique: 1vfKKIvhNp-BJPmNy9ct0w-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7D0C61955F45; Thu, 22 Aug 2024 17:31:27 +0000 (UTC) Received: from sullivan-work.redhat.com (unknown [10.22.64.64]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3D0FC1955DA7; Thu, 22 Aug 2024 17:31:25 +0000 (UTC) From: Ryan Sullivan To: live-patching@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: jpoimboe@kernel.org, jikos@kernel.org, mbenes@suse.cz, pmladek@suse.com, joe.lawrence@redhat.com, shuah@kernel.org, rysulliv@redhat.com Subject: [PATCH] selftests/livepatch: wait for atomic replace to occur Date: Thu, 22 Aug 2024 13:31:22 -0400 Message-ID: <20240822173122.14760-1-rysulliv@redhat.com> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 On some machines with a large number of CPUs there is a sizable delay between an atomic replace occurring and when sysfs updates accordingly. This fix uses 'loop_until' to wait for the atomic replace to unload all previous livepatches. Signed-off-by: Ryan Sullivan Reported-by: CKI Project Reviewed-by: Petr Mladek Reported-by: CKI Project Signed-off-by: Ryan Sullivan --- tools/testing/selftests/livepatch/test-livepatch.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/livepatch/test-livepatch.sh b/tools/testing/selftests/livepatch/test-livepatch.sh index 65c9c058458d..bd13257bfdfe 100755 --- a/tools/testing/selftests/livepatch/test-livepatch.sh +++ b/tools/testing/selftests/livepatch/test-livepatch.sh @@ -139,11 +139,8 @@ load_lp $MOD_REPLACE replace=1 grep 'live patched' /proc/cmdline > /dev/kmsg grep 'live patched' /proc/meminfo > /dev/kmsg -mods=(/sys/kernel/livepatch/*) -nmods=${#mods[@]} -if [ "$nmods" -ne 1 ]; then - die "Expecting only one moduled listed, found $nmods" -fi +loop_until 'mods=(/sys/kernel/livepatch/*); nmods=${#mods[@]}; [[ "$nmods" -eq 1 ]]' || + die "Expecting only one moduled listed, found $nmods" # These modules were disabled by the atomic replace for mod in $MOD_LIVEPATCH3 $MOD_LIVEPATCH2 $MOD_LIVEPATCH1; do