From nobody Fri Nov 29 12:54:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1638797952; cv=none; d=zohomail.com; s=zohoarc; b=jF6h5qRFVNJcwdaWVQ/efzjESjrnk2U5hHgQgQaf24o8O1WXPeoj9mcg2lrrwyQNi8PoN2k6+XgcljX8hFshgLnySOFqOO8lr4MWPGVKoGV/cu7B1Zt9QRnshW63d7sdCnJwAtZWA3CQVesKCwvi2eR4Xauw908rY2SV8kZuppU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638797952; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=YamROYzUp0PZ/5GMqSGbv8sc9RdoQTpImJFTgFO1QI8=; b=SRDH6C3LJDtmvDyLn3NZz5WR+J0SPQj41uDkwszPf5cIv6IwzI6UH7wREQlftsYgilLxGNh8y0kJXyaS9YDkHQBvohBtd7BKaRf3fw+pCGXAwEHyq5wquqF4A+cJ/GPPJYquQOTH5523fbbKXgDzKC/begxJhCi8CvxVqXpgI6s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1638797952802652.6568810170205; Mon, 6 Dec 2021 05:39:12 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.238973.414192 (Exim 4.92) (envelope-from ) id 1muECe-0001i2-E8; Mon, 06 Dec 2021 13:38:48 +0000 Received: by outflank-mailman (output) from mailman id 238973.414192; Mon, 06 Dec 2021 13:38:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1muECe-0001hv-9C; Mon, 06 Dec 2021 13:38:48 +0000 Received: by outflank-mailman (input) for mailman id 238973; Mon, 06 Dec 2021 13:38:47 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1muECd-0001hg-H2 for xen-devel@lists.xenproject.org; Mon, 06 Dec 2021 13:38:47 +0000 Received: from esa1.hc3370-68.iphmx.com (esa1.hc3370-68.iphmx.com [216.71.145.142]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id d4d2d159-5699-11ec-8a4d-196798b21f7b; Mon, 06 Dec 2021 14:38:45 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d4d2d159-5699-11ec-8a4d-196798b21f7b DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1638797926; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=6oMmZ8HEgzBLe2fLCyP3ITktUGqesp5ZKkUue/5pPCw=; b=QRlDgFxxj26+a7XSbAbXacGLi1NLrE7nuh4NSOgdXWvySm5jz8dw3MLI mlgMcS9jzDHtubny+M44J2VmoQ7o8F+ElioScdne0r5np1Ss6xzT3g0m1 iYEpXlVxOB1Z/v5lPUP+slXjF8xIMcA3hCDZZ8P21XtaGT+rQDGEjSOUL 4=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: tlTJxcwR8AbYtJyTpjGo0Pkh/WsShdyJCJfDD0UNxjIB2hqhbpmgjkTWVKzefjRwOKxNAjdHSn Ar6TFbmeMOWalMI9w30orSGt8CE8F8G6bfhjvN80Kz6r9+aI+wqZByo6UIjmqX0Tg6HFcbkyeq l2r6xWrF1zCqTic0/IE0iRlT3VYe9c8zH7a2qfL2WNFshR9Sypm9ZphIu9p1wZEBwRULSIOpjR M7dxGmwsXFVcDmU+zItu6pWTx9/fwc55QdHw8XZy1/c6YbUT0EDeW54Nz1K5ZJ2BpiOY1dZfIx 8wlqEZaP+zU+28nChD6Rp0Ry X-SBRS: 4.0 X-MesageID: 59744673 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:DDlvNqCLCZOGTBVW/xLkw5YqxClBgxIJ4kV8jS/XYbTApDwmhjUBx jRNDGmCOK3cajehfIp+atu/8kgPvZfWnNIxQQY4rX1jcSlH+JHPbTi7wuYcHM8wwunrFh8PA xA2M4GYRCwMo/u1Si6FatANl1ElvU2zbue6WLGs1hxZH1c+EX570Uw7wobVv6Yz6TSHK1LV0 T/Ni5W31G+Ng1aY5UpNtspvADs21BjDkGtwUm4WPJinj3eH/5UhN7oNJLnZEpfNatI88thW5 Qr05OrREmvxp3/BAz4++1rxWhVirrX6ZWBihpfKMkQLb9crSiEai84G2PQghUh/jC+jhdNK4 9V0qL+aa1x0favcucItakwNe81+FfUuFL7vJHG+tYqYzlHccmuqyPJrZK00FdRGoKAtWzgIr KFGbmBWBvyAr7veLLaTY+9gnMk8auLsO5sSoCpIxjDFF/c2B5vERs0m4PcFjWhs2p4RRp4yY eIabBtJQhaQZyESFWsJKYBhs8L4in7gJmgwRFW9+vNsvjm7IBZK+KfpGMrYfJqNX8o9tmSyq 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+XgssRQb+exoV5PwOU80maQFhLX5eI3SITUO21HYbb2Kj7GSuAEIcheWnoU2uM sQENkdNDSzNykBsS+Q2njeLz9U+qj/zEnev5a5854Cd3APV0hI1XYHNi+rVmlNACVWD5swE5 SRouBdoSC7RHgRZsOnQlEYQunqvbTw5dLbSC9DIyRixBiFjDuu5rK/OQOfxA0iXzRGxqpn2X TZkjb++r6ov5iAu1zhPi7ontZrcenau59+7f+3+48owwDX+0OVjN4IYcz9gNl6mpDo1L9gqq ixn/5pBbUD15qWRBDtnfMosDOQiwrHLBTZuAelaDLY0LzErGdTMbsyuatJNhTe8EYup9d6ze ZC2H+YrYNeCVfakD36/MWgbWAkqqOYmwturQcotQ0SbWLeUs4ZkaUPuEdOVJsQFiPz744qVO FoEcHH/f5TNUiXanjI11MfiuBFdhwIb2K7qmFrgL3n79GXpgEz86I1/r1pop4wzuN0d3Af3Z WxDk1BrsA5cvMr X-IronPort-AV: E=Sophos;i="5.87,291,1631592000"; d="scan'208";a="59744673" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu Subject: [PATCH] x86/irq: Improve local_irq_restore() code generation and performance Date: Mon, 6 Dec 2021 13:38:28 +0000 Message-ID: <20211206133828.8811-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1638797954373100001 popf is a horribly expensive instruction, while sti is an optimised fastpat= h. Switching popf for a conditional branch and sti caused an 8% perf improveme= nt in various linux measurements. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu --- xen/include/asm-x86/system.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/xen/include/asm-x86/system.h b/xen/include/asm-x86/system.h index 65e63de69a67..4be235472ecd 100644 --- a/xen/include/asm-x86/system.h +++ b/xen/include/asm-x86/system.h @@ -267,13 +267,8 @@ static inline unsigned long array_index_mask_nospec(un= signed long index, }) #define local_irq_restore(x) \ ({ \ - BUILD_BUG_ON(sizeof(x) !=3D sizeof(long)); \ - asm volatile ( "pushfq\n\t" \ - "andq %0, (%%rsp)\n\t" \ - "orq %1, (%%rsp)\n\t" \ - "popfq" \ - : : "i?r" ( ~X86_EFLAGS_IF ), \ - "ri" ( (x) & X86_EFLAGS_IF ) ); \ + if ( (x) & X86_EFLAGS_IF ) \ + local_irq_enable(); \ }) =20 static inline int local_irq_is_enabled(void) --=20 2.11.0