From nobody Sun Feb 8 18:30:15 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; spf=pass (zoho.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=linux.intel.com ARC-Seal: i=1; a=rsa-sha256; t=1559810635; cv=none; d=zoho.com; s=zohoarc; b=L0tCLMaZtx/jcswYYpv6NAzNSHhx3raZGnqByjRjks6xYYv9WxQMQLyEiEIaWZCXGBMEPN1FwOoK0KvIJyZcMaEpMmPVjOP0up3a5ppxXKSJ7+xiZaQIfxOb5HtofJTLVHkiNUPWzDDVDJBdN3ZODsjY1v8qKF4ReGngPD5kASc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559810635; 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:ARC-Authentication-Results; bh=KN3EvPqcRqPK/zBM+39auMx2kh5hghjW7+Z6KxLKvog=; b=TojIbMsHZIAp9WZECT+GxrgcgEB2IDLCb9UvbC7OCCwAVCrhxIhH11nhOa1G8v85LgQBmbLUOnIT1qusLGhg3YZDMi6Y85gqp57Gk+r0P8HsPNf+VTGvlHGZP1wNMKh8kO4ApXYsQB1MJpPH/yGv+goYdnxu8tDrLaFT5qgp5lE= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.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 1559810635638875.825893055646; Thu, 6 Jun 2019 01:43:55 -0700 (PDT) Received: from localhost ([127.0.0.1]:56562 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYnzw-0004V7-3h for importer@patchew.org; Thu, 06 Jun 2019 04:43:48 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55430) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYnyD-0003ZF-Na for qemu-devel@nongnu.org; Thu, 06 Jun 2019 04:42:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hYnsI-0003V1-4h for qemu-devel@nongnu.org; Thu, 06 Jun 2019 04:35:54 -0400 Received: from mga14.intel.com ([192.55.52.115]:4990) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hYnsH-0003TJ-Sd for qemu-devel@nongnu.org; Thu, 06 Jun 2019 04:35:54 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Jun 2019 01:35:53 -0700 Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga001.fm.intel.com with ESMTP; 06 Jun 2019 01:35:52 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 From: Wei Yang To: qemu-devel@nongnu.org Date: Thu, 6 Jun 2019 16:34:57 +0800 Message-Id: <20190606083501.2087-3-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190606083501.2087-1-richardw.yang@linux.intel.com> References: <20190606083501.2087-1-richardw.yang@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.115 Subject: [Qemu-devel] [PATCH 2/6] migration/multifd: notify channels_ready when send thread starts X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wei Yang , dgilbert@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" multifd_send_state->channels_ready is initialized to 0. It is proper to let main thread know we are ready when thread start running. Current implementation works since ram_save_setup() calls multifd_send_sync_main() which wake up send thread and posts channels_ready. This behavior will introduce some unpredictable situation and disturb the semaphore value. This is a preparation patch to use another mechanism to do send thread synchronization to avoid post channels_ready in this case. So this patch posts channels_ready when send threads start running. Signed-off-by: Wei Yang --- migration/ram.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/migration/ram.c b/migration/ram.c index a4e7587648..f9e53ac413 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1093,6 +1093,8 @@ static void *multifd_send_thread(void *opaque) } /* initial packet */ p->num_packets =3D 1; + /* let main thread know we are ready */ + qemu_sem_post(&multifd_send_state->channels_ready); =20 while (true) { qemu_sem_wait(&p->sem); --=20 2.19.1