From nobody Sun May 19 07:11:45 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=1658128771; cv=none; d=zohomail.com; s=zohoarc; b=GSffBjy6jXFCzi6avzpQXRFkbbYhTqI66qV0VbSch6YRbo2TuVEfz5UAFmRVIWcrG6xlhHLkFUYVZnVD8OdOAfbByKm63Hgofpa7O2smZWJtXupoAH7Bw39/ZVtG8gGpdngsy9Mooys/qkKHBg/7g+yWTQbjrPtU1lE+80UWGdQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658128771; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ttgl5HdD7KjuTtCta3C5p9XhXcj17kBLkli/rI8rddo=; b=YFwqn1imb0VoMlIz14kCqVlctjl7vHWCD87OCAHqOR9hAK8/W/yZo/xiEVkN2piRD9WBOYd6rTyXaIJAT2s/lmxuILvk3IqwjmwDWqlSQhEaUSh3wNIID+AmkP2MtRRQ9b8xiUg8Zn1OFocx6gDNYLnWBDDftPhlvLw3G1rpTA8= 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 1658128771140327.6062069442545; Mon, 18 Jul 2022 00:19:31 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.369274.600612 (Exim 4.92) (envelope-from ) id 1oDL1l-0005Eo-SN; Mon, 18 Jul 2022 07:18:49 +0000 Received: by outflank-mailman (output) from mailman id 369274.600612; Mon, 18 Jul 2022 07:18:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oDL1l-0005ET-M1; Mon, 18 Jul 2022 07:18:49 +0000 Received: by outflank-mailman (input) for mailman id 369274; Mon, 18 Jul 2022 07:18: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 1oDL1j-0004to-NP for xen-devel@lists.xenproject.org; Mon, 18 Jul 2022 07:18:47 +0000 Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id db04218d-0669-11ed-924f-1f966e50362f; Mon, 18 Jul 2022 09:18:45 +0200 (CEST) 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: db04218d-0669-11ed-924f-1f966e50362f DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1658128725; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MBnjpYcrthIMf2A0TClYrTSnU8giI6pEvHtffLJlDVY=; b=G6cN5xEVpKp13zbtjNdQm9WsVzxFaw8p3fJI03vxLfTZTyT70n27sbKB 5Fe0u/NAZ1NvsVofjfiTZOKFUtndI93zhU6NZCoh/hWXVLl3emHSQ0B3W /j1dTrGX2SBDEjWOH75qG4lmfkTV6cwAbIIO1aihYscV9kohivGAuh1Py 0=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 2.7 X-MesageID: 76011728 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:P9jYk60dOKxWYV0JffbD5bpxkn2cJEfYwER7XKvMYLTBsI5bpzNVn zMeWD+HbKrcMGCgfo1xYYjj/E5S65+Gm9FhSVNspC1hF35El5HIVI+TRqvS04J+DSFhoGZPt Zh2hgzodZhsJpPkjk7xdOKn9RGQ7InQLpLkEunIJyttcgFtTSYlmHpLlvUwx4VlmrBVOSvU0 T/Ji5CZaQXNNwJcaDpOsfrc8Uw35pwehRtD1rAATaET1LPhvyF94KI3fcmZM3b+S49IKe+2L 86rIGaRpz6xE78FU7tJo56jGqE4aue60Tum0xK6b5OKkBlazhHe545gXBYqheW7vB3S9zx54 I0lWZVd0m7FNIWU8AgWe0Ew/y2TocSqUVIISJSymZX78qHIT5fj6/FxKkI2P4kmw7YtI01E2 6I7NC4kVh/W0opawJrjIgVtrsEqLc2tN4IDoHBwizreCJ7KQ7iaHf+Mv4UBmm5t2IYeRp4yZ OJAAdZrRD3GbwdCJRE8D5Umkf3zrnL+bydZuBSeoq9fD237k1IpieGyaoq9ltqiVcdSlWiWh 1P/pHnHXS8UNPGy6yDZ/Sf57gPItXyiA99DfFGizdZ1hHWDy2pVDwcZPXOZi/Skjk+1W/pEN lcZvCEpqMAa5EGtC9XwQRC8iHqFpQIHHcpdFfUg7wOAwbaS5ByWblXoVRYYNoZg7pVvA2V3i BnZxLsFGACDrpWRVlSe9rWQkwriYwo5J0FcRjMaZDMKtoyLTJ4Isv7fcjpyOPfr04KkQWChn 2riQDsW3OtK05NSv0mv1RWe2m/3+MCUJuIgzl+PNl9J+D+Vc2JMi2aAzVHApchNI4+CJrVql ChVwpPOhAzi4HzkqcBsfAnuNOvwjxp9GGeA6WOD5rF4n9hXx1atfJpL/BZ1L1pzP8APdFfBO RGO6VsBvs4MZCL7Mcebhr5d7Oxzl8Dd+SnNDKiIPrKinLArHON4wM2eTRHJhD28+KTduao+J Y2aYa6RMJruMow+lWLeb7pMjtcWKtUWnzy7qWbTk0v6itJzpRe9Fd84Dbd5RrpktP3U+FiJr 4432gnj40w3bdASqxL/qeY7RW3m51BibXwqg6S7rtK+Hzc= IronPort-HdrOrdr: A9a23:6oN8nqq5ic+i+tM3scP2gRoaV5oTeYIsimQD101hICG8cqSj+f xG+85rrCMc6QxhPk3I9urhBEDtex/hHNtOkOws1NSZLW7bUQmTXeJfBOLZqlWKcUDDH6xmpM NdmsBFeaXN5DNB7PoSjjPWLz9Z+qjkzJyV X-IronPort-AV: E=Sophos;i="5.92,280,1650945600"; d="scan'208";a="76011728" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu Subject: [PATCH 1/5] xen/wait: Drop vestigial remnants of TRAP_regs_partial Date: Mon, 18 Jul 2022 08:18:21 +0100 Message-ID: <20220718071825.22113-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20220718071825.22113-1-andrew.cooper3@citrix.com> References: <20220718071825.22113-1-andrew.cooper3@citrix.com> 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: 1658128772821100008 The preservation of entry_vector was introduced with ecf9846a6a20 ("x86: save/restore only partial register state where possible") where TRAP_regs_partial was introduced, but missed from f9eb74789af7 ("x86/entry: Remove support for partial cpu_user_regs frames") where TRAP_regs_partial w= as removed. Fixes: f9eb74789af7 ("x86/entry: Remove support for partial cpu_user_regs f= rames") Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu --- xen/common/wait.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/xen/common/wait.c b/xen/common/wait.c index 9276d76464fb..3ebb884fe738 100644 --- a/xen/common/wait.c +++ b/xen/common/wait.c @@ -124,7 +124,6 @@ static void __prepare_to_wait(struct waitqueue_vcpu *wq= v) struct cpu_info *cpu_info =3D get_cpu_info(); struct vcpu *curr =3D current; unsigned long dummy; - u32 entry_vector =3D cpu_info->guest_cpu_user_regs.entry_vector; =20 ASSERT(wqv->esp =3D=3D 0); =20 @@ -169,8 +168,6 @@ static void __prepare_to_wait(struct waitqueue_vcpu *wq= v) for ( ; ; ) do_softirq(); } - - cpu_info->guest_cpu_user_regs.entry_vector =3D entry_vector; } =20 static void __finish_wait(struct waitqueue_vcpu *wqv) --=20 2.11.0 From nobody Sun May 19 07:11:45 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=1658128768; cv=none; d=zohomail.com; s=zohoarc; b=HyPMANwc7ISipuKNmt7ophbFWE9D4krF+D20AKPrcBM6a/+Tq9NsyTJahjvXKIiBlY41gxsXnl7gmwSxV0TjRDGHNNVLrYCNxbsVdVJdubpd+0F3N2fWMj3D5tESOauvlmd2e3fbM3KCJFmiNEVUV4krialmeSl4Nfp2vxX5yL8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658128768; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=icQ0OKk7jzwxARSdjZlLFPwy60/6FsvW69msOPoUU+c=; b=EXLUAE4kJlirkbdq8yYdweDE46hkHiyzdwG3Z8NFTUhgnk6RmXRfc871LCGHCL1/BoEUw2sQsr1jAGpQ5YJnl+0Kf1ZEJPg+Ep2P6C/QvMcrY1VFDFOvM1GUAmdduGBZRQwXF0h1NFnXlB67MS4kgeFfofPAOdjiWG7/5I/gf/E= 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 1658128768809142.0043961356729; Mon, 18 Jul 2022 00:19:28 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.369272.600595 (Exim 4.92) (envelope-from ) id 1oDL1k-0004uv-8b; Mon, 18 Jul 2022 07:18:48 +0000 Received: by outflank-mailman (output) from mailman id 369272.600595; Mon, 18 Jul 2022 07:18: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 1oDL1k-0004uT-55; Mon, 18 Jul 2022 07:18:48 +0000 Received: by outflank-mailman (input) for mailman id 369272; Mon, 18 Jul 2022 07:18: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 1oDL1i-0004to-Vl for xen-devel@lists.xenproject.org; Mon, 18 Jul 2022 07:18:46 +0000 Received: from esa2.hc3370-68.iphmx.com (esa2.hc3370-68.iphmx.com [216.71.145.153]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id daf19339-0669-11ed-924f-1f966e50362f; Mon, 18 Jul 2022 09:18:45 +0200 (CEST) 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: daf19339-0669-11ed-924f-1f966e50362f DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1658128725; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=F6JK8R4vklGJZNuhaf1bZprn0UinPkgJRlwtPk8D4E8=; b=HZK3hd3kiqWSIHd/x1jXWXR8ib2eGtSumJ/y/am1jHgNUn3jQnwoxrJV PiVyrphtfpQ4a1saxqDjdYAXNEtepVzCMeAfIhoI4HVIst5awZCN3UL+X hDnBmx4shia/Yo4UsiXSNt7r/9tSH8WkDhvYspbURR6cV+gXq4D9xJL5S 8=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 2.7 X-MesageID: 76007331 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: =?us-ascii?q?A9a23=3Ae1brrKP0+ugpJ/zvrXNrnJYgzKimJRAgMBhAA?= =?us-ascii?q?5OJyBtyWkJYtZNa93r/TTRbcNWNAwAcmmIG0TFDXW4DK0JKoVnUygFF/X7yB?= =?us-ascii?q?ptrHy3eogHlySd64WL/45REHnRZwXvr0cO00x4icwyFQPofEgcEg2A9myiYE?= =?us-ascii?q?v9wJDbu2DlYKfYgvPGDMBIhVKJL48ReOvCXKqpniY5GLvlbxIQggiE59Xnbz?= =?us-ascii?q?Zi68uGBRy3+JDcSLhVh36GdRVC1ubN0aWN7JSUWeWN1V0phqE4k8tAatNnXP?= =?us-ascii?q?ck7dADaMfnpsO2IhMoGwUIXklH7v6FVIQVsPe3YflA2/L+ABkPjXNH1bo8mv?= =?us-ascii?q?pQEH5eAXkPLTEEqCK2N5HnFphwakPmhBHBSn+slivtfCFQG81Z5/ll82YUld?= =?us-ascii?q?xN/GbdiKQiE1aVCJMHx5Jkc2yBM1T9NgtjHVF93U8cvndjzBQdNiU8ADZNtF?= =?us-ascii?q?E0mrCzvbbyl0QJ/9z1iY/lY2zNr+e+vKHFq21Wy8Y/aExTk/Fk03u55Xb7/l?= =?us-ascii?q?p01yOrhe++d1rZAaqYxosbi+GZO8SMQfUfj4cWE3pX6tCtSnN+hdDJmwKPSQ?= =?us-ascii?q?WNNjyv3WowYP9eByCdtkVdnZffBSlWokb3JTU8KFyZ7cWVN5uWMHvE2TB/mV?= =?us-ascii?q?7dCC/lMbsVxFDgztceO+m1hk6WE8rover18RBGHyMun3r8akIqLlc8X0BxB8?= =?us-ascii?q?KPKzwSLKKLaZox7dCewjh7uWwRH4/OV8oXud/2q003eHU5jBC60S576otRN9?= =?us-ascii?q?KQ/aFfo2bdsWfc8HYwtdZKBSjchkB7lsg4ulVHbJ/TdbSeVOjkSjRnsjxZgq?= =?us-ascii?q?wdOh0ec0cm/7NGjQ6mdRKUmUecLzhQzzSLzNdkkKD9hsMZlqoqGQjZB4IjRo?= =?us-ascii?q?KJAssNvEGLycLdqJWW02YcG90fR+vLlhCNqcGPdGgDAsMQTRfKdCrCf7mw4R?= =?us-ascii?q?wGMkdw1MOac7qIq2GOKfQhbwCbQrV8xeKaZS8IGXL46B1r3gIW4ijgHHNHz/?= =?us-ascii?q?sGBpOI8fjcRWXw9TSRgN/ICgtkZcyoE3YWZo39Ea6GEFQD2OiW3910/aoTbM?= =?us-ascii?q?zJ6QIRUvYu0AWtCwhNDA4rn3KwonBqiP46DAW6C8DJR22pL+ZuMEESNCT58l?= =?us-ascii?q?e6QP8YUi8ernjKQuViv/mtFjGrybNJdmGwT0Ha7N0ZO32pybvYDm9Z+XixTA?= =?us-ascii?q?rysugTj0poqGbjUqPKZ0U2LYhIG1rmPDFTiEvq2x687Y4VMG0H7RUvFSjeZX?= =?us-ascii?q?56rg8rabFSvjIRedtpv+ImH31p57hqqp2cj4F00Xj0KaQCpIwkIFicH+8mgn?= =?us-ascii?q?1s4EVsp4IlwxwKN4qvPjx3oyfdTB/7Hb5VlaljhnPLILgw1Dk2zfnEODnK+n?= =?us-ascii?q?O4QOAC4hIBG5jIuFbKo/8ZoySQNrZWVLFtxMldfd80rJh14Wx7U1WdBv6TYo?= =?us-ascii?q?z0FHeJoTuuhvPr+izHegFPGk5F14bcaF9esGdxtCaFaHZ5bnY+PBXAYs6JNe?= =?us-ascii?q?v7x1TVmWRfm0Dzz8n1RLIwTDvohD1Kapz9JtRhDBbKEUmSFGDGV/QacltqJM?= =?us-ascii?q?Y15Fo4X4d+joQ3UfK9H2r2uzY0zN4k15XCegBgVza/UXEJAVDUKZIQrIY33v?= =?us-ascii?q?L7yrS1CY2D962FtyO2dx4JK3rNmYvyNzvO8TcOlT6T0k59Z+i75bhUJ22nQB?= =?us-ascii?q?ZJdTJLGCa7p5v3lYydZv895/k9Z9sm1y8f2BQT62NLFXxPTgn3lyl/zKh/qo?= =?us-ascii?q?nB546CCFVDSfOf7POkesdYW7JoYRAiL/TpX6052YL5WuP4pGkHKZGtTgzULq?= =?us-ascii?q?M7bW+pvYtmKR31NWyTiSvhi4LFh9n5LAtJ3IRwypxKfo99J/J7lh/0aTvtAL?= =?us-ascii?q?s6gfUde9hNuCIImQ1hroMfyxGvr+/H9CpgM9Hq1q12r1IAPp6WQxWwmA3YaB?= =?us-ascii?q?/Jy4WQ4Wt05qDYHzk/iuLHbwAAqgl3AsdQMvfmoxGzhuv9NXtC7v4r5axjTd?= =?us-ascii?q?92RR/meuYTlHeIda7xUsKX2aedzBaEYldB8RxCQrnfavPTHHb6DtZaHMft7O?= =?us-ascii?q?JCPzOX6ag5biexcO3FvUdXJzEGG3jVS50ekjgjUsGB7PyGJ5iHKxArTZTFEb?= =?us-ascii?q?MXcdhQIJKo4wliWOQgpRGnbMlOUiosvkXS70eQTKzIdGXE/JDyAxRskUVTVw?= =?us-ascii?q?hHRZnIYfwFbVZZlgT0BAolCfDaFiT7+P9wGOgZXS2+ELeDsQYHjGLKr8A1cE?= =?us-ascii?q?X8iWEbjjeseBC8MZidyaJdQHbs/iOH9mdEkImoumGZ/QEAqg2VxFoLAYv3UR?= =?us-ascii?q?FHrAcI64UkNnn3Df0ywgniN6sD0YL/hDiuBmEdOXs5opcKG4cjy+Exv7UVIL?= =?us-ascii?q?KvO218hY+LgAtJI7Gh1wugXAad2NS8kJQh2D4fl1YqykeZLwsoBzzwL4TyUy?= =?us-ascii?q?YnYvVpHY7q7xgWCG6qbKm001crSPd0Kop7xDQMTZwRzcqumEVY6eYQKtu8R6?= =?us-ascii?q?HELunW1qxXW4IiRKJ+6U5BIUmtJ9P+1hjfUyesROhwOL6COc5liJF0GFudPm?= =?us-ascii?q?IU0nkWdbSFsjlnf63+9LmQLdmEtn4D05fUOHgVUEC8ZXYMn/UHyP0lwFdZhV?= =?us-ascii?q?t8h/jpwdnXf6EFB9uZoBIAGBpTKbOTYxzBtxVkC8bF0zufqLP23uQYoaqaVT?= =?us-ascii?q?mFUgAHWUkdkPJd0vIFlObk5KSStdVqJvtvCC0SPIliCTn6tNuPIk/riYAsnp?= =?us-ascii?q?g1gUW2P+m2O6PiPWtyeW6tq?= X-IronPort-AV: E=Sophos;i="5.92,280,1650945600"; d="scan'208";a="76007331" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu Subject: [PATCH 2/5] xen/wait: Extend the description of how this logic actually works Date: Mon, 18 Jul 2022 08:18:22 +0100 Message-ID: <20220718071825.22113-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20220718071825.22113-1-andrew.cooper3@citrix.com> References: <20220718071825.22113-1-andrew.cooper3@citrix.com> 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: 1658128770881100002 Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu --- xen/common/wait.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/xen/common/wait.c b/xen/common/wait.c index 3ebb884fe738..4dcfa17a8a3f 100644 --- a/xen/common/wait.c +++ b/xen/common/wait.c @@ -137,7 +137,19 @@ static void __prepare_to_wait(struct waitqueue_vcpu *w= qv) do_softirq(); } =20 - /* Hand-rolled setjmp(). */ + /* + * Hand-rolled setjmp(). + * + * __prepare_to_wait() is the leaf of a deep calltree. Preserve the G= PRs, + * bounds check what we want to stash in wqv->stack, copy the active s= tack + * (up to cpu_info) into wqv->stack, then return normally. Our caller + * will shortly schedule() and discard the current context. + * + * The copy out is performed with a rep movsb. When + * check_wakeup_from_wait() longjmp()'s back into us, %rsp is pre-adju= sted + * to be suitable and %rsi/%rdi are swapped, so the rep movsb instead + * copies in from wqv->stack over the active stack. + */ asm volatile ( "push %%rax; push %%rbx; push %%rdx; push %%rbp;" "push %%r8; push %%r9; push %%r10; push %%r11;" @@ -199,9 +211,18 @@ void check_wakeup_from_wait(void) } =20 /* - * Hand-rolled longjmp(). Returns to __prepare_to_wait(), and lands o= n a - * `rep movs` instruction. All other GPRs are restored from the stack= , so - * are available for use here. + * Hand-rolled longjmp(). + * + * check_wakeup_from_wait() is always called with a shallow stack, + * immediately after the vCPU has been rescheduled. + * + * Adjust %rsp to be the correct depth for the (deeper) stack we want = to + * restore, then prepare %rsi, %rdi and %rcx such that when we interce= pt + * the rep movs in __prepare_to_wait(), it copies from wqv->stack over= the + * active stack. + * + * All other GPRs are available for use; they're either restored from + * wqv->stack or explicitly clobbered. */ asm volatile ( "mov %1,%%"__OP"sp; jmp .L_wq_resume;" --=20 2.11.0 From nobody Sun May 19 07:11:45 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=1658128764; cv=none; d=zohomail.com; s=zohoarc; b=I1H+UFVaRXQR8Ytpk82+FqVGxHMBE4nYV63aN7kH6ToWC2CG1O49TkAhiRfand2lkyV+bhmo/gSchLl6L3B01ZwfnhgrQ+bWOpEc61bNeLtJ92KVFOmT4Uj0GvzDV56jew3j7C0dMeFap3fGWX9iamOZJt2ocoprB+O2sMLszXo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658128764; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LchGKMKJeguZa2WjvycWkud4XrfUpA2faPqKVP7jXHk=; b=BDVU4bxMXqLrbS7eVJocTs7yXfgfBqX7NL0Xm6s0i2Yla4IDyvbWp9echqB7DOLdAdxLNpV30Fc8zI4gtKvN2ZT5lD1r8ggg7fX6stdjeyaH2KjuSgZE97qkZFNwre+QI2zp3mcX2bSGo4ajVSNDxaoQHuPX74/S4yOpEY3dEJ0= 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 165812876416596.0356961777668; Mon, 18 Jul 2022 00:19:24 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.369277.600635 (Exim 4.92) (envelope-from ) id 1oDL1n-0005jt-82; Mon, 18 Jul 2022 07:18:51 +0000 Received: by outflank-mailman (output) from mailman id 369277.600635; Mon, 18 Jul 2022 07:18:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oDL1m-0005gn-WD; Mon, 18 Jul 2022 07:18:51 +0000 Received: by outflank-mailman (input) for mailman id 369277; Mon, 18 Jul 2022 07:18:49 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oDL1l-0004tp-GG for xen-devel@lists.xenproject.org; Mon, 18 Jul 2022 07:18:49 +0000 Received: from esa1.hc3370-68.iphmx.com (esa1.hc3370-68.iphmx.com [216.71.145.142]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ddd22d0f-0669-11ed-bd2d-47488cf2e6aa; Mon, 18 Jul 2022 09:18:48 +0200 (CEST) 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: ddd22d0f-0669-11ed-bd2d-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1658128728; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XkwkicbnqybarudXENzuLnv1vjxC0glvjl5QcpNJ1bw=; b=Vz3PPRUgdVdDfZEX51XXFe+pmhT1AL5iIn+wrslCYDDwMuYRR3eaTSQ1 KDP11ZTmTJHofKwcAxPNuARg/IjlcC/NyKc4N+++LirLZO3FV+ZTa1J/e 76ZK486u99VGRgEdVGbNyYn4bOdymMtZPzgChq8IYjHk21vDkrECDamBg 0=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 2.7 X-MesageID: 76442484 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:YD4n06JDNufvLTwkFE+RuJUlxSXFcZb7ZxGr2PjKsXjdYENS1j1Wn WRLXWGBb/mIM2D8KIhzYdi+9kkF7ZfRm9NlHgJlqX01Q3x08seUXt7xwmUcns+xwm8vaGo9s q3yv/GZdJhcokf0/0vraP65xZVF/fngbqLmD+LZMTxGSwZhSSMw4TpugOd8iYNz6TSDK1rlV eja/ouOYjdJ5xYuajhOs/3a90s11BjPkGhwUmIWNKgjUGD2zxH5PLpHTYmtIn3xRJVjH+LSb 44vG5ngows1Vz90Yj+Uuu6Tnn8iG9Y+DiDX4pZiYICwgwAqm8AH+v1T2Mzwy6tgo27hc9hZk L2hvHErIOsjFvWkdO81C3G0H8ziVEHvFXCuzXWX6KSuI0P6n3TE8sh+J2IbbY4iw6VRGmVC0 eIqcgIQcUXW7w626OrTpuhEg80iKI/gPZ8Fu2EmxjbcZRokacmdGeOQv4YehWpuwJAVdRrdT 5NxhT5HRRLMeRBQfHwQD4ozhryAjXjjaTxI7lmSoMLb5kCMklAtiuS9bLI5fPSJaf1Rwk/Bq ljo/m/aLEgIaMXClheKpyfEaujnwnqgBdN6+KeD3uFuqE2ewCoUEhJ+fXmRrOS9i0W+c8lCM EFS8S0rxYAi+UruQtTjUhmQpH+fogVaS9dWC/c96gyG1uzT+QnxO4QfZmcfMpp87pZwHGF0k A/S9z/0OdBxmIyoWVm+2+eXlwrxHzMRIUscV3U2UBRQtrEPv7oPYgLzosdLSfDo0YytSGCsm VhmvwBl2exN0JdjO7GTuAme3mny/sWhohsdvF2/Y46z0u9uiGdJjaSM4EOT0/tPJZ3xorKp7 CldwJj2AAzj4PiweM2xrAYlRujBCw6tamG0vLKWN8BJG86R03CiZ5tMxzp1OV1kNM0JERewP hKD4VMLtcALZSr2BUOSX25WI51wpZUM6Py/DqyEBjawSsIZmPC7ENFGOhfLgjGFfLkEmqAjI 5aLGfuR4YIhIf0+lFKeGrZCuYLHMwhkmgs/s7inkEn8uVdfDVbJIYo43KymNL1hsvPc/VmJq 76y9aKikn1ibQE3WQGPmaZ7ELzABSJT6UzewyCPStO+Hw== IronPort-HdrOrdr: A9a23:ENnVu62qu+sCT10vgT5uSwqjBIgkLtp133Aq2lEZdPRUGvb4qy nIpoVi6faUskdpZJhOo6HiBEDtexzhHNtOkO0s1NSZLW/bUQmTXeNfBOLZqlWKcUCTygce79 YGT0EXMqyKMbEQt6bHCWeDferIuOP3lZyVuQ== X-IronPort-AV: E=Sophos;i="5.92,280,1650945600"; d="scan'208";a="76442484" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu Subject: [PATCH 3/5] xen/wait: Minor asm improvements Date: Mon, 18 Jul 2022 08:18:23 +0100 Message-ID: <20220718071825.22113-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20220718071825.22113-1-andrew.cooper3@citrix.com> References: <20220718071825.22113-1-andrew.cooper3@citrix.com> 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: 1658128765253100001 There is no point preserving all registers. Instead, preserve an arbitrary= 6 registers, and list the rest as clobbered. This does not alter the register scheduling at all, but does reduce the amount of state needing saving. Use a named parameter for page size, instead of needing to parse which is parameter 3. Adjust the formatting of the parameters slightly to simply the diff of the subsequent patch. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu --- xen/common/wait.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/xen/common/wait.c b/xen/common/wait.c index 4dcfa17a8a3f..4bc030d1a09d 100644 --- a/xen/common/wait.c +++ b/xen/common/wait.c @@ -151,13 +151,12 @@ static void __prepare_to_wait(struct waitqueue_vcpu *= wqv) * copies in from wqv->stack over the active stack. */ asm volatile ( - "push %%rax; push %%rbx; push %%rdx; push %%rbp;" - "push %%r8; push %%r9; push %%r10; push %%r11;" - "push %%r12; push %%r13; push %%r14; push %%r15;" + "push %%rbx; push %%rbp; push %%r12;" + "push %%r13; push %%r14; push %%r15;" =20 "sub %%esp,%%ecx;" - "cmp %3,%%ecx;" - "ja .L_skip;" + "cmp %[sz], %%ecx;" + "ja .L_skip;" /* Bail if >4k */ "mov %%rsp,%%rsi;" =20 /* check_wakeup_from_wait() longjmp()'s to this point. */ @@ -165,12 +164,12 @@ static void __prepare_to_wait(struct waitqueue_vcpu *= wqv) "mov %%rsp,%%rsi;" =20 ".L_skip:" - "pop %%r15; pop %%r14; pop %%r13; pop %%r12;" - "pop %%r11; pop %%r10; pop %%r9; pop %%r8;" - "pop %%rbp; pop %%rdx; pop %%rbx; pop %%rax" + "pop %%r15; pop %%r14; pop %%r13;" + "pop %%r12; pop %%rbp; pop %%rbx;" : "=3D&S" (wqv->esp), "=3D&c" (dummy), "=3D&D" (dummy) - : "i" (PAGE_SIZE), "0" (0), "1" (cpu_info), "2" (wqv->stack) - : "memory" ); + : "0" (0), "1" (cpu_info), "2" (wqv->stack), + [sz] "i" (PAGE_SIZE) + : "memory", "rax", "rdx", "r8", "r9", "r10", "r11" ); =20 if ( unlikely(wqv->esp =3D=3D 0) ) { @@ -224,11 +223,12 @@ void check_wakeup_from_wait(void) * All other GPRs are available for use; they're either restored from * wqv->stack or explicitly clobbered. */ - asm volatile ( - "mov %1,%%"__OP"sp; jmp .L_wq_resume;" - : : "S" (wqv->stack), "D" (wqv->esp), - "c" ((char *)get_cpu_info() - (char *)wqv->esp) - : "memory" ); + asm volatile ( "mov %%rdi, %%rsp;" + "jmp .L_wq_resume;" + : + : "S" (wqv->stack), "D" (wqv->esp), + "c" ((char *)get_cpu_info() - (char *)wqv->esp) + : "memory" ); unreachable(); } =20 --=20 2.11.0 From nobody Sun May 19 07:11:45 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=1658128768; cv=none; d=zohomail.com; s=zohoarc; b=WE8otwAGTl9kScHY3xtFziuMRbw6vPw2c98+yDBDx2S+XJ5b70L7vkcPaGXTbG4cOY1kCr41plgvF4qpxj3nrgC0ffAmXCVUtD6V/LD1SZ9JKYvjuIRkRNY8ySAWfU5IC4e3nlgxUQ+AyRtfwhfBUYLq2XYyCibY6fy2YkKczCA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658128768; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Wu6Fd3RRflaiqq9CnPdXyLso0fcYuj4oay1M8fpeFgE=; b=Fg+DIF8m0kIwc+l9w9ltD7D12/mq9QwpMDMbMrszxv/Zr6u0Y/5WzFJ2TPFaphrRm38elbjwVkW/7CzhM8Hzu6emJ0A6W5Zy0M5T5fKCVdRY0pIm/1leBRH6WGAVYXlC14sp04zYK7KXzqPG7fdnaXz33w+1QAP1WNFDJYcIhI4= 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 1658128768921488.7503099350166; Mon, 18 Jul 2022 00:19:28 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.369276.600626 (Exim 4.92) (envelope-from ) id 1oDL1m-0005U9-K7; Mon, 18 Jul 2022 07:18:50 +0000 Received: by outflank-mailman (output) from mailman id 369276.600626; Mon, 18 Jul 2022 07:18:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oDL1m-0005Rb-CH; Mon, 18 Jul 2022 07:18:50 +0000 Received: by outflank-mailman (input) for mailman id 369276; Mon, 18 Jul 2022 07:18:48 +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 1oDL1k-0004to-Nh for xen-devel@lists.xenproject.org; Mon, 18 Jul 2022 07:18:48 +0000 Received: from esa2.hc3370-68.iphmx.com (esa2.hc3370-68.iphmx.com [216.71.145.153]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id dcd84a51-0669-11ed-924f-1f966e50362f; Mon, 18 Jul 2022 09:18:46 +0200 (CEST) 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: dcd84a51-0669-11ed-924f-1f966e50362f DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1658128726; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ebOQyw54nOOd0pf8acUFtFVapBth6uiZeKHzw4jUO8k=; b=dbRg3o8jbpf7EYumHEO9USjY+zLSYaKU6IU3RjkwyUnzL8bnIQ3sMkJw TuUrI0SedUVrKNuV/qcJeYeFxVx+Hjjw8tsvdWg+e9QBL8KMxxATDqO/S BVv/MW2GfUmXN8oX7WoytCg9e1rz/RMFOXQ8E+krJfNLHWhoTQRmpydmo E=; Authentication-Results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 2.7 X-MesageID: 76007332 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: =?us-ascii?q?A9a23=3AzjBJsa2tB0xEkJQofPbDix16xS7N8HFdZTh5A?= =?us-ascii?q?9k8jSZ0cfkRliZWkhF6PiwklHlZu+rW2YndT/em3FGgmSslSUnMXd4QO/PJH?= =?us-ascii?q?hVrmHATwQEHUHVE2NFApiHviEdWNnjUaBy65wBs81Eismu0A9pSy5YFciCEk?= =?us-ascii?q?jMPwJ7ek37nVVutO35b33UT7JRP5F/H3jn+KVRCr5/xrZZxp+VXVcLF2F/lF?= =?us-ascii?q?q3KSUyb0H8LcL8SdO1n3lp5gr09/uS/VfPfvYA9iS3hT7yfGtBZyU31dpkBN?= =?us-ascii?q?rx7mkC4lYI8xl9BbuzQl74WYbXOwNE/LrirTkv/hEMReKhLiR+VXP5Z+PtEz?= =?us-ascii?q?TU6wWRo/NhkDABzB3T4+aL8uBx9xnwALmCCVJBPKATbm+55KHZrd4jNRVens?= =?us-ascii?q?DLN5KJ1Y6xEWpQzxsWc5HfteSE8KUCIRl/fIwRaGMAsL/A3WrdvC88c/l0lI?= =?us-ascii?q?PjXh23vQYIm3LxsIRS7q8w01GL6FhGa6/6SXuQGnlFXp4T8Ji5Pt0qELmP4L?= =?us-ascii?q?T09DwL1nc7phsLmE9/PePhpT6Ud1kUBu09lXuDlpZ+xCmm8rIQEhZ7j4u+Ta?= =?us-ascii?q?yUflwoG+NwI4z/9IKnKb0cFF4+9zymJqLwW1Wnrc//O+P9cjXfFrPkKSUqQm?= =?us-ascii?q?2EggxRtnS4E/6WVUlJrarcs5WB/VN1P/ZAXBxdJHGF3ZCUNGeaP2BXb2zapl?= =?us-ascii?q?sufyb+QxJFWdAd2AKlTk6hmAtFfGCY3BqecuUIAeOODnFRSRD5El1bZkVTeA?= =?us-ascii?q?BXJEPLNd6CmcKiocVKHTNs1Rtv+ib0aow1Vd0Yv32hmzbpopmL+T6n4Aa8AV?= =?us-ascii?q?rHNePMiFAEcM32wAr6S6dapPO3yV3uMjFv6Ys88F8D7hZo936QdpG89j2JPV?= =?us-ascii?q?rhuBki62RiKdIFqrKlnavZ/bY657+c1P0iwmUgF9QIKc4jf6twjk8fpsaxq+?= =?us-ascii?q?Giw3iXdS68a5dxfndxD3hcJfd/wNlkKM5LF7u0ozPQ7Ez77Jl+YmJwAhQI1E?= =?us-ascii?q?kXMrCr08HlFkRWHYITsYZaSi2ElyS0RC9cKwnNjQEmQ2HMSjMrSInTqrdQjf?= =?us-ascii?q?+riPAUd+l8mNMHVbXcIXHDycDBQse6Ge8bg9VxNOzDtekFMDffAlheffciXv?= =?us-ascii?q?URsKXmLqcbiYkn4WewPfWmZfqzlVyBvIrUWimBC2wBsY1lCh8k2L2jiJKs6A?= =?us-ascii?q?l4i018ucgPgxFmvAtc0uyjgJ5STKYWPAmnX27nXbh9s9dWyo2btBF4JolKew?= =?us-ascii?q?yKnxDWTKc7IbTZXOLcM8xw4dLBHJ4U5irDGZSfpCErn3f4IU4cmTxMgwifYs?= =?us-ascii?q?04mdMMGMQTLyr/6MdJyQEA2j5uuxVn40FcGIB0CuzDrO45+s52Ra633kXyOe?= =?us-ascii?q?UecITqzRciQrgQ1W0OoyawiQerdoeH0bJwZSDZH28HIVc7UaZGK4buvxPDiI?= =?us-ascii?q?OhldnMURbQj8s2ZDSXG5OLr9fEWX1nI36xi9QnDc7DZH8/GVR99AO9doyOuS?= =?us-ascii?q?1XDLNLwsiuh0pNr8n2WYiScvxMph9l9L8q0O24BqBKIMlalyS4MuQZ21pcl+?= =?us-ascii?q?7pZOwDGzoNGu6mw2XodioYsE52k+95+n5vAiQ8n40yjzVLk6zardi15ONIP6?= =?us-ascii?q?BmCHVyscY0b5B/8Gj89HB7vxzzp1sGb1qGR/EaOwbAa6TGikImFi9Dn2iV+v?= =?us-ascii?q?WsizV5GHj0BIc08AUTtwB5HHVScAGy2hNmS5u8QCzMbSMOXQiTGa3P9x3rtO?= =?us-ascii?q?HMSePyfCBDtS7A49pq2qbVqjvTqlOyhDwZEpz693zP4aekwr9NbEctmYzP5o?= =?us-ascii?q?8ssw5YIW8yqTqsDy3lo5aJEjsNqcdoc5qJl/IOkFXuj3N6ka7Z49rFDWBIEJ?= =?us-ascii?q?kyh00D/Qd+h99JpNijBx/QGjyb544knApj9Ejal+CU0Ywh20BqUNi7eKaUcq?= =?us-ascii?q?HJA/ofDDxeKFpJk5EL4wYvctZslSfJJ4R3JyAc4c5s1TS+3GixP7gZxI/icX?= =?us-ascii?q?+Na5bY8xIPrhWMW7hC8A72hBrVvHbt79AuNDhw26dB10X/ckN7JR8mblrdqM?= =?us-ascii?q?frVtZbolwZFcU7nqfLSK8j8rbrOLzIWpUeHZy91oDwz4nfAE3JecsOKzTdqu?= =?us-ascii?q?1C9AkQCD+8XC/mUfPBOhE2AmA0IJ4GFX289K03lJPx0aR3997VDbHIasgdyP?= =?us-ascii?q?e3+pkEwtUXw26Jor0+X4bXD7xZ28BjVchK/lyrWU/ujyFtTBZ3e7NWsnlQQT?= =?us-ascii?q?WIeGwUrodpuJrSGaaLo9GGoxT19Nv3uIp4ox9nRMgHxAOQTJp2OZ63K4KtgZ?= =?us-ascii?q?o69spRrkTbnOQSfVRrxN12Er5y4z4b/E3BsOIHhLAFB7kdpPCsz7iZfLsgYu?= =?us-ascii?q?VEXz7UQCGOFCSEIzBob9f2riyi5KiDJrg9jSpp9yxa0SV7oOaZZub+vcX+RG?= =?us-ascii?q?abo8BPqd4Iou1q9SsQO0znSDXzPbobCCTDCaL+MN2eEXbefTVQzeXq+3/1g6?= =?us-ascii?q?+OE/b/UgQWHkjK2JGEMaTjKqH2ozj4SInCJAUhMPApaPU53NqC5Vgf7RlsOJ?= =?us-ascii?q?J9XxseJneJi6YTkHGtDva8UAa47lvKzc2ZMLHNHfVPYG6Q5gg/Rrd41LgRGv?= =?us-ascii?q?EI5NmNuy3YQwZqtSB3mgzFhIoshSkkfmg6fvAGkhao89CkGoTqbJafEAy084?= =?us-ascii?q?2u7U8M7jxVpIVtopct0AuiWcTNdhKh0d0Lz8pm1so0Z8FrzDCepLYKVW6cdf?= =?us-ascii?q?3FZ5JzO7gB7Wdgwrbip3We7+UJn?= X-IronPort-AV: E=Sophos;i="5.92,280,1650945600"; d="scan'208";a="76007332" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu Subject: [PATCH 4/5] xen/wait: Use relative stack adjustments Date: Mon, 18 Jul 2022 08:18:24 +0100 Message-ID: <20220718071825.22113-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20220718071825.22113-1-andrew.cooper3@citrix.com> References: <20220718071825.22113-1-andrew.cooper3@citrix.com> 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: 1658128770992100005 The waitqueue's esp field is overloaded. It serves both as an indication t= hat the waitqueue is in use, and as a direction to check_wakeup_from_wait() as = to where to adjust the stack pointer to, but using an absolute pointer comes w= ith a cost if requiring the vCPU to wake up on the same pCPU it went to sleep o= n. Instead, have the waitqueue just keep track of how much data is on wqv->sta= ck. This is no practical change in __prepare_to_wait() (it already calculated t= he delta) but split the result out of the (also overloaded) %rsi output parame= ter by using a separate register instead. check_wakeup_from_wait() has a bit more work to do. It now needs to calcul= ate the adjustment to %rsp rather than having the new %rsp provided as a parameter. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu --- xen/common/wait.c | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/xen/common/wait.c b/xen/common/wait.c index 4bc030d1a09d..4f1daf650bc4 100644 --- a/xen/common/wait.c +++ b/xen/common/wait.c @@ -32,8 +32,8 @@ struct waitqueue_vcpu { * Xen/x86 does not have per-vcpu hypervisor stacks. So we must save t= he * hypervisor context before sleeping (descheduling), setjmp/longjmp-s= tyle. */ - void *esp; char *stack; + unsigned int used; #endif }; =20 @@ -121,11 +121,11 @@ void wake_up_all(struct waitqueue_head *wq) =20 static void __prepare_to_wait(struct waitqueue_vcpu *wqv) { - struct cpu_info *cpu_info =3D get_cpu_info(); struct vcpu *curr =3D current; unsigned long dummy; + unsigned int used; =20 - ASSERT(wqv->esp =3D=3D 0); + ASSERT(wqv->used =3D=3D 0); =20 /* Save current VCPU affinity; force wakeup on *this* CPU only. */ if ( vcpu_temporary_affinity(curr, smp_processor_id(), VCPU_AFFINITY_W= AIT) ) @@ -154,24 +154,25 @@ static void __prepare_to_wait(struct waitqueue_vcpu *= wqv) "push %%rbx; push %%rbp; push %%r12;" "push %%r13; push %%r14; push %%r15;" =20 - "sub %%esp,%%ecx;" + "sub %%esp, %%ecx;" /* ecx =3D delta to cpu_info */ "cmp %[sz], %%ecx;" "ja .L_skip;" /* Bail if >4k */ - "mov %%rsp,%%rsi;" + + "mov %%ecx, %%eax;" + "mov %%rsp, %%rsi;" /* Copy from the stack, into wqv->stack */ =20 /* check_wakeup_from_wait() longjmp()'s to this point. */ ".L_wq_resume: rep movsb;" - "mov %%rsp,%%rsi;" =20 ".L_skip:" "pop %%r15; pop %%r14; pop %%r13;" "pop %%r12; pop %%rbp; pop %%rbx;" - : "=3D&S" (wqv->esp), "=3D&c" (dummy), "=3D&D" (dummy) - : "0" (0), "1" (cpu_info), "2" (wqv->stack), + : "=3Da" (used), "=3DD" (dummy), "=3Dc" (dummy), "=3D&= S" (dummy) + : "a" (0), "D" (wqv->stack), "c" (get_cpu_info()), [sz] "i" (PAGE_SIZE) - : "memory", "rax", "rdx", "r8", "r9", "r10", "r11" ); + : "memory", "rdx", "r8", "r9", "r10", "r11" ); =20 - if ( unlikely(wqv->esp =3D=3D 0) ) + if ( unlikely(used > PAGE_SIZE) ) { gdprintk(XENLOG_ERR, "Stack too large in %s\n", __func__); domain_crash(curr->domain); @@ -179,11 +180,13 @@ static void __prepare_to_wait(struct waitqueue_vcpu *= wqv) for ( ; ; ) do_softirq(); } + + wqv->used =3D used; } =20 static void __finish_wait(struct waitqueue_vcpu *wqv) { - wqv->esp =3D NULL; + wqv->used =3D 0; vcpu_temporary_affinity(current, NR_CPUS, VCPU_AFFINITY_WAIT); } =20 @@ -191,10 +194,11 @@ void check_wakeup_from_wait(void) { struct vcpu *curr =3D current; struct waitqueue_vcpu *wqv =3D curr->waitqueue_vcpu; + unsigned long tmp; =20 ASSERT(list_empty(&wqv->list)); =20 - if ( likely(wqv->esp =3D=3D NULL) ) + if ( likely(!wqv->used) ) return; =20 /* Check if we are still pinned. */ @@ -220,14 +224,22 @@ void check_wakeup_from_wait(void) * the rep movs in __prepare_to_wait(), it copies from wqv->stack over= the * active stack. * + * We are also bound by __prepare_to_wait()'s output constraints, so %= eax + * needs to be wqv->used. + * * All other GPRs are available for use; they're either restored from * wqv->stack or explicitly clobbered. */ - asm volatile ( "mov %%rdi, %%rsp;" + asm volatile ( "sub %%esp, %k[var];" /* var =3D delta to cpu_info */ + "neg %k[var];" + "add %%ecx, %k[var];" /* var =3D -delta + wqv->used */ + + "sub %[var], %%rsp;" /* Adjust %rsp down to make room = */ + "mov %%rsp, %%rdi;" /* Copy from wqv->stack, into the= stack */ "jmp .L_wq_resume;" - : - : "S" (wqv->stack), "D" (wqv->esp), - "c" ((char *)get_cpu_info() - (char *)wqv->esp) + : "=3DD" (tmp), [var] "=3D&r" (tmp) + : "S" (wqv->stack), "c" (wqv->used), "a" (wqv->used), + "[var]" (get_cpu_info()) : "memory" ); unreachable(); } --=20 2.11.0 From nobody Sun May 19 07:11:45 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=1658128769; cv=none; d=zohomail.com; s=zohoarc; b=YZx4Y+QyisCEvizQOLNFNovjVUxnQ7IL/mwQ+M6gwgZNDRQQDHN8niL0DceRf0f44FnDrx/zuYOuGXjFDTkLJkQJCuAwqTEY2J/6OOFREPaksDhDbf2JxnrkdiE8fKr6JjNBL6i8h+kwnT2MBibdPSNix88/RzOlERbX2wwxvCs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658128769; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MDHd2fkTUTfV4GY3NyG8J2exIRAOlRzNwUDIMUN93Zw=; b=DusTu+Ivuywi9h+WPvK6WbrZHzST3wlKLkTcorH3FJMxm/SJFzAXPD7Y+sFsyI21/MIh/OsbYKiOv8H+PiGqJP//PShfyw1n2cozQ1YHcWar6ZnuU+6a3VJgjMGyEVeEs0wDXKMEEjmjIkd4Y1NDrU47X+bzorH4ElaJWxV/GYE= 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 1658128769502659.0252059721025; Mon, 18 Jul 2022 00:19:29 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.369273.600605 (Exim 4.92) (envelope-from ) id 1oDL1l-0005BU-Fq; Mon, 18 Jul 2022 07:18:49 +0000 Received: by outflank-mailman (output) from mailman id 369273.600605; Mon, 18 Jul 2022 07:18:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oDL1l-0005BN-Ci; Mon, 18 Jul 2022 07:18:49 +0000 Received: by outflank-mailman (input) for mailman id 369273; Mon, 18 Jul 2022 07:18:47 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1oDL1j-0004tp-Eu for xen-devel@lists.xenproject.org; Mon, 18 Jul 2022 07:18:47 +0000 Received: from esa1.hc3370-68.iphmx.com (esa1.hc3370-68.iphmx.com [216.71.145.142]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id db29b1b6-0669-11ed-bd2d-47488cf2e6aa; Mon, 18 Jul 2022 09:18:45 +0200 (CEST) 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: db29b1b6-0669-11ed-bd2d-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1658128725; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PfqPuU4iTL51oPEUzQUxPoZi5ngRHlXvkVkGKzmfCpg=; b=Cl4/cJ4sG+JO9UjFbRgz+vXSyCSLwY79A0ptG1tdgkJzKNYr4D2Vq2ij aIeySyznHnmJTl5Eo+BkFr7il9rlQ97FsVghTuVZnzv6k2hnPrH0DucM3 sGNoJvsGiIFgFCrEO27Yo4WMKZiepnP27NBNzddkBTiJzdhueUYvLHk0y o=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 2.7 X-MesageID: 76442482 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:KjqbEqMATTNixGLvrR2xl8FynXyQoLVcMsEvi/4bfWQNrUpwhTQDy DAYUG+Hbv3fN2b0Kd13YN/npxwE7JTWmN5jSgto+SlhQUwRpJueD7x1DKtR0wB+jCHnZBg6h ynLQoCYdKjYdleF+lH3dOCJQUBUjcmgXqD7BPPPJhd/TAplTDZJoR94kqsyj5UAbeKRWmthg vuv5ZyFULOZ82QsaDhMtPvc8EkHUMna41v0gHRvPZing3eG/5UlJMp3Db28KXL+Xr5VEoaSL woU5Ojklo9x105F5uKNyt4XQGVTKlLhFVHmZk5tc7qjmnB/Shkaic7XAha+hXB/0F1ll/gpo DlEWAfZpQ0BZsUgk8xFO/VU/r0X0QSrN9YrLFDm2fF/wXEqfFPd/uVFL2xmPrchucBsBW1q6 85CGi0SO0Xra+KemNpXS8Fpj8UnasLqIJkeqjdryjSx4fQOGM6ZBf+QvJkBgWl21psm8fX2P qL1bRJGahjabgIJEVAQEJ8kx8+jh2Xlci0eo1WQzUYyyzeNkFArjOi3WDbTUvOQfsRUsmmAn 03l42bBWk4fGc247QPQpxpAgceQxHimCer+DoaQ9PFwh0aI7ncOExBQXly+ydG1hEexVNNYL 0084Tc1oO4580nDZvvXUgC8oXWElgUBQNcWGOo/gCmdx6yR7wuHC2wsSj9adMdgpMIwXSYt1 FKCg5XuHzMHmKKRYWKQ8PGTtzzaBMQOBTZcP2leF1JDuoS95tFo5v7Scjp9OJ+InvbWNGHz+ QnJijM6i5ENv5Q5yrruqDgrnAmQSoj1oh8dv1uKATP9v1IlPuZJdKTztwGFsK8owJKxCwDY4 SNaw5X2APUmV8nlqcCbfAka8FhFDd6hOSaUv1NgFoJJG9+Fqy/6JtA4DN2TyS5U3ic4ldzBO ha7Vft5vsM7AZdTRfYfj3iNI8or17P8Mt/uS+rZaNFDCrAoKlLXpHE0NBHIhjGx+KTJrU3YE c7BGftA8F5AUfg3pNZIb711PUAXKtAWmjqIGMGTI+WP2ruCfn+FIYo43K+1RrlgtMus/VSKm +uzwuPQlH2zpsWiPXSMmWPSRHhWRUUG6Wfe8ZEPKL7bf1Y6QAnMyZb5mNscRmCspIwN/s+gw 513chUwJIbX7ZEfFTi3Vw== IronPort-HdrOrdr: A9a23:zruxQq8fbdeFxVAGgkJuk+DgI+orL9Y04lQ7vn2YSXRuHPBw8P re5cjztCWE7gr5N0tBpTntAsW9qDbnhPtICOoqTNCftWvdyQiVxehZhOOIqVDd8m/Fh4pgPM 9bAtBD4bbLbGSS4/yU3ODBKadD/OW6 X-IronPort-AV: E=Sophos;i="5.92,280,1650945600"; d="scan'208";a="76442482" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , Juergen Gross , Dario Faggioli Subject: [PATCH 5/5] xen/wait: Remove VCPU_AFFINITY_WAIT Date: Mon, 18 Jul 2022 08:18:25 +0100 Message-ID: <20220718071825.22113-6-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20220718071825.22113-1-andrew.cooper3@citrix.com> References: <20220718071825.22113-1-andrew.cooper3@citrix.com> 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: 1658128770864100001 With the waitqueue logic updated to not use an absolute stack pointer reference, the vCPU can safely be resumed anywhere. Remove VCPU_AFFINITY_WAIT completely, getting rid of two domain crashes, an= d a logical corner case where resetting the vcpu with an oustanding waitqueue would crash the domain. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu CC: Juergen Gross CC: Dario Faggioli --- xen/common/domain.c | 2 -- xen/common/sched/core.c | 4 +--- xen/common/wait.c | 23 ----------------------- xen/include/xen/sched.h | 1 - 4 files changed, 1 insertion(+), 29 deletions(-) diff --git a/xen/common/domain.c b/xen/common/domain.c index 618410e3b257..323b92102cce 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -1428,8 +1428,6 @@ int vcpu_reset(struct vcpu *v) v->is_initialised =3D 0; if ( v->affinity_broken & VCPU_AFFINITY_OVERRIDE ) vcpu_temporary_affinity(v, NR_CPUS, VCPU_AFFINITY_OVERRIDE); - if ( v->affinity_broken & VCPU_AFFINITY_WAIT ) - vcpu_temporary_affinity(v, NR_CPUS, VCPU_AFFINITY_WAIT); clear_bit(_VPF_blocked, &v->pause_flags); clear_bit(_VPF_in_reset, &v->pause_flags); =20 diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index f689b55783f7..cff8e59aba7c 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -1610,12 +1610,10 @@ void watchdog_domain_destroy(struct domain *d) /* * Pin a vcpu temporarily to a specific CPU (or restore old pinning state = if * cpu is NR_CPUS). - * Temporary pinning can be done due to two reasons, which may be nested: + * Temporary pinning can be done for a number of reasons, which may be nes= ted: * - VCPU_AFFINITY_OVERRIDE (requested by guest): is allowed to fail in ca= se * of a conflict (e.g. in case cpupool doesn't include requested CPU, or * another conflicting temporary pinning is already in effect. - * - VCPU_AFFINITY_WAIT (called by wait_event()): only used to pin vcpu to= the - * CPU it is just running on. Can't fail if used properly. */ int vcpu_temporary_affinity(struct vcpu *v, unsigned int cpu, uint8_t reas= on) { diff --git a/xen/common/wait.c b/xen/common/wait.c index 4f1daf650bc4..bd6f09662ac0 100644 --- a/xen/common/wait.c +++ b/xen/common/wait.c @@ -127,16 +127,6 @@ static void __prepare_to_wait(struct waitqueue_vcpu *w= qv) =20 ASSERT(wqv->used =3D=3D 0); =20 - /* Save current VCPU affinity; force wakeup on *this* CPU only. */ - if ( vcpu_temporary_affinity(curr, smp_processor_id(), VCPU_AFFINITY_W= AIT) ) - { - gdprintk(XENLOG_ERR, "Unable to set vcpu affinity\n"); - domain_crash(curr->domain); - - for ( ; ; ) - do_softirq(); - } - /* * Hand-rolled setjmp(). * @@ -187,7 +177,6 @@ static void __prepare_to_wait(struct waitqueue_vcpu *wq= v) static void __finish_wait(struct waitqueue_vcpu *wqv) { wqv->used =3D 0; - vcpu_temporary_affinity(current, NR_CPUS, VCPU_AFFINITY_WAIT); } =20 void check_wakeup_from_wait(void) @@ -201,18 +190,6 @@ void check_wakeup_from_wait(void) if ( likely(!wqv->used) ) return; =20 - /* Check if we are still pinned. */ - if ( unlikely(!(curr->affinity_broken & VCPU_AFFINITY_WAIT)) ) - { - gdprintk(XENLOG_ERR, "vcpu affinity lost\n"); - domain_crash(curr->domain); - - /* Re-initiate scheduler and don't longjmp(). */ - raise_softirq(SCHEDULE_SOFTIRQ); - for ( ; ; ) - do_softirq(); - } - /* * Hand-rolled longjmp(). * diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index b9515eb497de..ba859a4abed3 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -223,7 +223,6 @@ struct vcpu /* VCPU need affinity restored */ uint8_t affinity_broken; #define VCPU_AFFINITY_OVERRIDE 0x01 -#define VCPU_AFFINITY_WAIT 0x02 =20 /* A hypercall has been preempted. */ bool hcall_preempted; --=20 2.11.0