From nobody Mon Feb 9 09:34:26 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1587486483; cv=none; d=zohomail.com; s=zohoarc; b=FBHcE56eZaw8y+5jolzNo/3TfJOCGM2bJz/eW8v0y5kdqzrhnHvKBGPR8aOlQwMpQxTJZ84f8FJTW3cGfZMqgsFeyAKG52iFiX+jCj0SpZeFOitAQZtMIzMoxVguk5EHhG765SlGoXl+ctxks8ldeY+ZIu/A4cLXOxyD7Gim080= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587486483; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=OK+DIsPslG72w2IO6pbi47ldoAbHvOu1kXaqnZ0hY+0=; b=mwjCISeBiGnc7sPoZ4Q1a1+iu2mbXXmbo90wRfAvo2t8pDblv1cylzXHg50HvpvKHVzwE01NWSiD6R/ET97FXhLq0TLMDr+zMsfGIE1+tHz0JcPMjJhEiWKSrPBS+3YfgoBAgER0tNAy5cbIDzDtQSor7yajGuHyAtzKWMJFQDA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587486483237834.4580357947589; Tue, 21 Apr 2020 09:28:03 -0700 (PDT) Received: from localhost ([::1]:32934 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQvkg-0001Rp-03 for importer@patchew.org; Tue, 21 Apr 2020 12:28:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54084) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQveR-00011J-8m for qemu-devel@nongnu.org; Tue, 21 Apr 2020 12:21:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jQveQ-0004DU-Lb for qemu-devel@nongnu.org; Tue, 21 Apr 2020 12:21:35 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:22107 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jQveQ-0004Cz-7Y for qemu-devel@nongnu.org; Tue, 21 Apr 2020 12:21:34 -0400 Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-169-mbqNGD1CO82q49E-ozeCcw-1; Tue, 21 Apr 2020 12:21:31 -0400 Received: by mail-qv1-f70.google.com with SMTP id f4so14336537qvu.19 for ; Tue, 21 Apr 2020 09:21:31 -0700 (PDT) Received: from xz-x1.redhat.com ([2607:9880:19c0:32::2]) by smtp.gmail.com with ESMTPSA id n10sm1888503qkk.105.2020.04.21.09.21.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 09:21:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587486093; 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=OK+DIsPslG72w2IO6pbi47ldoAbHvOu1kXaqnZ0hY+0=; b=JnMIJDw9A3YKQa2ndHEPLR++TcJ9mdxdtTEF5OwBsvsR1VRuJkcEehg/HiKzFowssE4dYT MftHRWYpcuXEBbWtHXrDbjepj31Q5LngMGVr9xKKyra9AYz2vodoDwc+jipumK+z1VxWAO rtdSEDtKE37XPNkbiqJ69foN/uISabc= X-MC-Unique: mbqNGD1CO82q49E-ozeCcw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fRMHDItsx9hNNfR+euE1kI/dNdII4x7dwM+Q4RAjUSc=; b=aVuDdUIqcN5kUkxHEuGAopMeOYoCJ56OalqXqvTU/Y4cjIIcsu5VlGmHxl5GJCLCFM pMfT8Xm6CbrevRG2K0Hq7bHE6knFMIZsk+36bNb3h0FqVaXrn0bN+9DLLI54+MhOXUwi QB2DJgXDl7O42CEC8qv9suqh5Fpacr5anjRI1AlIcPtHrmPvps/vlCzpXapDV2E4/hEm 3ToEOv9LbtJQ6+VyNPB5Ru/CoBWcWQWVpKwVbljvS2ICXEfF+HUiwXEozHLNENVd6rGY WMjueYHWP7M0ImsVijsLYcD8UbZkKc8G3B++H1YAPRkzxxy2TDnNULZXSdpbiqiLKrIS HNgw== X-Gm-Message-State: AGi0Pub68w5TH4iqy85YFSiNtUh91f2zGh6B/A9Jb2OlFh7HvT1u+DuM EQdcAjI0XHC4S+IcbzpVXvbaqJf30WZe5FsIvsWpe02mnELEOYycZLTAPnKBL9fFiaDtm3nAlDw D4d0UmN1r/FwvN2g= X-Received: by 2002:a0c:f70c:: with SMTP id w12mr21187007qvn.28.1587486090495; Tue, 21 Apr 2020 09:21:30 -0700 (PDT) X-Google-Smtp-Source: APiQypLkeQXvii5i6XbB/9MmopgbcRFNkqUjk07cE6Av4jZKy9ipmw+U72L7n+JYe6pzAUEgj1z44A== X-Received: by 2002:a0c:f70c:: with SMTP id w12mr21186980qvn.28.1587486090289; Tue, 21 Apr 2020 09:21:30 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Subject: [PATCH 6/8] cpus: Introduce qemu_mutex_unlock_iothread_prepare() Date: Tue, 21 Apr 2020 12:21:06 -0400 Message-Id: <20200421162108.594796-7-peterx@redhat.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200421162108.594796-1-peterx@redhat.com> References: <20200421162108.594796-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/21 01:28:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 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: Paolo Bonzini , peterx@redhat.com, Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The prepare function before unlocking BQL. There're only three places that= can release the BQL: unlock(), cond_wait() or cond_timedwait(). Signed-off-by: Peter Xu --- cpus.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cpus.c b/cpus.c index 5cbc3f30de..48aa295fea 100644 --- a/cpus.c +++ b/cpus.c @@ -1832,20 +1832,27 @@ void qemu_mutex_lock_iothread_impl(const char *file= , int line) iothread_locked =3D true; } =20 +static void qemu_mutex_unlock_iothread_prepare(void) +{ +} + void qemu_mutex_unlock_iothread(void) { g_assert(qemu_mutex_iothread_locked()); iothread_locked =3D false; + qemu_mutex_unlock_iothread_prepare(); qemu_mutex_unlock(&qemu_global_mutex); } =20 void qemu_cond_wait_iothread(QemuCond *cond) { + qemu_mutex_unlock_iothread_prepare(); qemu_cond_wait(cond, &qemu_global_mutex); } =20 void qemu_cond_timedwait_iothread(QemuCond *cond, int ms) { + qemu_mutex_unlock_iothread_prepare(); qemu_cond_timedwait(cond, &qemu_global_mutex, ms); } =20 --=20 2.24.1