Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2121274imu; Wed, 12 Dec 2018 09:50:22 -0800 (PST) X-Google-Smtp-Source: AFSGD/U4D43DUCw+e3aiN848mk8ZrkThUiUadGokyyK6+pAften5cyMnHWEtWADeszw1LANZaeUm X-Received: by 2002:a63:e247:: with SMTP id y7mr18137590pgj.84.1544637022520; Wed, 12 Dec 2018 09:50:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544637022; cv=none; d=google.com; s=arc-20160816; b=UP32Bfgws8ptEVuTttExK4mnXjKTCfAXVMiUpfOmJM/Zq8Choq5rSZ6/vILdZ4Knts z8oBUDJWypoVQZ2EXdVLQC480iYGXncwPsjWZtXwcdVBgiEduGrGyLNpSKhcadUpFGFp gOsg2U0Yv8hrMj05XinR2z+/tB93KUEuHJLdgFtJVkCxEiEapt4PiLKUqU7sCKO70DCJ bUQ8SPs8H83CxRRyb5zbm8viy0qWqS3qBn/dO3CxoNWHI0y7U4qeqqKXLEo0zppyXn7N gy9GzS9TPULCWKYRK3kDpOkbaV+aSl3fQ/UrXLriExMYOQqDEuE+612lRQjG9zA6QjWf qK/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:subject:from; bh=KK1dHEW++314gr7gA5pyYSiSCLheDxNydxHmV3zFrYc=; b=yiF48tqTuklwP2NPCLZOfMIx0fTViJgoE49GSXFv9EiYeu7x7Wmz3UK1hGpbMGH9iZ kUu3UCqMpfBV7rPuHyqGzNvfCZzdBVrEgCk7KXCOvq0ENPKCW+DKqxnV5qwPfDiuNvKB bOFt/uOqu/TJMQ9uusqrQ+OlJ/388SGLGUGD8U+PBFPqzPrBiZJNwTITQJd6Jkg3BS/2 9gBJBOZFKe+ygxvUwjZrB4XKLcD3ZVlv6KpFCgpkhZCwlghE/mN9cv3z4a0sah3/bz1O cboUfu7D71CfyIioZUqJx2Lw5WiubH6soT02s/MuUWQQcoKQ2aNRdUFGoa/MfdBh83yh JKeQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 28si14268157pgz.593.2018.12.12.09.50.07; Wed, 12 Dec 2018 09:50:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728027AbeLLRsD (ORCPT + 99 others); Wed, 12 Dec 2018 12:48:03 -0500 Received: from dispatch1-us1.ppe-hosted.com ([67.231.154.164]:51670 "EHLO dispatch1-us1.ppe-hosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726922AbeLLRsC (ORCPT ); Wed, 12 Dec 2018 12:48:02 -0500 X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us3.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 8547D9C0099; Wed, 12 Dec 2018 17:48:00 +0000 (UTC) Received: from ec-desktop.uk.solarflarecom.com (10.17.20.45) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 12 Dec 2018 09:47:57 -0800 From: Edward Cree Subject: [RFC/WIP PATCH 0/2] dynamic calls To: Nadav Amit , Josh Poimboeuf CC: , , Paolo Abeni References: <899194d1-9777-71ed-70db-212d2983a400@solarflare.com> Message-ID: Date: Wed, 12 Dec 2018 17:47:55 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <899194d1-9777-71ed-70db-212d2983a400@solarflare.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Originating-IP: [10.17.20.45] X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24280.005 X-TM-AS-Result: No-9.708800-4.000000-10 X-TMASE-MatchedRID: iZSYSp7wuoOoft0ZW3r/iQu4z2zJ4LkwBrGz9f3wJzlc+P5Lb7BNmVBd F6X5OpyIRInpfPpZMWE1eCdCD5PKUbP3o+ZlKNhqa0aUozXm0DZhBfGxmdHCggZbeEWcL03Vx6w Ad+Ddvm2ZzJUYRez6LSAyr+pzA58YYRidSTcEzWtT46Ow+EhYOF+U6kGoEdO3+Cckfm+bb6CtBF nLFqDVm0fcXkmynd8V4O5xOUvdXNHKFqYEr+5FcpyBsp6+TmyGUFxKv+2AmMiNXkYeZoSa+mMIX jR0WbWfPMFIpY/dxHMQEXGkOwA4tZM/iGkspNZAB7TqRAYVohZBrawMcuRDTlpbYq2f4jz+Unrm t73cm+TkmJ+rSFeO5UHtx5AxXwQHoHkSi6k0xD29sVmyowX1jzpmH5X+z4595DJ1FS+XdBO/F+8 1OFeimrOyivSg9ieqWKNxvq78azVJI5ZUl647UIMbH85DUZXyXU/IDt4T4+H6C0ePs7A07RQEL0 GGu6SD5Phyge6hCU+jqSJ1Y0pek9+o5uA442AmL8t4ZzYql0k= X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--9.708800-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24280.005 X-MDID: 1544636881-T54OtJgiQq0T Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A fix to the static_calls series (on which this series depends), and a really hacky proof-of-concept of runtime-patched branch trees of static_calls to avoid indirect calls / retpolines in the hot-path. Rather than any generally applicable machinery, the patch just open-codes it for one call site (the pt_prev->func() call in deliver_skb and __netif_receive_skb_one_core()); it should however be possible to make a macro that takes a 'name' parameter and expands to the whole thing. Also the _update() function could be shared and get something useful from its work_struct, rather than needing a separate copy of the function for every indirect call site. Performance testing so far has been somewhat inconclusive; I applied this on net-next, hacked up my Kconfig to use out-of-line static calls on x86-64, and ran some 1-byte UDP stream tests with the DUT receiving. On a single stream test, I saw packet rate go up by 7%, from 470Kpps to 504Kpps, with a considerable reduction in variance; however, CPU usage increased by a larger factor: (packet rate / RX cpu) is a much lower-variance measurement and went down by 13%. This however may be because it often got into a state where, while patching the calls (and thus sending all callers down the slow path) we continue to gather stats and see enough calls to trigger another update; as there's no code to detect and skip an update that doesn't change anything, we get into a tight loop of redoing updates. I am working on this & plan to change it to not collect any stats while an update is actually in progress. On a 4-stream test, the variance I saw was too high to draw any conclusions; the packet rate went down about 2½% but this was not statistically significant (and the fastest run I saw was with dynamic calls present). Edward Cree (2): static_call: fix out-of-line static call implementation net: core: rather hacky PoC implementation of dynamic calls include/linux/static_call.h | 6 +- net/core/dev.c | 222 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 221 insertions(+), 7 deletions(-)