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 X-Spam-Level: X-Spam-Status: No, score=-5.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66C02C4707A for ; Fri, 21 May 2021 15:02:39 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 029A8613AF for ; Fri, 21 May 2021 15:02:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 029A8613AF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:53766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lk6fe-00074K-0P for qemu-devel@archiver.kernel.org; Fri, 21 May 2021 11:02:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52786) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lk6ep-00069P-CG for qemu-devel@nongnu.org; Fri, 21 May 2021 11:01:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39514) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lk6eg-0001mf-QC for qemu-devel@nongnu.org; Fri, 21 May 2021 11:01:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621609293; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gpfQ/LlPNJZukpR+Y+iWPKY7Wd6EWYnkC4Jv8h8KANM=; b=edj8li013Pkg16Ji4qKKh2oee2KaqGuMKjwp6dVXlqlEVLak/k/XeCvxj83Cnu8RdURIBX 6iqVMIFZ0J8IrzFIFpE2qX1t+f0Ya66dOWM0H/RBtPuxVJkgU0IUE2z439KlXwC5ifMP9i DxilQpLcQcOPATiYartPOc2U1O0x00c= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-446-lB5YR7r9Nvm8LG_epz4k0w-1; Fri, 21 May 2021 11:01:31 -0400 X-MC-Unique: lB5YR7r9Nvm8LG_epz4k0w-1 Received: by mail-ej1-f71.google.com with SMTP id nd10-20020a170907628ab02903a324b229bfso6339695ejc.7 for ; Fri, 21 May 2021 08:01:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=gpfQ/LlPNJZukpR+Y+iWPKY7Wd6EWYnkC4Jv8h8KANM=; b=WFIyjv9ZODuVDGcaXRr4+KdpakmmAPtg2+ZgQsNy7LgfRNoG1lriQo4ut+/KpsVoJA 7TgHaIyZeaOA/4UBN7qQkmJ2HB2EyBQGBVvHGcRswsUYsVB6RYx4qSY6Yzl7mVNOkqxv EoFeKfHE0uz9ErIAqPYSJ1IlA78lA3CYSqsErVnCXDHH/AravD9+I3aV2UEnEtWgMEex 4v76vaX1yHYSj1oNkkhRdViFct2TupV7Q4OyoEeydtCubVAy6UAS+UHUWLMrmCXPnQmX 9PzJ0jlu9Qq/OFxtSbD9DcGKmiFa1fXqwBGKXMrPxPNC64KjS/EPC/B78Mpw+/1AXXxD P7Jw== X-Gm-Message-State: AOAM530qyPFGvansGeHatcT/9cHrIEESDazSdkpJZiEvw7v2sZMu4khZ QS78dp1k6uPWFK7sf4O5BSZNhqQYwvR++ehiAj8DIpDalhnlzpa7xTHqSU3gSRS4JmGOGd4A2Ey hZ/ZsbcDkLnRuVhvOcBYfIU0umH896DiFVXTbwSYjjwc9LmU+B3AAaLSyyG0nlhDSKeM= X-Received: by 2002:a17:906:a51:: with SMTP id x17mr10844391ejf.25.1621609289854; Fri, 21 May 2021 08:01:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcHm293jogC6iVB2TFklg6/69q/lLbimGqRmSLY2gEmt0hyL7XClpCt+VXIjpANXHH8Mp6XQ== X-Received: by 2002:a17:906:a51:: with SMTP id x17mr10844359ejf.25.1621609289490; Fri, 21 May 2021 08:01:29 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id c22sm4181706edy.59.2021.05.21.08.01.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 21 May 2021 08:01:28 -0700 (PDT) Subject: Re: [PATCH v2 5/7] block-copy: add QemuMutex lock for BlockCopyCallState list To: Vladimir Sementsov-Ogievskiy , Emanuele Giuseppe Esposito , qemu-block@nongnu.org References: <20210518100757.31243-1-eesposit@redhat.com> <20210518100757.31243-6-eesposit@redhat.com> From: Paolo Bonzini Message-ID: Date: Fri, 21 May 2021 17:01:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.374, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , John Snow , qemu-devel@nongnu.org, Stefan Hajnoczi , Max Reitz Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 20/05/21 17:30, Vladimir Sementsov-Ogievskiy wrote: > 18.05.2021 13:07, Emanuele Giuseppe Esposito wrote: >> As for BlockCopyTask, add a lock to protect BlockCopyCallState >> ret and sleep_state fields. Also move ret, finished and cancelled >> in the OUT fields of BlockCopyCallState. >> >> Here a QemuMutex is used to protect QemuCoSleep field, since it >> can be concurrently invoked also from outside threads. >> >> .finished, .cancelled and reads to .ret and .error_is_read will be >> protected in the following patch. >> >> .sleep state is handled in the series "coroutine: new sleep/wake API" > > Could we live with one mutex for all needs? Why to add one more? This patch should just go away; the QemuMutex will not be needed once QemuCoSleep is thread safe, while right now it is still racy. Paolo