Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp329970rdb; Thu, 1 Feb 2024 09:36:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IEeXAo8Iws42I7Mep8m7azWRhSuCjslrt8a/ZZDlEjMqb5z8WvdogNp6qzQIt4AK+NizIAN X-Received: by 2002:a17:903:2344:b0:1d9:14fb:d142 with SMTP id c4-20020a170903234400b001d914fbd142mr6869941plh.32.1706808999808; Thu, 01 Feb 2024 09:36:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706808999; cv=pass; d=google.com; s=arc-20160816; b=Bsd9OnqprcDvbzJuRmFOaJ/h2mlb7KZhqTz+VVmWh0YK/b2qrT6Gu+szAVeFnE33dj XuEVBHF3QSmk1gnKYQxtfVbuvOTvrbEL8YCb/qzNdY8YPty4RbA+UwPqoE0hqA4KDWb5 thYkkbVXOdSnAtm45X7W6PYQxs5sgdC8VdX6R5tzXGEJ0ULeUAZQsmIamjbSOfn4eytC JHfHwNPUryXTtnWRIeSBg5LYI6sjXnRUlLPfcz16nzzlel9w4866mbkwNMMLZhLg25Pp KoFKtLNURJZKy6BwEOKlFIySTSbeygsFlUsg1YTzDtqhJzRrXrYjnTALBW2wd+bof5La Niqg== 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=UD3/+3gzKT8fI1Ep9NTewT3g/cKMHmpNqtb0XSkLImQ=; fh=ID/1D6VcSA/a6pxPvbLVM1kphk1cDClqL/UxMSp8+F8=; b=Okt/qz69O+6yuoeIbeQecRlYTi2atgaI7Ej7f84jN+jfymvvO2Gk2ZgNbt21JZJJW6 YNWGXfMWPinymqibY4RB+JAtT49bvHHut5UOr9s0yqG9TUoGXn3ehdl0BCeXe352e0RE rOQuf8scl4AWv+rMRgro8TmbIIBia5nQDFzn4INJLBikntip0jZR6kVarL94gAv/v3Wb +Z7W4ESao/WxizCvDHJ2+udG0Gn48xkK3ldYU57+htc3lYOWVd5BxHTs9PIwYkYCQdOu D4io++gQ3rsDY49+mYbNPS8zuGsxlo+dcOH96qGV/Svi0Uw4UQHtelCWeypKqa5SO+Dx +zNA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=nmpgKxQV; 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-48597-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48597-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; AJvYcCXrzK8T/OxEQhi8o+pNdz1QzgEXKyU00vzXwtxbPcpnfVHLyIKapR2e3DCMU9cXmlwOhBqpPGOH56DeWbAAB8e/Pop/SSzCf+PGsZUKzA== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e6-20020a17090301c600b001d453cffb92si129657plh.620.2024.02.01.09.36.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 09:36:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48597-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=nmpgKxQV; 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-48597-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48597-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 E124829302C for ; Thu, 1 Feb 2024 17:33:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5DB195C031; Thu, 1 Feb 2024 17:32:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="nmpgKxQV" Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.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 320EE84026 for ; Thu, 1 Feb 2024 17:32:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706808766; cv=none; b=H9h2wx5c2zeiLzYRCWRXrxpLEKpm29eElslOo8llqIbBIb0Zaww9p3qu/rNlmb4QHtMy0Ru7HRYGfguDWSaJ95jk4XMytFZoEgWu8ds/uCLFJrdRfP2Ck1S0wcmnsgRMBYqiTEHj1WDL2jcpMHzy68Kzb++E8Ty/6Byq5rrDJ5U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706808766; c=relaxed/simple; bh=MYQeElrn6RP0xY9MrtM5r3jpd3C3Jxbd1CwNKrqS/qk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=UTR3fmUYH7ZJgc8oP0eO7JTX2FHxMZZKfWF25EO9skmHEBfVO353DvDDsnSGpXcid+x6kLeilnK/Wgkat+V8wNuHWuzgM1CPPvOamJpldhw/LCYdybh1W9kPfWoaakIXXdiSND4VrSg3XsEc/Ndq+5BxwiyqArhpyE7tkOIGnZU= 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=nmpgKxQV; arc=none smtp.client-ip=209.85.215.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--seanjc.bounces.google.com Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-5cf962e1fcbso1204205a12.3 for ; Thu, 01 Feb 2024 09:32:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706808763; x=1707413563; 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=UD3/+3gzKT8fI1Ep9NTewT3g/cKMHmpNqtb0XSkLImQ=; b=nmpgKxQVvdoUqnFo/LTKfILhjMKZXfkEYE2niej15duz6hlc9dksQ6dU/l78O7MWNj 63KFlkvuf/QY1BNozo/Q6bLZm7rSBekZA4cQ/dTc5Uii51G5A6P00Gg4EGGg4iCPlL1l 2Wd1VnUqojZG+2nOF139BEge3bxBFX+hwCDmN/SIdAfKrT3wwcGj3MLznzex4lEmnHcX CNechPbqLcMNO2TNRzILih5BpjrPYSYRcToGMTu5U8TAow1PhAFqOz2uQLzhwIY1G5Wa pHqedtBYyOx22mFc5KOmfvN+inAaUtCfeh02f8n81r+wzif4OfUjcOks2PDtfb7t/MKr NMKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706808763; x=1707413563; 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=UD3/+3gzKT8fI1Ep9NTewT3g/cKMHmpNqtb0XSkLImQ=; b=IVxTrvyTPxMTZ+RYPEemm0PwPbLRXcx9XeiEM06rT5/z/JAhc5PK+SddLxpEsV/cZW Y6B3YLv92YGFa3MVwlSCpE5+gHRUEy9jSJzxV9zujC4xMIzNuDQeoYyUxhJt5fdmG8Dp k+7pNxK/b2Wv+WEXvfn47ghK3IxwuhyqGB9W4xUVROtqp1JFvfD+l/1VVWR3jo/W0uxV S/Cfi2MvmVSO3MzzfQ4wq8gU0giI8NK/nWVlXZLF3MlKQLjNfD1OfDl3KpiBq7mzZivV SfDU2w+nXhA5pW4RFyvLQry/EdwiTSSvMpsGzD7KgfRRG+xkBl1pwAVqdHGS+tfjUSpt Xlhw== X-Gm-Message-State: AOJu0YxfK2k1MJKaXuvJtnlcQkH0Hfh5GzFwWdK6Yzi3pVCZZQsfr0wB BQJs4fnS97URTnOxARtdf5rIn8kG4oZjDekFuxPIC60ajz+UMT044B5k+f804UBUFmLrpfbluVS 8LQ== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a65:6641:0:b0:5ce:474:352b with SMTP id z1-20020a656641000000b005ce0474352bmr12944pgv.5.1706808763674; Thu, 01 Feb 2024 09:32:43 -0800 (PST) Date: Thu, 1 Feb 2024 09:32:41 -0800 In-Reply-To: <510f3534-b076-4d23-b4b8-361c1f872d57@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20231117052210.26396-1-shahuang@redhat.com> <510f3534-b076-4d23-b4b8-361c1f872d57@redhat.com> Message-ID: Subject: Re: [PATCH v2] KVM: selftests: Fix the dirty_log_test semaphore imbalance From: Sean Christopherson To: Shaoqin Huang Cc: kvm@vger.kernel.org, kvmarm@lists.linux.dev, Paolo Bonzini , Shuah Khan , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Xu Content-Type: text/plain; charset="us-ascii" On Thu, Feb 01, 2024, Shaoqin Huang wrote: > > > /* > > > * We reserve page table for 2 times of extra dirty mem which > > > * will definitely cover the original (1G+) test range. Here > > > @@ -825,6 +832,13 @@ static void run_test(enum vm_guest_mode mode, void *arg) > > > sync_global_to_guest(vm, iteration); > > > } > > > + /* > > > + * > > > + * Before we set the host_quit, let the vcpu has time to run, to make > > > + * sure we consume the sem_vcpu_stop and the vcpu consume the > > > + * sem_vcpu_cont, to keep the semaphore balance. > > > + */ > > > + usleep(p->interval * 1000); > > > > Please no. "Wait for a while" is never a complete solution for fixing races. > > In rare cases, adding a delay might be the only sane workaround, but I doubt that's > > the case here. > > If that's the case. I guess I should keep the current solution. Except you > have any better solution, please let me know. Unfortunately I don't have a better solution, and I don't have cycles to stare at this deeply to figure out what how to make the synchronization rock solid. Sorry :-/