Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2487539rdb; Mon, 5 Feb 2024 08:03:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IFIfLaR6X8vHiYXeFD1B0TncLITP97CaK/YrIB9gvv130UWVYz57niYTkuvksFV866AXYNi X-Received: by 2002:a05:6a21:3984:b0:19e:3fce:c36 with SMTP id ad4-20020a056a21398400b0019e3fce0c36mr13010517pzc.3.1707149012426; Mon, 05 Feb 2024 08:03:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707149012; cv=pass; d=google.com; s=arc-20160816; b=Ftykuq7Cv4NI/s4Wtmdy5UJOvXkdVj5vlDUAEAvDjZBjOopbfZBjAbZ5HvZC1ijBM9 bqpJErql1fRkxuECwwgnk49V2QsbVafAqy1K1JRVU3tm53tRXSnkx0cM912ksm4WtsjS BJ/OUwR2C+Bw8xR5/f33jKPyGne+f49BCsJeinSjScujcS3TUEJJkZdLynlEkH2alA56 kBjBafxKbPvUI2ER3hKpQAMgDcEqdJEQr4HVMHlOWbVBkhCPNhSD9TMKtwLEH0AJOcAc /EpnjrU7ppFHiM3oJP6kynxTXQphr1eB6sLvMr9cMb3X5cL2BQTQbr8OYYjLPATfXLPX 1tEA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=+Ca1DgeOD/Evth6Nl9wg+8TBPqKi43Qu1Qd6uanxITM=; fh=Uept5K3DGsLvTrWOjWdwHlG8MRE383GiVuX6Vd3OVGY=; b=DGVj+hu14VXbx6wk+GB8yt6kx0Kmqd8daXgg0pNevAx3dlx4slhpSyL57WncX0dO7j sLwGF3kLAohnjUlH1v20yAIMjW3VYH6dqa87vb5w9ZOEDlRx70Zy87kDQ+hw+T4x/BfA wXfnAXEsO/Ek8w7/JbwYB9m1jmvOSL8QtXeJO0CMT+LGVX557fCIat2LOhqbhCyUAAGg DenrC5H67D7KHSoLCyPDnUdDRjMwRYDcTNr5SJr6yHcsTzw45XMQTYtMJezGK314pCB6 1jDlbK/n6N7jW8B39zYG6dkW6MTo9b4aniyBKdicJCQnT5pJuaKkKioHW+5CQhfEyFw8 jq/g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="uSkN6g/x"; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-52943-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52943-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=1; AJvYcCUQRkr7ak/vJGhtjR5thpjMO1Zi+nGY8ZHSc28MLy5O+4f39wCcX9zJt68t8AM4w4NoPsuENlyKhd7qnpOBCivDvLa1BRvmI9X9w1niRw== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p21-20020a056a0026d500b006db7051845esi7366pfw.42.2024.02.05.08.03.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 08:03:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-52943-linux.lists.archive=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="uSkN6g/x"; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-52943-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52943-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 8AB51281337 for ; Mon, 5 Feb 2024 15:48:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 94D5A32C8E; Mon, 5 Feb 2024 15:48:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="uSkN6g/x" Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (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 58AD82E634 for ; Mon, 5 Feb 2024 15:48:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707148122; cv=none; b=qdbXdc0Nqs0KnH9nEE1Uvj8ISagNwmj80dWp4MpU0+vELbZRYVOxrPE7QPvwL8cfpO6EjTxfwNluTiru2YaNKAFnwDgPy19kqb3gfGjItKY89RzxvSj/w8RirTK7IdCPh59zGJ9J5kgr/qMSH3MWM/QIOcl9F2yaw5U2HCJDx4w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707148122; c=relaxed/simple; bh=7rkf12TOWb99NCO8cw69r+ag/35aJdcQATF4XdTqq4w=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=pAwbM2coxAyrDyb6OUEO0T0572MBzjZrpnFHbTjRCHh/xR6d1odTdUnpq6n61b8nX0UXQPBxg0y5aOsRpbRyxX3CgI/TiXVLR+2d6SHREp/gIUwlSVpl3KwBJ+3GLrTMwbdmzZ2/JnSZPssZkXDOSUImkz2WeuwvmqJQzMD4g60= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=uSkN6g/x; arc=none smtp.client-ip=209.85.219.202 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--seanjc.bounces.google.com Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dc6cd10fd94so7738845276.3 for ; Mon, 05 Feb 2024 07:48:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707148120; x=1707752920; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=+Ca1DgeOD/Evth6Nl9wg+8TBPqKi43Qu1Qd6uanxITM=; b=uSkN6g/x/nZBqufRasYJeycKiMotRIy24BE0RyL2w4na2yJAsyZF3uMoX56+G9QKhE IMc5kjAlrHquAH81S1AE78dNIuqjPblNj6ktGPO+UaaJVq/Sunz2379b3F2pRGfS0eKm fcwCn/XaAWpADaS7K8Ia7EBKwEK9tAkCt7SSgUclik+vBXEauPLFPHitRzFhapWDmR+u 6WN1ZMFHeqwgO8EEh8k4g/kYZmlKPMcGi+aWR40+rk251xppcd7bBPlUPtyFnnpEQeeX vS0m3KxVAPdMvwReq3USn7IZLuEkeUOmp61x7ZpYd60LoxoORI07cj9s31efQ32MkaqW kR/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707148120; x=1707752920; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+Ca1DgeOD/Evth6Nl9wg+8TBPqKi43Qu1Qd6uanxITM=; b=hyrkleUMbLe1I+XVfmCAH4sc2UsgmCticB6O+cZKdgzyoaYk+fDo9MwXazGmA5YGjw E2aZoIT7w70Q5+9gGvKwuxwHaNq0V7H9eqnci1kCRF9ld8aCzzjXhK6TA4d4S0LVVTve CVEVeG4NJOcch+anwpDZ7Qc6IUo+ADrtoQuGZPMEs0zEvifEUc0eBhc0l7dHkfVwWzrT dtc6j++PkUbHpmBLEXxXFwYdJd91vwRR9KPjmL6NANBEj+ZMN39jRGQIbu1kOJsoJF7l QuYEtCI0BsCZX7Eai7kfkK+27w7ZM8VJ7e18HBG70MjQkUq+k9wYAsrZQzvk0D5GaquA pKuQ== X-Gm-Message-State: AOJu0Yy1xz5TJeWBLO6KhQeVQ6W7F/QpsmGLd0hlW5bNNziV0gLTFJfL V2wCATHWxlW0CYUZAFFuJef6A1okdkkMTYPTWWcmi6Qyq6UrhsYUIjJmuA2MLF3gZS5oSUHaMhD 5WA== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6902:138e:b0:dc2:1cd6:346e with SMTP id x14-20020a056902138e00b00dc21cd6346emr4365042ybu.8.1707148120444; Mon, 05 Feb 2024 07:48:40 -0800 (PST) Date: Mon, 5 Feb 2024 07:48:38 -0800 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240202064332.9403-1-shahuang@redhat.com> Message-ID: Subject: Re: [PATCH v3] KVM: selftests: Fix the dirty_log_test semaphore imbalance From: Sean Christopherson To: Peter Xu Cc: Shaoqin Huang , Paolo Bonzini , Shuah Khan , kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="us-ascii" On Mon, Feb 05, 2024, Peter Xu wrote: > Shaoqin, Sean, > > Apologies for a late comment. I'm trying to remember what I wrote.. > > On Fri, Feb 02, 2024 at 01:43:32AM -0500, Shaoqin Huang wrote: > > Why sem_vcpu_cont and sem_vcpu_stop can be non-zero value? It's because > > the dirty_ring_before_vcpu_join() execute the sem_post(&sem_vcpu_cont) > > at the end of each dirty-ring test. It can cause two cases: > > As a possible alternative, would it work if we simply reset all the sems > for each run? Then we don't care about the leftovers. E.g. sem_destroy() > at the end of run_test(), then always init to 0 at entry. Gah, I posted v4[*] and didn't Cc you. I would prefer not to reset the semaphores, mostly because it encourages sloppiness in the test. There's no reason to allow the two threads to effectively get out of sync. [*] https://lore.kernel.org/all/17eefa60-cf30-4830-943e-793a63d4e6f1@redhat.com