Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp5051771ybb; Tue, 24 Mar 2020 10:04:31 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvVYHqxLXpZpAPyvLU391sQA+TKnY8SqCXondyYA9S/3a/3evHePb4/OcP6f4qA/Whzo0to X-Received: by 2002:a05:6830:16cc:: with SMTP id l12mr22039110otr.234.1585069470920; Tue, 24 Mar 2020 10:04:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585069470; cv=none; d=google.com; s=arc-20160816; b=ERCm71KrtSNXJ0n8Dze7oPY6OR7V8PnAUE7LnqddpA9rauKSY0OZPdpG9gaoqo6h75 8jb19K3q7jVVbsHxZeOpvx11HtkPxP5KdoSGmf0z91i6Oh3dEN0F5O2ZbApA+jQi+35d tCQ1eKZ1ePtvLF3Jcyrwakfmai4UdoIlSTHd9HhsVaAIcHAYchQCeHbXmXT6zNidNv3Q P7rzHoyOSYtW0ig20+Z54u4u5Lg8EvbPwX9KUeK1hmwjbZcnHGlTjeXrsOu3h24k6pqc QUfdvYrZHfrw+Dz4pHFgPj51dRSPiqzaDRvFjKRFIEsre/SZQD21XjHGJIKap6bTGu7F F4Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ybvI/xXoN4Xj7bvZ9uQSzuDEPSFb7l3L7fcwrqWVV2g=; b=BAkOJAne6/mFJgZjUhXrlrtGpjqEdBLkMgExxDhF1JZXGgYhar9cZfAvDRVdts3ZI8 ERGVBA/k4HA3K1DWgftcIAhpVindrsHGAfh8TMwwDwdygy5ESKykRHarNm0sC3OCjW/O 6VIXt2wHqMj7HVBndm2cLJ3rOamuHVBoGM/4iGy5gPn9Vj1xJ5O6HfPktN2AonqOksVf 9JfH3sOavtHxQZB0fnhWXW+5k9pTdXkq7uMy/jZMs7oMa46GAGRx8+A0k64oVZxJ37EM tEFycoZzGqeVe/zYP1F/DYAzKU0bSe5bpvaVAfbXH7APmfiwm/M1j5n5yJcjAWA5yke1 3fhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=lgSLFqsR; 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 t24si2414838otr.295.2020.03.24.10.04.13; Tue, 24 Mar 2020 10:04:30 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=lgSLFqsR; 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 S1727324AbgCXRDV (ORCPT + 99 others); Tue, 24 Mar 2020 13:03:21 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:44590 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726962AbgCXRDU (ORCPT ); Tue, 24 Mar 2020 13:03:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=ybvI/xXoN4Xj7bvZ9uQSzuDEPSFb7l3L7fcwrqWVV2g=; b=lgSLFqsRWZVdBbzsaO30TNcs/0 UZaYmu7cYUUgMBX6fqCyPCfHUFjFBpwoWBS7RNR0j9FBvytqWxnUYgtxVWVbtPBC/IfGEb2DwEUo/ D4snUAWzPj98lTz7GCKDPE1mUy5PYOtvnUBB0z2I4Eqv1nqS/ttE46sfjJgkXk47IauxQab04ZfVd duAY2hIKcDvtCbs3+AGz+z0vfofJnnTnGYCLcxzwVECMF5N4djGFY0WzyPlSOkzwu+83vhQxrlfI5 6bjjqDAv0DprUIn8s6aCeV6N2VEzEqO99nV2jIAIr24qqy+HM4IhftA5rR+B7cU6s3wZDcVxIfs16 mhm4x9yA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jGmxJ-0004Ig-4d; Tue, 24 Mar 2020 17:03:10 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 918FC300096; Tue, 24 Mar 2020 18:03:06 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 714E120413B7D; Tue, 24 Mar 2020 18:03:06 +0100 (CET) Date: Tue, 24 Mar 2020 18:03:06 +0100 From: Peter Zijlstra To: Linus Torvalds Cc: Andy Lutomirski , the arch/x86 maintainers , Linux Kernel Mailing List , Steven Rostedt , Masami Hiramatsu , Daniel Bristot de Oliveira , Jason Baron , Thomas Gleixner , Ingo Molnar , Nadav Amit , Peter Anvin , Andrew Lutomirski , Ard Biesheuvel , Josh Poimboeuf Subject: Re: [RESEND][PATCH v3 14/17] static_call: Add static_cond_call() Message-ID: <20200324170306.GU20696@hirez.programming.kicks-ass.net> References: <86D80EA7-9087-4042-8119-12DD5FCEAA87@amacapital.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 24, 2020 at 09:33:21AM -0700, Linus Torvalds wrote: > On Tue, Mar 24, 2020 at 9:22 AM Andy Lutomirski wrote: > > > > I haven’t checked if static calls currently support return values, but > > the conditional case only makes sense for functions that return void. > > > > Aside from that, it might be nice for passing NULL in to warn or bug > > when the NULL pointer is stored instead of silently NOPping out the > > call in cases where having a real implementation isn’t optional. > > Both good points. I take back my question. > > And it aside from warning about passing in NULL then it doesn't work, > I wonder if we could warn - at build time - when then using the COND > version with a function that doesn't return void? I actually (abuse) do that in the last patch... the reason being that DEFINE_STATIC_COND_CALL() ends up only needing a type expression for the second argument, while DEFINE_STATIC_CALL() needs an actual function. > Of course, one alternative is to just say "instead of using NOP, use > 'xorl %eax,%eax'", and then we'd have the rule that a NULL conditional > function returns zero (or NULL). > > I _think_ a "xorl %eax,%eax ; retq" is just three bytes and would fit > in the tailcall slot too. Correct. The only problem is that our text patching machinery can't replace multiple instructions :/