Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp6589161rwp; Tue, 18 Jul 2023 02:53:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlEk+bA9n/YHcE8EEnkpNYWPyDLLpoEv/QzCOvS6AP1AoyRUDVeOWnIj9I2hcxSIGDNwb3XZ X-Received: by 2002:a05:6a00:3906:b0:66a:5e6f:8b21 with SMTP id fh6-20020a056a00390600b0066a5e6f8b21mr15168058pfb.2.1689673982602; Tue, 18 Jul 2023 02:53:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689673982; cv=none; d=google.com; s=arc-20160816; b=rURvz9GSMwkjvUgf8sZc9jr5mIeVkX/SfbuNBCxtFUGJ/ngx/M7cE6y/kevVVfKAU2 xBKERUu5aaqSI0WSSGgLC4yapsCdaATmg9wkwjDpFO2zL38pI9B8w5Ij6vV9MwnPlwVf ok1HwMN0aD73su0jsDlDJSwu09E6kcp8pwE+pN+By/bRt80giVE92vgA3g0DYmQqDR/3 yA0Vo5dOPQcGIEAFiXgV7kDbhR5xSQ3kfiaT9Q51XJU5zk8twPiKKtbwBBQmSI+muj11 kaogUeKc2Ed0HbEIvQrrZE0ECJH27YiHsZU2HTX7DoMucQJBIEYFXIEU18ZaHyel3FW6 0oEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=vP4BnR5+UAXwr8ccPiRkOnhSD7l2j2ds39isA271TN8=; fh=tNqwZpNFltd8gXxkuJdejAqAf8HRrTF3PSpI8ulQx8k=; b=ScJJsr6M4r5tp7nEkmVlrWm7hWZgXXNBZn7om94zrbqbp5h1Pjlk7aBv3TfQTwuqMc myZ97EENCu+UYiMoBenk9toJSfJkBbywLdH20lH80MS99CUC+foYzlOZQcqK8dASCUi7 gI9m0zkrHRYLOOO0byIIQ7aGg7tRgw29IoFUN41KR+4yNfROU9QzF9HcozBJbMIk3rkL EjqADT9Plj9OcUOFwWQVaP3+fE9092OtO6l+WjYpxz46JCkSIlZ+fZq5ZYjqSflLVKoT iuHthayq4s0PvpIufyGLPwn3Zjk6fRjNJ6MO5cPTiahz/b/QzSSuwcRB1AXUZKBqUdN5 j0pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="s/KfSexu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k70-20020a638449000000b0055b4c11043asi1273742pgd.875.2023.07.18.02.52.26; Tue, 18 Jul 2023 02:53:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="s/KfSexu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231506AbjGRJVD (ORCPT + 99 others); Tue, 18 Jul 2023 05:21:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232274AbjGRJUi (ORCPT ); Tue, 18 Jul 2023 05:20:38 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9F3E1BD9 for ; Tue, 18 Jul 2023 02:20:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=vP4BnR5+UAXwr8ccPiRkOnhSD7l2j2ds39isA271TN8=; b=s/KfSexuRTjWdBD071KgTlnt8E 3od+BhOLl2HE+XHESj4QHkiLYUJOShnKqQldO6LG2OqADpQYoZDCUyA9nsZJGEo2psw3nCBhd0IcI C79MNBOhH7oN2vL2D60mxP2ZDqWKESAyFRE+HTTQ+nkN6ggS9YmYlnlk8kh4f6gG5RYTR9BYF/WdN O299Gpy3IEGN5jLWh4GFAuISWqBkSvtwUKZ6H4c0/dznvAsVpd9zbTMqSVhJrszHobBOZk2GPaCRb KBVxMDa29zh055CDmU4yfcrHOE3c+PqpcwOSQuxeq/XdE02V87uZNPmj1+Zec5q+8XjZU+qJq50Cg BU+asd6w==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1qLgs6-004m2E-6x; Tue, 18 Jul 2023 09:19:54 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id B2C0530012F; Tue, 18 Jul 2023 11:19:50 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 99AEB213727BB; Tue, 18 Jul 2023 11:19:50 +0200 (CEST) Date: Tue, 18 Jul 2023 11:19:50 +0200 From: Peter Zijlstra To: Thomas Gleixner Cc: LKML , x86@kernel.org, Linus Torvalds , Andrew Cooper , Tom Lendacky , Paolo Bonzini , Wei Liu , Arjan van de Ven , Juergen Gross Subject: Re: [patch 57/58] x86/apic: Provide static call infrastructure for APIC callbacks Message-ID: <20230718091950.GA3472843@hirez.programming.kicks-ass.net> References: <20230717223049.327865981@linutronix.de> <20230717223226.476875329@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230717223226.476875329@linutronix.de> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 18, 2023 at 01:16:03AM +0200, Thomas Gleixner wrote: > Declare and define the static calls for the hotpath APIC callbacks. Note > this deliberately uses STATIC_CALL_NULL() because otherwise it would be > required to have the definitions in the 32bit and the 64bit default APIC > implementations and it's hard to keep the calls in sync. The other option > would be to have stub functions for each callback type. Not pretty either > > So the NULL capable calls are used and filled in during early boot after > the static key infrastructure has been initialized. The calls will be > static_call() except for the wait_irc_idle() callback which is valid to be > NULL for X2APIC systems. > > Update the calls when a new APIC driver is installed and when a callback > override is invoked. > > Export the trampolines for the two calls which are used in KVM and MCE > error inject modules. > > Test the setup and let the next step convert the inline wrappers to make it > effective. Perhaps preserve some of that in a comment? > --- a/arch/x86/kernel/apic/init.c > +++ b/arch/x86/kernel/apic/init.c > @@ -5,6 +5,28 @@ > > #include "local.h" > /* * Uses DEFINE_STATIC_CALL_NULL() to avoid having to provide a (stub) * function at this time. * * All except wait_icr_idle *MUST* be set before usage. */ > +#define DEFINE_APIC_CALL(__cb) \ > + DEFINE_STATIC_CALL_NULL(apic_call_##__cb, *apic->__cb) > + > +DEFINE_APIC_CALL(eoi); > +DEFINE_APIC_CALL(native_eoi); > +DEFINE_APIC_CALL(icr_read); > +DEFINE_APIC_CALL(icr_write); > +DEFINE_APIC_CALL(read); > +DEFINE_APIC_CALL(send_IPI); > +DEFINE_APIC_CALL(send_IPI_mask); > +DEFINE_APIC_CALL(send_IPI_mask_allbutself); > +DEFINE_APIC_CALL(send_IPI_allbutself); > +DEFINE_APIC_CALL(send_IPI_all); > +DEFINE_APIC_CALL(send_IPI_self); > +DEFINE_APIC_CALL(wait_icr_idle); > +DEFINE_APIC_CALL(wakeup_secondary_cpu); > +DEFINE_APIC_CALL(wakeup_secondary_cpu_64); > +DEFINE_APIC_CALL(write); > + > +EXPORT_STATIC_CALL_TRAMP_GPL(apic_call_send_IPI_mask); > +EXPORT_STATIC_CALL_TRAMP_GPL(apic_call_send_IPI_self);