From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34608C433F5 for ; Thu, 11 Nov 2021 17:58:50 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ED0CA61268 for ; Thu, 11 Nov 2021 17:58:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org ED0CA61268 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.224832.388368 (Exim 4.92) (envelope-from ) id 1mlEKy-0006MB-DF; Thu, 11 Nov 2021 17:58:12 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 224832.388368; Thu, 11 Nov 2021 17:58:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mlEKy-0006Ld-2b; Thu, 11 Nov 2021 17:58:12 +0000 Received: by outflank-mailman (input) for mailman id 224832; Thu, 11 Nov 2021 17:58:10 +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 1mlEKw-0005kR-HK for xen-devel@lists.xenproject.org; Thu, 11 Nov 2021 17:58:10 +0000 Received: from esa5.hc3370-68.iphmx.com (esa5.hc3370-68.iphmx.com [216.71.155.168]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ed5ad4e9-4318-11ec-9787-a32c541c8605; Thu, 11 Nov 2021 18:58:09 +0100 (CET) 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: ed5ad4e9-4318-11ec-9787-a32c541c8605 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1636653489; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=T/0v3Sf50cFNF0yODlWT/nVv/6FJ5Q1x8/OSVwgO6GU=; b=N3o6QLgR2TsS1YQBhgrnhxYf/Ew5hFqDWaK5+crlXtn7fjufJaMehnw/ rdSVa3sc+NiyP/WsXzdk5NayMm//V8u1qFnfvJYejxZ9RU6WO4e/QzAY6 5q09X0jcNVHloc7Fw1mHpntY4wdev4vcGTdHpyi+xZbJpQxMrGasbgDzt Q=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: ggK1CUUX5UhS1Uoe+hmHccflEXRTp8qP6qoQASuwhQ7Kcag+nXHrVcWvMInyZoRiAXSxQBOyMh icY6ZrvnEKPlyCsGQ+A4wgyEPMpDC9rAqmUSgoSTRhhn7XAnv4MJjhib8nO0raHGdWLTHR1FbR NvUY5I6eAMidEg0hwr4/U9PRNRjTZHx3SShdjvY39ffKxq9WEkExOY8u9libeskDBs+eukUBvD dmsYDXIKUp5Z7VFEomG9MJnE+BhOylAaTtoUVAZ0S1/bi8qaBaA0uyPdRx3Unc64P8h/VFPUnb rFRNN9KL1oeVyshHymzU1/th X-SBRS: 5.1 X-MesageID: 57155539 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:2Zbtlagvs3HzPLDzIC5skhXTX161rRcKZh0ujC45NGQN5FlHY01je htvDG2GMq6JN2T2Lt1yPtu0pk5X68fUzN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gOlOh2n4CZ4ez7fhAK8trLOd/rOEzn+RpS /QletmbBqgdQDrw5DlAP4L2q5ZvdUr3iFvWbTalejU2Y7VpWxfNpo3/ZgLq+SRXVni3uMIyr qeOzATeRZZfFQ1uANyPMKCkzk+rvGhbk+V3BhOaLt5WcUTq0Y5rNy2u0aNnf5BScU3On2LI2 RyXDBEUofj2j7U0qNSZ17qZq4qJEvdlGhYIFWfs8rvrZzLR+XCuwNEcXb/QLyzdTm795I6re f5Rk6PnKPQCkVtH79h8HrJswf5s7tfjveYHnAFtHXGNZFW3ELJwZHKB2JAX5KFKw7ZYvyqwW 16OpYYGaenYZpu9HQ5DPhchY8SCyeoQy2vb4vkCKUnn4DN6oeicWkJIMhjQ0CFQIdOZ6m/+L TvNbCLO1zGCtw== IronPort-HdrOrdr: A9a23:JEO63KotJcgm2uXwdh/HDFIaV5oTeYIsimQD101hICG8cqSj+f xG+85rrCMc6QxhPk3I9urhBEDtex/hHNtOkOws1NSZLW7bUQmTXeJfBOLZqlWKcUDDH6xmpM NdmsBFeaXN5DNB7PoSjjPWLz9Z+qjkzJyV X-IronPort-AV: E=Sophos;i="5.87,226,1631592000"; d="scan'208";a="57155539" 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: Remove indirect jump Date: Thu, 11 Nov 2021 17:57:39 +0000 Message-ID: <20211111175740.23480-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20211111175740.23480-1-andrew.cooper3@citrix.com> References: <20211111175740.23480-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit There is no need for this to be an indirect jump at all. Execution always returns to a specific location, so use a direct jump instead. Use a named label for the jump. As both 1 and 2 have disappeared as labels, rename 3 to skip to better describe its purpose. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Roger Pau Monné CC: Wei Liu --- xen/common/wait.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/xen/common/wait.c b/xen/common/wait.c index 24716e76768b..9276d76464fb 100644 --- a/xen/common/wait.c +++ b/xen/common/wait.c @@ -144,18 +144,16 @@ static void __prepare_to_wait(struct waitqueue_vcpu *wqv) "push %%r8; push %%r9; push %%r10; push %%r11;" "push %%r12; push %%r13; push %%r14; push %%r15;" - "call 1f;" - "1: addq $2f-1b,(%%rsp);" "sub %%esp,%%ecx;" "cmp %3,%%ecx;" - "ja 3f;" + "ja .L_skip;" "mov %%rsp,%%rsi;" /* check_wakeup_from_wait() longjmp()'s to this point. */ - "2: rep movsb;" + ".L_wq_resume: rep movsb;" "mov %%rsp,%%rsi;" - "3: pop %%rax;" + ".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" @@ -204,15 +202,14 @@ void check_wakeup_from_wait(void) } /* - * Hand-rolled longjmp(). Returns to the pointer on the top of - * wqv->stack, and lands on a `rep movs` instruction. All other GPRs are - * restored from the stack, so are available for use here. + * Hand-rolled longjmp(). Returns to __prepare_to_wait(), and lands on a + * `rep movs` instruction. All other GPRs are restored from the stack, so + * are available for use here. */ asm volatile ( - "mov %1,%%"__OP"sp; INDIRECT_JMP %[ip]" + "mov %1,%%"__OP"sp; jmp .L_wq_resume;" : : "S" (wqv->stack), "D" (wqv->esp), - "c" ((char *)get_cpu_info() - (char *)wqv->esp), - [ip] "r" (*(unsigned long *)wqv->stack) + "c" ((char *)get_cpu_info() - (char *)wqv->esp) : "memory" ); unreachable(); } -- 2.11.0