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 65312C433F5 for ; Thu, 11 Nov 2021 17:58:44 +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 0AF6461268 for ; Thu, 11 Nov 2021 17:58:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0AF6461268 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.224829.388339 (Exim 4.92) (envelope-from ) id 1mlEKr-0005ke-7d; Thu, 11 Nov 2021 17:58:05 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 224829.388339; Thu, 11 Nov 2021 17:58:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mlEKr-0005kX-4e; Thu, 11 Nov 2021 17:58:05 +0000 Received: by outflank-mailman (input) for mailman id 224829; Thu, 11 Nov 2021 17:58:03 +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 1mlEKp-0005kR-5A for xen-devel@lists.xenproject.org; Thu, 11 Nov 2021 17:58:03 +0000 Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id e83478eb-4318-11ec-9787-a32c541c8605; Thu, 11 Nov 2021 18:58:01 +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: e83478eb-4318-11ec-9787-a32c541c8605 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1636653481; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CXeFV8Xqmdo3yz2//NOSZu7RJ4WSbd7zRTgIylaOvOw=; b=LuMpIMBnDZfdtGN4urH92ShVuE5jKi4uBdIkQPRr/rqxnDT/rTPmNXv+ grhxNFTU1vjdai248yix1jksNE4xj5VbbBcJwIvPzDYgMRJIYuCSC8GA/ 17JOOcDNqM2HfriTzY7i2AMfWaUq3YQgVBdHTTBk3gglNL/zBzA2Zv+vq I=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: codMHIFZaRjxz7BqHayLa6IhmuTXM70vyzcqWvu+3nat2xxYf616NZ2HzcV1RQ/mxvnRjG1euK d4opZAV13N9LFdUWQjddNjSBmMCaXCqelaZTdHBMaws62FWMX66lyCpRIrxUjCjbaIyiq8tjlL agoUmbu1zMCAkNtjuAnTvSq1GNpKeIKDNswgIopjGfsbEKLGXxvUsWlhJ8vMIUkS0br7NnN/FH tmMT+hOqSD+nB/558Yd5WZxNwM7yYMzabhMRg5tIe0tQgm9uKWBS3Qi+BafTAMt1XdZQldgwPZ XV5G2EKGHlTJHi7sKIowXa2I X-SBRS: 5.1 X-MesageID: 57653922 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:ot6mJa/UsPR6BQ9CkMnVDrUDVHmTJUtcMsCJ2f8bNWPcYEJGY0x3x 2tNWT/VOqzbZWTzfN0gYY3noRhSv5TVy4drS1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WonOlPxgyovZoOm7aE+cZorfOZ4qLw/nKAsF /RVKd+dBvlvSyjc/2hPZ5fKs4E/Jg+gghiDPnT5bWFnLYJgXQHA5vTtYhDrqHsVFiOyuMZn+ ++g2wrXTIAtXQNnCMqKOvujw0no5SoWmf5oXluOKd5WIR2+/I9vIi33r/k2P8BTdkmTmmrEj 16bWE5Kq/PMrok59MjyqZqF94r5QfFjGkd6HnXA6erkPyft4Wf+k5RLV/yFfG6BWTqsqrmif +hc09r1LOYDwARRq4N5HrtmkfA+6t/oq+MIxwhoBiyWPVGiC7cmKXiax8hf8KZKw+YB6wexX 0uO/PhcOKmIZ5y5QAJAelJ9Y7TRz+wQlxnT8e8xcRfz6yJA9baaVVlfYkuXgytHIbopaI4oz I/NYiLNB9BTXvbyDuu7sw== IronPort-HdrOrdr: A9a23:YmBkxq9Bxiv3lbj1Ue9uk+DgI+orL9Y04lQ7vn2YSXRuHPBw8P re5cjztCWE7gr5N0tBpTntAsW9qDbnhPtICOoqTNCftWvdyQiVxehZhOOIqVDd8m/Fh4pgPM 9bAtBD4bbLbGSS4/yU3ODBKadD/OW6 X-IronPort-AV: E=Sophos;i="5.87,226,1631592000"; d="scan'208";a="57653922" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu Subject: [PATCH 5/5] x86/ioapic: Drop function pointers from __ioapic_{read,write}_entry() Date: Thu, 11 Nov 2021 17:57:40 +0000 Message-ID: <20211111175740.23480-6-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 Function pointers are expensive, and the raw parameter is a constant from all callers, meaning that it predicts very well with local branch history. Furthermore, the knock-on effects are quite impressive. $ ../scripts/bloat-o-meter xen-syms-before xen-syms-after add/remove: 0/4 grow/shrink: 3/9 up/down: 459/-823 (-364) Function old new delta __ioapic_write_entry 73 286 +213 __ioapic_read_entry 75 276 +201 save_IO_APIC_setup 182 227 +45 eoi_IO_APIC_irq 241 229 -12 disable_IO_APIC 296 280 -16 mask_IO_APIC_setup 272 240 -32 __io_apic_write 46 - -46 __io_apic_read 46 - -46 io_apic_set_pci_routing 985 930 -55 __io_apic_eoi.part 223 161 -62 io_apic_write 69 - -69 io_apic_read 69 - -69 restore_IO_APIC_setup 325 253 -72 ioapic_guest_write 1413 1333 -80 clear_IO_APIC_pin 447 343 -104 setup_IO_APIC 5148 4988 -160 Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Roger Pau Monné CC: Wei Liu --- xen/arch/x86/io_apic.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c index c3ad9efac88d..1c49a0fe1478 100644 --- a/xen/arch/x86/io_apic.c +++ b/xen/arch/x86/io_apic.c @@ -235,11 +235,19 @@ union entry_union { struct IO_APIC_route_entry __ioapic_read_entry( unsigned int apic, unsigned int pin, bool raw) { - unsigned int (*read)(unsigned int, unsigned int) - = raw ? __io_apic_read : io_apic_read; union entry_union eu; - eu.w1 = (*read)(apic, 0x10 + 2 * pin); - eu.w2 = (*read)(apic, 0x11 + 2 * pin); + + if ( raw ) + { + eu.w1 = __io_apic_read(apic, 0x10 + 2 * pin); + eu.w2 = __io_apic_read(apic, 0x11 + 2 * pin); + } + else + { + eu.w1 = io_apic_read(apic, 0x10 + 2 * pin); + eu.w2 = io_apic_read(apic, 0x11 + 2 * pin); + } + return eu.entry; } @@ -259,12 +267,18 @@ void __ioapic_write_entry( unsigned int apic, unsigned int pin, bool raw, struct IO_APIC_route_entry e) { - void (*write)(unsigned int, unsigned int, unsigned int) - = raw ? __io_apic_write : io_apic_write; union entry_union eu = { .entry = e }; - (*write)(apic, 0x11 + 2*pin, eu.w2); - (*write)(apic, 0x10 + 2*pin, eu.w1); + if ( raw ) + { + __io_apic_write(apic, 0x11 + 2 * pin, eu.w2); + __io_apic_write(apic, 0x10 + 2 * pin, eu.w1); + } + else + { + io_apic_write(apic, 0x11 + 2 * pin, eu.w2); + io_apic_write(apic, 0x10 + 2 * pin, eu.w1); + } } static void ioapic_write_entry( -- 2.11.0