Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp7367342imm; Thu, 28 Jun 2018 02:32:14 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ6+SQuBoT4wBp7zVflHODgvu1KkV2eVGchvUcnbXGUPbI3fX9Fvsoha0tmOOXOCFtlFv54 X-Received: by 2002:a17:902:bf43:: with SMTP id u3-v6mr9717195pls.322.1530178334360; Thu, 28 Jun 2018 02:32:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530178334; cv=none; d=google.com; s=arc-20160816; b=p8edUgU3XWKYVOUHQZE3DY7TOx0jOhyPk8OSrceRTcdv63EzNvOZQlaH/f9UCz0TPP WaNlEn7HykynmvW7vPFD7+DW9Srlm0Z9EgqpTOyPOjywQDW1S5KttWTW2TBuWxnhxdCn OqsA7t/ntH8yNMVb/ujCnASmpArnLb3wcVZAbzywsYhsAxqkSKMAc4/hK3sJF2kFCCv4 GolYHQF2cXwzPzFInRtbEbXcMA3E+Dt4u+b2aov/+sf/PnaBp1aKP1g0pUPKZpsW7Typ 96YXinwcKb53sgyKJUEJ6hiZWRnaWcIExyW++TM56TJd2N5GOqQuwmJB1OlT18PSONc4 rpyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=NH94xwzrezkfWmL9k+/At6t18Sqs0bQxFsELdUFZX3o=; b=uP1P6IbsuG0/uUQtIYabKDC5r086KESYGQfyp7cKjVfoyEKIGoDiug+QGsnasVsoPv 1JKOry3ZorVa/INTQ8+H7pI+VRBUGTsr8SAAvpDtlYe8fxiNlVpYyW1WOeYiaaW8Ljrl 4RpUBvzecvb3I6Z4GkjFtZyEGvJyCE/NImIre7Rn2gDRLsz2A6b81M+60blss8+CWrZ7 DYkd/4OlAOanh83D5+u2I/xlXiWn8XjAKkqmZxrhTTyw0lkQJuwudDWNIRo0gY+8qbcQ Z+M3n8KJqPHUEBhrWq3BnDea4hk72C1woNNajBavzidiv4TjGlIpABeXYEVIW/8Lvx9X AJvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TR1O7p1w; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 4-v6si6144343plc.436.2018.06.28.02.31.57; Thu, 28 Jun 2018 02:32:14 -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=@linaro.org header.s=google header.b=TR1O7p1w; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935170AbeF1J3n (ORCPT + 99 others); Thu, 28 Jun 2018 05:29:43 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:40763 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933194AbeF1J3l (ORCPT ); Thu, 28 Jun 2018 05:29:41 -0400 Received: by mail-it0-f67.google.com with SMTP id 188-v6so11515374ita.5 for ; Thu, 28 Jun 2018 02:29:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=NH94xwzrezkfWmL9k+/At6t18Sqs0bQxFsELdUFZX3o=; b=TR1O7p1wqsFVhmxDOdFvYrGzjSIGGSLL+Vo1jpZGzt7OimN8J6zu/QnzrmEy4ODGG1 OFGuxJoxJFypJyIETXDdWVn6AGkvZ5EKOuYaBkuaoYUTafV798Bi7Xe9RIvplFEQ3Sfj E21Fd2IOdsjoew28d41mwdw9y0d4ILDlWcHLU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=NH94xwzrezkfWmL9k+/At6t18Sqs0bQxFsELdUFZX3o=; b=p5jtuRRYO34nlw2Dn6oOZp9LVkMsZKitfSnVYv0lCq+bmjfKgUtdaA6Un8GP6b4DJH VtqutFS1ddx+o7uHjI2R5XqOVvL77xO8sH7OVysnt1GZnuyCr7ySfRgPMtXFX2eBD4xo c5M96Vz+MQzcg1iP4QOmmz4JSIVNzC84qAR3IIS4TWNm4/ZBKP9nElljgSkieKDVgbTS vHeyng9JDuV7+rKIHnCZtmRpjQjfHErseesb056rKVq+VMN/EP2M4UyB0gAVzSf5s5yd jYzoyajm6popPbAfrV/NQr6H0kCChEnoQzmFuJWlSvOGKYj7Hc4W8QAEXZ4UjQJ2C9v9 TjYg== X-Gm-Message-State: APt69E0IaLCg+x6LUxnzfk3kDdKywczviy7aZwW1c3JGnjfctKynf/3F I6jnJQ1iU6tcycq8+bi3otpzxO7zIx46kT9zBABLmw== X-Received: by 2002:a24:6196:: with SMTP id s144-v6mr7792751itc.68.1530178181051; Thu, 28 Jun 2018 02:29:41 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:bbc7:0:0:0:0:0 with HTTP; Thu, 28 Jun 2018 02:29:40 -0700 (PDT) In-Reply-To: <20180628092504.GC2494@hirez.programming.kicks-ass.net> References: <20180627160604.8154-1-ard.biesheuvel@linaro.org> <20180627160604.8154-3-ard.biesheuvel@linaro.org> <20180628085003.GA2494@hirez.programming.kicks-ass.net> <20180628092504.GC2494@hirez.programming.kicks-ass.net> From: Ard Biesheuvel Date: Thu, 28 Jun 2018 11:29:40 +0200 Message-ID: Subject: Re: [PATCH 2/5] kernel/jump_label: implement generic support for relative references To: Peter Zijlstra Cc: Linux Kernel Mailing List , linux-arm-kernel , "the arch/x86 maintainers" , Catalin Marinas , Will Deacon , Thomas Gleixner , Ingo Molnar , Arnd Bergmann , Steven Rostedt Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28 June 2018 at 11:25, Peter Zijlstra wrote: > On Thu, Jun 28, 2018 at 11:04:45AM +0200, Ard Biesheuvel wrote: >> On 28 June 2018 at 11:02, Ard Biesheuvel wrote: >> >>> @@ -56,7 +72,9 @@ jump_label_sort_entries(struct jump_entry *start, struct jump_entry *stop) >> >>> >> >>> size = (((unsigned long)stop - (unsigned long)start) >> >>> / sizeof(struct jump_entry)); >> >>> - sort(start, size, sizeof(struct jump_entry), jump_label_cmp, NULL); >> >>> + sort(start, size, sizeof(struct jump_entry), jump_label_cmp, >> >>> + IS_ENABLED(CONFIG_HAVE_ARCH_JUMP_LABEL_RELATIVE) ? jump_label_swap >> >>> + : NULL); >> >>> } >> >> >> >> That will result in jump_label_swap being an unused symbol for some >> >> compile options. >> > >> > No, and isn't that the point of IS_ENABLED()? The compiler sees a >> > reference to jump_label_swap(), so it won't complain about it being >> > unused. > > Ah, ok. I hadn't figured it was quite that smart about it. > Yeah. I could use a temp variable to make the indentation less obnoxious, but since this is an opt-in feature, I'd like to preserve the NULL (*swap)() argument for the existing users. >> > Meh. I thought IS_ENABLED() was preferred over #ifdef, no? > > Dunno, I just reacted to the proposed code's uglyness :-) > I will try to come up with something that rhymes, ok? :-) >> ... and it means the sort() routine will unconditionally perform an >> indirect function call even if the arch does not require it. > > Yeah, not sure I care about that here, this is a one time affair, very > far away from any fast paths. > Fair enough.