From nobody Sat Feb 7 08:27:14 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1589919225; cv=none; d=zohomail.com; s=zohoarc; b=dYobHoxMkzNEzG0OrFB9u5FcuP4+gwDXuDoTbX59wJ7uGH7n7C0pVVYmfdNDz05Xk7x/bJZtgxo7Lu0bAi08FApgp7rKafyczyJFyWhxXRzJPyhbrdhQSLKCopn65h+vtnIDPa1E0o8bdKo2l9cY7Lve63L6Jx+CuYfhIu+9D9w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589919225; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=qKCB921Wb9Gjaa5udIOJTN7A5eG/S/nIKagRUOWAIVo=; b=GmopbponUwsUNyz78pj2BR/ur5YyzV5tKDMhQp5xGWq5VyEmdEQBnXN2i+vztf6FzS5ppLd8h+cOc5+trwpX7og9GuXxZD0cxFO+xJJ4/OFmarMrRaxw+Xdq/wZCbXyWDgfZCr9En3Uc516R2MqDQLPc6bQrfBreRN9xVPzZzsw= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1589919225216739.6020662149008; Tue, 19 May 2020 13:13:45 -0700 (PDT) Received: from localhost ([::1]:56778 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jb8cS-00067e-2z for importer@patchew.org; Tue, 19 May 2020 16:13:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jb8bc-0004ID-RI for qemu-devel@nongnu.org; Tue, 19 May 2020 16:12:52 -0400 Received: from mga01.intel.com ([192.55.52.88]:59955) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jb8bb-0008AC-5e for qemu-devel@nongnu.org; Tue, 19 May 2020 16:12:52 -0400 Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2020 13:12:43 -0700 Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by orsmga006.jf.intel.com with ESMTP; 19 May 2020 13:12:41 -0700 IronPort-SDR: 0hm3AdbTxl3XmxBZlR46GsLEEjcqnhawBTZcdSb8gexwNI8Zfv7f4jesonn7bUENE+oFAf6BEw QWwCl55MKuJw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False IronPort-SDR: /O8ihuVvd0Zif/L5CtRmO3ZX3+Fs2KGB43L+AvoUHvVSBvR5gc+boxKMzCLiPmBrVtvbPN/r21 jDKJulJ6FMGw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,410,1583222400"; d="scan'208";a="268007852" From: Zhang Chen To: Jason Wang Subject: [PATCH 2/7] net/colo-compare.c: Create event_bh with the right AioContext Date: Wed, 20 May 2020 04:02:02 +0800 Message-Id: <20200519200207.17773-3-chen.zhang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200519200207.17773-1-chen.zhang@intel.com> References: <20200519200207.17773-1-chen.zhang@intel.com> 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=192.55.52.88; envelope-from=chen.zhang@intel.com; helo=mga01.intel.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/19 16:12:40 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: -35 X-Spam_score: -3.6 X-Spam_bar: --- X-Spam_report: (-3.6 / 5.0 requ) BAYES_00=-1.9, FROM_ADDR_WS=2.999, FROM_WSP_TRAIL=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN 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: Zhang Chen , Lukas Straub , qemu-dev , Zhang Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Lukas Straub qemu_bh_new will set the bh to be executed in the main loop. This causes crashes as colo_compare_handle_event assumes that it has exclusive access the queues, which are also concurrently accessed in the iothread. Create the bh with the AioContext of the iothread to fulfill these assumptions and fix the crashes. This is safe, because the bh already takes the appropriate locks. Signed-off-by: Lukas Straub Reviewed-by: Zhang Chen Reviewed-by: Derek Su Tested-by: Derek Su Signed-off-by: Zhang Chen --- net/colo-compare.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/colo-compare.c b/net/colo-compare.c index 56d8976537..2edfa31f6a 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -897,6 +897,7 @@ static void colo_compare_handle_event(void *opaque) =20 static void colo_compare_iothread(CompareState *s) { + AioContext *ctx =3D iothread_get_aio_context(s->iothread); object_ref(OBJECT(s->iothread)); s->worker_context =3D iothread_get_g_main_context(s->iothread); =20 @@ -913,7 +914,7 @@ static void colo_compare_iothread(CompareState *s) } =20 colo_compare_timer_init(s); - s->event_bh =3D qemu_bh_new(colo_compare_handle_event, s); + s->event_bh =3D aio_bh_new(ctx, colo_compare_handle_event, s); } =20 static char *compare_get_pri_indev(Object *obj, Error **errp) --=20 2.17.1