Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1191465imu; Tue, 11 Dec 2018 14:29:42 -0800 (PST) X-Google-Smtp-Source: AFSGD/XBOCzD3cihHCTwdWKUhKTcfxJvN0UtuHkZTF2l9bn+y80occOcdRqktZW9Czy2Wzy9ecLR X-Received: by 2002:a17:902:2006:: with SMTP id n6mr18020153pla.66.1544567382527; Tue, 11 Dec 2018 14:29:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544567382; cv=none; d=google.com; s=arc-20160816; b=NBDTQaCgpxqI5yQMEWxzFwu3q7v1hIkLQcngQzTbfiIO7aNNyU8NJ0v4RbPnEcuFw4 /ItaHUj/eVOx63NrXN5uXj3KaBqvFvnyGTkWZ/XGZoI3aeGjbaoAEkcLxxNX0K47T3Su wQWFkBUlAvCCb0CF1q4j0JtOJizD/TdWhUjEP+PmmDUUM3VwFR2KsF51b7e9JPD6/oQ1 azr8kC38ZCTx2fgtBEZ4kaHRsHW7z1JUH3/c/HcLBWx17rZJIjWedtTXOB6dGu2xyGIQ swIbyFvRC6Zgd0lfQ34Ofy0YG3yeRG6bmVM6jygHUd44ZFe54A7/pPgstJcRpsn4viMh B9Bg== 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:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=cB3bzkhdAtMXrFkK6H0+CAhPxom6ju4RPEh07Hvwdjo=; b=Z65TVU5WYLb1QvyeXBYcUGFuRykVHNeH/PEvcUkdwskVODYGujinzi/ssJWddF+TtE e7HhpCRB+WzoOAoU7aw7i2n6BEa8WpznglyS8afoEOiYRhQEHVS5BVrdygIF+lL7IdNE e8O7qTR5KKCkhChM1L1+UoKyf7Wb9aULS+NY8yIb976ObcOPbrxVVMXER+Po+yUjiYrU 8YiAhmkMZs4s9n3yZ1mPRWEmGTYqnc0E3isxHIVPdTzY1MOZXhI/PeTVAP/GXvYxBiXe 2Ddr1pIslcd0QQ8SlX1P2IVUjhJjs+k1thDSCPrTLFOm6xBOxne8CtRF6ajikNcP2t0r osIg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v34si13333815plg.205.2018.12.11.14.29.27; Tue, 11 Dec 2018 14:29:42 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726251AbeLKW2g (ORCPT + 99 others); Tue, 11 Dec 2018 17:28:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60462 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726158AbeLKW2g (ORCPT ); Tue, 11 Dec 2018 17:28:36 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ED8353082139; Tue, 11 Dec 2018 22:28:35 +0000 (UTC) Received: from ovpn-116-73.ams2.redhat.com (ovpn-116-73.ams2.redhat.com [10.36.116.73]) by smtp.corp.redhat.com (Postfix) with ESMTP id 29B675D736; Tue, 11 Dec 2018 22:28:33 +0000 (UTC) Message-ID: <0ffb8bc11613ea082179142f7c90830d4e419491.camel@redhat.com> Subject: Re: [PATCH net-next v2 1/4] indirect call wrappers: helpers to speed-up indirect calls of builtin From: Paolo Abeni To: David Woodhouse , netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Paul Turner , linux-kernel@vger.kernel.org Date: Tue, 11 Dec 2018 23:28:32 +0100 In-Reply-To: <2c80b9d34540dad337ed2fce6f9d16233105a2c2.camel@infradead.org> References: <07aaed31eb0b515c173138e1358c412157e58ec2.1544032300.git.pabeni@redhat.com> <2c80b9d34540dad337ed2fce6f9d16233105a2c2.camel@infradead.org> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.2 (3.30.2-2.fc29) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 11 Dec 2018 22:28:36 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, I'm sorry for the long delay, I was (and still I am) diverted by some other duty. On Fri, 2018-12-07 at 21:46 +0000, David Woodhouse wrote: > On Fri, 2018-12-07 at 21:46 +0100, Paolo Abeni wrote: > > > I wonder if we can declare the common case functions as 'weak' so that > > > the link failures don't happen when they're absent. > > > > I experimented a previous version with alias. I avoided weak alias > > usage, because I [mis?]understood not all compilers have a complete > > support for them (e.g. clang). > > Also, with weak ref, a coding error that is now discovered at build > > time will result in worse performance at runtime, likely with some > > uncommon configuration, possibly not as easily detected. I'm unsure > > that would be better ?!? > > I think everything supports weak linkage; we've been using it for > years. Ok, I likely was confused by some old, non first-hand info. Anyway weak alias will turn a compile time issue in a possible run-time (small) regression. I think the first option would be preferable. > > I'm sorry, I don't follow here. I think static keys can't be used for > > the reported network case: we have different list elements each > > contaning a different function pointer and we access/use > > different ptr on a per packet basis. > > Yes, the alternatives would be used to change the "likely" case. > > We still do the "if (fn == default_fn) default_fn(); else (*fn)();" > part; or even the variant with two (or more) common cases. > > It's just that the value of 'default_fn' can be changed at runtime > (with patching like alternatives/static keys, since of course it has to > be a direct call). Thanks for clarifying. If I understood correctly, you would like some helper for: if (static_branch_likely(&use_default_fn_a)) INDIRECT_CALL_1(f, default_fn_a, ) else if (static_branch_likely(&use_default_fn_b)) INDIRECT_CALL_1(f, default_fn_b, ) // ... if so, I think we can eventually add support for this kind of stuff on top of the proposed macros. WDYT? Thanks, Paolo