From nobody Wed May 15 00:20:28 2024 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=1601000339; cv=none; d=zohomail.com; s=zohoarc; b=QKZray51mp1HxTwaJnLYAtyzmg5B6eb3UKOUo4SPxd9WZp254yi5dc43o2g7uKazcCJD22oV9QW6mq3bWZlNJ9f+fTnt1Z20+Dedzm80ujDIWUF8xwdXPRh5TVx4j9Vg6BqrHysBebhjCjuezUY4BQgq0mw63KY0UNhyqDvkTVw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601000339; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=TceC33JhPSyH63jIvhrwfNZ88boCWVvlhwIBPPDYM0k=; b=kY4OxVSbtCVXtirLpXF3DlSBkJrTJt4539X39rxtU1hi0QgrIxyIWM/fmuQrRwPDgaMM9p+Dk2nun7IJC3aDV5OXlo8toIu3vH2mA/TbzeyH8mTj/CZny3XH4F0LVvOMtl/fX/g2XHtUzpND4rRH4SeQI8WsB8I+xm4Lqm23igQ= 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 1601000339174737.1135168705878; Thu, 24 Sep 2020 19:18:59 -0700 (PDT) Received: from localhost ([::1]:55968 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kLdK4-0000uY-LI for importer@patchew.org; Thu, 24 Sep 2020 22:18:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kLdJW-0000Uq-Ji for qemu-devel@nongnu.org; Thu, 24 Sep 2020 22:18:22 -0400 Received: from mga09.intel.com ([134.134.136.24]:26280) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kLdJT-0004je-US for qemu-devel@nongnu.org; Thu, 24 Sep 2020 22:18:22 -0400 Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Sep 2020 19:18:11 -0700 Received: from unknown (HELO coxu-arch-shz.sh.intel.com) ([10.239.160.21]) by fmsmga006.fm.intel.com with ESMTP; 24 Sep 2020 19:18:10 -0700 IronPort-SDR: Ey4CNbyRwB4q+YorXaB1dyBm3dWdvc8prrWq8ZoOXpLNglVmUp9cTi8+UUhcZm3r6hTonXdQP4 k3Rf/RUltghg== X-IronPort-AV: E=McAfee;i="6000,8403,9754"; a="162306440" X-IronPort-AV: E=Sophos;i="5.77,300,1596524400"; d="scan'208";a="162306440" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False IronPort-SDR: N5cMB49TnerwnmHefpmB4SIt36A06SS8kjiU0KtgFLyZRXfVn/q2vGQP76REMWCaF2Ph3G4aH1 GAzsP5yeMGVw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,300,1596524400"; d="scan'208";a="511893828" From: Colin Xu To: kraxel@redhat.com, pbonzini@redhat.com Subject: [PATCH] input-linux: Reset il->fd handler before closing it Date: Fri, 25 Sep 2020 10:18:08 +0800 Message-Id: <20200925021808.26471-1-colin.xu@intel.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 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=134.134.136.24; envelope-from=colin.xu@intel.com; helo=mga09.intel.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/24 22:18:12 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, colin.xu@intel.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" If object-del input-linux object on-the-fly, instance finalize will close evdev fd without resetting it. However the main thread is still trying to lock_acquire/lock_release during ppoll, which leads to a very high CPU utilization. Signed-off-by: Colin Xu Reviewed-by: Li Qiang --- ui/input-linux.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/input-linux.c b/ui/input-linux.c index ab351a418701..34cc531190f9 100644 --- a/ui/input-linux.c +++ b/ui/input-linux.c @@ -418,6 +418,7 @@ static void input_linux_instance_finalize(Object *obj) =20 if (il->initialized) { QTAILQ_REMOVE(&inputs, il, next); + qemu_set_fd_handler(il->fd, NULL, NULL, NULL); close(il->fd); } g_free(il->evdev); --=20 2.28.0