From nobody Fri Dec 19 20:34:20 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1683201554; cv=none; d=zohomail.com; s=zohoarc; b=UKRHV5koH3Zsk26R+Nf8wHqzpcmCFQ1oy3ZL6TLWmB4I8iN4e7aVySgrJYlE+V0yR67zDlGnXhWM9+BLatC6JcAtOqea8o3xJ/ohUhQ6rT3xfS794yCUtLj8BglhQi5JhaG+Gfe7DeGeZLztKOAYfn1KLsNBHTQdho+gTgHf3uY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1683201554; h=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=1tJPsUDy0/a5aRDPOU/Kfiz+JnZ5QWXleCNGkgAkRew=; b=AauySkWL4AFL4OPYDV5rsf/ITl5VUdG85IQfHAbzrEyf0H3gryodkCBx5k3dj6B8DI/w5TJ97w80W7B9EBq2/iFjHYMOQqHnOOMoMAqa4Soepv7AGqleoDDZY+TsJKWRF3R6xKsgisKH+ojni4a75ZJkFPGaYGBWoiowyJSYO5A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1683201554114695.5203243355984; Thu, 4 May 2023 04:59:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1puXbS-0003Ko-I2; Thu, 04 May 2023 07:58:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1puXbD-00039Q-V1 for qemu-devel@nongnu.org; Thu, 04 May 2023 07:58:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1puXbA-0004Cp-P0 for qemu-devel@nongnu.org; Thu, 04 May 2023 07:58:15 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-654-Ppi5M15YM3GzW9VBzC-3vQ-1; Thu, 04 May 2023 07:58:06 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 950FD884341; Thu, 4 May 2023 11:58:06 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.194.84]) by smtp.corp.redhat.com (Postfix) with ESMTP id 81429C15BAD; Thu, 4 May 2023 11:58:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683201491; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1tJPsUDy0/a5aRDPOU/Kfiz+JnZ5QWXleCNGkgAkRew=; b=jNnHlvg0StxvrE8AwW2qBDVrbbW1EC03UqwqIXWnSG1iF/VBd1CZDTZCTW7OEaiyr987tt Vj5MQpoG5SKYyXx/6FdMEOWzlmB5YaIoD6E+BYKvKXPjdCsta45lUCRpVwyviVxdKfAi2v k4tiJke3Hv3KvhmMlwL629B4Ztbk3Ns= X-MC-Unique: Ppi5M15YM3GzW9VBzC-3vQ-1 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, eblake@redhat.com, eesposit@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org Subject: [PATCH v2 06/20] graph-lock: Add GRAPH_UNLOCKED(_PTR) Date: Thu, 4 May 2023 13:57:36 +0200 Message-Id: <20230504115750.54437-7-kwolf@redhat.com> In-Reply-To: <20230504115750.54437-1-kwolf@redhat.com> References: <20230504115750.54437-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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=170.10.133.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.161, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1683201556020100007 Content-Type: text/plain; charset="utf-8" For some functions, it is part of their interface to be called without holding the graph lock. Add a new macro to document this. The macro expands to TSA_EXCLUDES(), which is a relatively weak check because it passes in cases where the compiler just doesn't know if the lock is held. Function pointers can't be checked at all. Therefore, its primary purpose is documentation. Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi --- include/block/graph-lock.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/block/graph-lock.h b/include/block/graph-lock.h index ac0fef8605..f17d1588e7 100644 --- a/include/block/graph-lock.h +++ b/include/block/graph-lock.h @@ -73,6 +73,7 @@ extern BdrvGraphLock graph_lock; */ #define GRAPH_WRLOCK TSA_REQUIRES(graph_lock) #define GRAPH_RDLOCK TSA_REQUIRES_SHARED(graph_lock) +#define GRAPH_UNLOCKED TSA_EXCLUDES(graph_lock) =20 /* * TSA annotations are not part of function types, so checks are defeated = when @@ -83,6 +84,7 @@ extern BdrvGraphLock graph_lock; */ #define GRAPH_RDLOCK_PTR TSA_GUARDED_BY(graph_lock) #define GRAPH_WRLOCK_PTR TSA_GUARDED_BY(graph_lock) +#define GRAPH_UNLOCKED_PTR =20 /* * register_aiocontext: --=20 2.40.1