Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp383442ybi; Fri, 7 Jun 2019 09:35:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxfZHv3mZMXPq1SRBGm2/VsdPqZ0LP0ReJnn0MtPiNp+tTJbw9k43Ueeks/v9J6LHkFpRvm X-Received: by 2002:a63:5014:: with SMTP id e20mr3497269pgb.2.1559925326010; Fri, 07 Jun 2019 09:35:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559925326; cv=none; d=google.com; s=arc-20160816; b=mp8MbeJDMb+XFulkUX9j/jgw5gd62hK8+F82dMDK3W+wjrG2b9Sg14RvsESzcY5ev/ kOZjDBCk9Ad/ikVfXzXJ9dMuei+Z5NvztSEKa/kWS1pMzxYrUbw7qR5DJvCCisWb0fE6 RpZHILHdmxtvZv7FyfM997/zRkf9IFXZXFWuPIYTPspGtp7EnkBy0OgQg1/SVX85vRj5 7xr//ofDn0X5ajNNW12BY/0uQyrc1q0BOEXxdI2tbFzM9Id1F6zFFvlBVJ8uG4GADCq+ sfBu3DZPtaeW4tb4Agl4ED0SDE0GLS+/OcpeDESdVtrVDWMkuSrKZFDsRBPDz5TS6RVr P6Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=HcwcSPgb2LRTSBlVp16wxUn4yLqFThmUCJS2tDHezDY=; b=Qv2u6POc+OTyLiIVIgnvH5Eh6HqCgUTsPBtRXUr3/y+5Q5nseNkoqKjZlIs25+tk9+ hAfvzRT2Y5zo+oKbvImhgGt6WfilnJj7u8WxB1Cm4zN0QnMDGPYH4YqXDiyraBDVy9Ul XQmdpDPDrPN5OjYXnNCX+hii/plm9MyJyk0mV2s5JrJZm01OnuhUxrbg7qL7UP9Q8QZd SfmsZ9PjomGgoCfh5J3Lgv5zRFXiBShZB1t7egBe5bmmMO+z7oZvgO8xOUAmKCZ3ukMo bnjAUp2WT7lWNqzSZwyTH9UxDsR+q4BeoV9/wmxkdaTMGFaFYgZA2yurFv1yad4geaEZ sRqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=K4+DIabM; 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 p5si2130857pls.431.2019.06.07.09.35.09; Fri, 07 Jun 2019 09:35:25 -0700 (PDT) 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; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=K4+DIabM; 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 S1730550AbfFGQda (ORCPT + 99 others); Fri, 7 Jun 2019 12:33:30 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:35160 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728595AbfFGQda (ORCPT ); Fri, 7 Jun 2019 12:33:30 -0400 Received: by mail-pg1-f195.google.com with SMTP id s27so1443341pgl.2 for ; Fri, 07 Jun 2019 09:33:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=HcwcSPgb2LRTSBlVp16wxUn4yLqFThmUCJS2tDHezDY=; b=K4+DIabMx2B0RYXq11ezNJY3ksw/Zlt0hzGvAQ6CAb+Xe0pXe2ndfFb2bHtAsimfM1 Pefzo+lf0yQYkVXOTQLJ6bEER05wokc/a/J54QWVp5u+SpfZwl7XOx+k3OhiPuzZ1R88 dGaV6rKUNqmttDGW0TqtyWZE0DUYjIp1QV+uT6/WM1vKg0BZVEHxXUB7AAS/pcL8v9M+ CSR/+K+kjMlq0fUeSAcBOEqPIMcf1l+1wshU3tSN7Mm8jac+f9gM8VvZenUHAIMWQedB sf6sdkJ64RsgfuDLIsupC4fL/Dzd84javsv4mjtJDYbdbUUeylWg3YU5bNDqbJLRw0nZ H3Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=HcwcSPgb2LRTSBlVp16wxUn4yLqFThmUCJS2tDHezDY=; b=fGF8z7iGVL2ZqLuekd7om4uW7av5Z068M1w+ZKm35sEYU9VTiUyzyMuQxDtVy7qEXn sTl/vdF22HEO1utO2ZGKLBATIG5Ts08GAnQ90h5TFPibhJCNIVa04V9G7R+VWiw3jxoN zOw8rFQIQprv9vv2Oy3O9Oia/ig8uBnnwD4lTLQghMR8usTc2es+2H35pAVIhvu8qBbJ 3/7Ra7eKo5dLf8oJuGDRJXgS1NKRqkqb5G39+O6elTwsFdaReghqYJ0FwnY/Po2OhWE1 ublehF42cfg9m6UaNbA3JPPqZHHyXEPqEP6JQQ1zC91FTBdwyi7q+8XUokfHRyzBP8Wk Ey2A== X-Gm-Message-State: APjAAAX9Nv90/R+jqiXniPmT887jcyusjWDqHonXTHZKp0flyQxSKhMC E7dmqUTcLl31ZmPGm9rAgIGxOQ== X-Received: by 2002:a63:fb05:: with SMTP id o5mr3727724pgh.203.1559925209855; Fri, 07 Jun 2019 09:33:29 -0700 (PDT) Received: from ?IPv6:2600:1012:b044:6f30:60ea:7662:8055:2cca? ([2600:1012:b044:6f30:60ea:7662:8055:2cca]) by smtp.gmail.com with ESMTPSA id b35sm2616154pjc.15.2019.06.07.09.33.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Jun 2019 09:33:28 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: [PATCH 10/15] static_call: Add basic static call infrastructure From: Andy Lutomirski X-Mailer: iPhone Mail (16F203) In-Reply-To: Date: Fri, 7 Jun 2019 09:33:27 -0700 Cc: Peter Zijlstra , Nadav Amit , the arch/x86 maintainers , LKML , Andy Lutomirski , Steven Rostedt , Ingo Molnar , Thomas Gleixner , Linus Torvalds , Masami Hiramatsu , Jason Baron , Jiri Kosina , David Laight , Borislav Petkov , Julia Cartwright , Jessica Yu , "H. Peter Anvin" , Rasmus Villemoes , Edward Cree , Daniel Bristot de Oliveira , Josh Poimboeuf Content-Transfer-Encoding: quoted-printable Message-Id: <4D3C14BB-6830-46E1-A9E2-D8EBD7E3A2FA@amacapital.net> References: <20190605130753.327195108@infradead.org> <20190605131945.125037517@infradead.org> <20190607082851.GV3419@hirez.programming.kicks-ass.net> To: Ard Biesheuvel Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Jun 7, 2019, at 1:49 AM, Ard Biesheuvel wro= te: >=20 >> On Fri, 7 Jun 2019 at 10:29, Peter Zijlstra wrote:= >>=20 >> On Thu, Jun 06, 2019 at 10:44:23PM +0000, Nadav Amit wrote: >>>> + * Usage example: >>>> + * >>>> + * # Start with the following functions (with identical prototypes):= >>>> + * int func_a(int arg1, int arg2); >>>> + * int func_b(int arg1, int arg2); >>>> + * >>>> + * # Define a 'my_key' reference, associated with func_a() by defaul= t >>>> + * DEFINE_STATIC_CALL(my_key, func_a); >>>> + * >>>> + * # Call func_a() >>>> + * static_call(my_key, arg1, arg2); >>>> + * >>>> + * # Update 'my_key' to point to func_b() >>>> + * static_call_update(my_key, func_b); >>>> + * >>>> + * # Call func_b() >>>> + * static_call(my_key, arg1, arg2); >>>=20 >>> I think that this calling interface is not very intuitive. >>=20 >> Yeah, it is somewhat unfortunate.. >>=20 >=20 > Another thing I brought up at the time is that it would be useful to > have the ability to 'reset' a static call to its default target. E.g., > for crypto modules that implement an accelerated version of a library > interface, removing the module should revert those call sites back to > the original target, without putting a disproportionate burden on the > module itself to implement the logic to support this. I was thinking this could be a layer on top. We could have a way to registe= r a static call with the module core so that, when a GPL module with an appr= opriate symbol is loaded, the static call gets replaced. KVM could use this too. Or we could just require KVM to be built in some da= y.