From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2BFDEC433EF for ; Wed, 20 Jul 2022 13:07:48 +0000 (UTC) Received: from localhost ([::1]:50858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oE9QZ-0007lj-4L for qemu-devel@archiver.kernel.org; Wed, 20 Jul 2022 09:07:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59378) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oE9Pj-0006BX-5I; Wed, 20 Jul 2022 09:06:55 -0400 Received: from forwardcorp1p.mail.yandex.net ([2a02:6b8:0:1472:2741:0:8b6:217]:46548) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oE9Pf-0005yI-Aa; Wed, 20 Jul 2022 09:06:53 -0400 Received: from sas1-c73b4b4f4b95.qloud-c.yandex.net (sas1-c73b4b4f4b95.qloud-c.yandex.net [IPv6:2a02:6b8:c08:12a9:0:640:c73b:4b4f]) by forwardcorp1p.mail.yandex.net (Yandex) with ESMTP id 8A9FC2E13D8; Wed, 20 Jul 2022 16:06:40 +0300 (MSK) Received: from [IPV6:2a02:6b8:b081:b715::1:28] (unknown [2a02:6b8:b081:b715::1:28]) by sas1-c73b4b4f4b95.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id DWUSPGdYdH-6aOGu8Jn; Wed, 20 Jul 2022 13:06:39 +0000 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1658322399; bh=L0/wLHX8TVuN/N4WgiC7eigo1Bq8XBOctvR18pgkSII=; h=From:In-Reply-To:Cc:Date:References:To:Subject:Message-ID; b=w+4kak3RUjEF3ekaDYejjL6dfwd98X+CUhx3FmBg9+dmySLLd5eO8inUdvbXE4x/0 QVf3hN08++kzIauwpFx1T2/N2c35D/FCDINFfCGNSVBiy7wupmozyosu63tjO8JCJl RBHSt1MqnP8cVAq8PR8KSLjPBjl9CR3DVfPAALqA= Authentication-Results: sas1-c73b4b4f4b95.qloud-c.yandex.net; dkim=pass header.i=@yandex-team.ru Message-ID: <1a2e7a92-9943-01a0-168c-73928d7833e8@yandex-team.ru> Date: Wed, 20 Jul 2022 16:06:36 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH v9 09/21] jobs: use job locks also in the unit tests Content-Language: en-US To: Emanuele Giuseppe Esposito , qemu-block@nongnu.org Cc: Kevin Wolf , Hanna Reitz , Paolo Bonzini , John Snow , Vladimir Sementsov-Ogievskiy , Wen Congyang , Xie Changlong , Markus Armbruster , Stefan Hajnoczi , Fam Zheng , qemu-devel@nongnu.org References: <20220706201533.289775-1-eesposit@redhat.com> <20220706201533.289775-10-eesposit@redhat.com> <8726804c-5dbc-bc27-3922-a00ae676941d@redhat.com> From: Vladimir Sementsov-Ogievskiy In-Reply-To: <8726804c-5dbc-bc27-3922-a00ae676941d@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2a02:6b8:0:1472:2741:0:8b6:217; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1p.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 7/19/22 15:00, Emanuele Giuseppe Esposito wrote: > > > Am 11/07/2022 um 15:08 schrieb Vladimir Sementsov-Ogievskiy: >> >> That made me ask: >> >> 1. Are all tests always run in main loop? If yes, why to protect status >> reading in test_complete_in_standby() ? >> >> 2. Maybe, we don't need to protect anything here? Why to protect other >> things if we run everything in main loop? > > I think it's still good example and practice to protect a function if it > needs to be protected and its name ends with _locked. It would just > confuse the reader if we don't protect it. > Agree. But still, I think we should be consistent in such decisions. If you don't want to protect job->status in tests, then you shouldn't protect it in test_complete_in_standby() as well, just to not confuse someone who read the code. -- Best regards, Vladimir