Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 08654C54EAA for ; Mon, 30 Jan 2023 12:49:18 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pMTat-0003Xg-Ab; Mon, 30 Jan 2023 07:49:07 -0500 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 1pMTaj-0003TD-9K for qemu-devel@nongnu.org; Mon, 30 Jan 2023 07:48:57 -0500 Received: from szxga02-in.huawei.com ([45.249.212.188]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pMTae-0007a6-VS for qemu-devel@nongnu.org; Mon, 30 Jan 2023 07:48:56 -0500 Received: from dggpeml500022.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4P57HD4VFFzJrRw; Mon, 30 Jan 2023 20:47:04 +0800 (CST) Received: from [10.174.187.239] (10.174.187.239) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 30 Jan 2023 20:48:38 +0800 Message-ID: <9b3fc9df-d273-4008-36c2-c779a40132c2@huawei.com> Date: Mon, 30 Jan 2023 20:48:38 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [PATCH 2/3] migration: implement query migration threadinfo by name To: CC: , , , , , , References: <20230120084735.825054-1-jiangjiacheng@huawei.com> <20230120084735.825054-3-jiangjiacheng@huawei.com> <87o7qgode5.fsf@secure.mitica> In-Reply-To: <87o7qgode5.fsf@secure.mitica> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.187.239] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500022.china.huawei.com (7.185.36.66) X-CFilter-Loop: Reflected Received-SPF: pass client-ip=45.249.212.188; envelope-from=jiangjiacheng@huawei.com; helo=szxga02-in.huawei.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.09, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: , Reply-to: Jiang Jiacheng From: Jiang Jiacheng via Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On 2023/1/30 12:27, Juan Quintela wrote: > Jiang Jiacheng wrote: >> Introduce interface query-migrationthreads. The interface is use >> with the migration thread name reported by qemu and returns with >> migration thread name and its pid. >> Introduce threadinfo.c to manage threads with migration. >> >> Signed-off-by: Jiang Jiacheng > > I like this query interface better than the way you expose the thread > name in the 1st place. The event in patch1 is used to pass the thread name since libvirt doesn't know the name of the migration thread but the interface below need its name. I think the event can be dropped if we store the thread name in libvirt(if the migration thread name is fixed in qemu) or using the 'query-migrationthreads' you mentioned below. > > But once that we are here, why don't we just "tweak" abit the interface: > >> diff --git a/qapi/migration.json b/qapi/migration.json >> index b0cf366ac0..e93c3e560a 100644 >> --- a/qapi/migration.json >> +++ b/qapi/migration.json >> @@ -1970,6 +1970,36 @@ >> { 'command': 'query-vcpu-dirty-limit', >> 'returns': [ 'DirtyLimitInfo' ] } >> >> +## >> +# @MigrationThreadInfo: >> +# >> +# Information about migrationthreads >> +# >> +# @name: the name of migration thread >> +# >> +# @thread-id: ID of the underlying host thread >> +# >> +# Since: 7.2 >> +## >> +{ 'struct': 'MigrationThreadInfo', >> + 'data': {'name': 'str', >> + 'thread-id': 'int'} } > > 1st, it is an int enough for all architectures? I know that for linux > and friends it is, but not sure about windows and other weird systems. > It is only enough for migration pin which I want to implement. But I think this struct can be easily expand if we need other information about migration thread. >> +## >> +# @query-migrationthreads: > > What about renaming this to: > > @query-migrationthread (I removed the last 's') > > because it returns the info of a single thread. > >> +# >> +# Returns threadInfo about the thread specified by name >> +# >> +# data: migration thread name >> +# >> +# returns: information about the specified thread >> +# >> +# Since: 7.2 >> +## >> +{ 'command': 'query-migrationthreads', >> + 'data': { 'name': 'str' }, >> + 'returns': 'MigrationThreadInfo' } >> + >> ## >> # @snapshot-save: >> # > > And leaves the @query-migrationthreads name for something in the spirit of > >> +{ 'command': 'query-migrationthreads', >> + 'returns': ['str'] } > > That returns all the migration threads names. > > Or perhaps even > >> +{ 'command': 'query-migrationthreads', >> + 'returns': ['MigrationThreadInfo'] } > > And call it a day? I think it's the best. If in this way, should we keep the interface to query specified thread? Thanks, Jiang Jiacheng > > Later, Juan. >