Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5325711rwd; Mon, 5 Jun 2023 01:45:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Tg0lS0sD+A8/AU1Ji+0AABCu/wcOCijZlAJmkMOaoP/zAXKZ3hCOXviXHtEHpya1X9BSW X-Received: by 2002:a05:622a:18f:b0:3ef:3960:a1b4 with SMTP id s15-20020a05622a018f00b003ef3960a1b4mr6398683qtw.10.1685954749122; Mon, 05 Jun 2023 01:45:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685954749; cv=none; d=google.com; s=arc-20160816; b=BhkhrbP+jbg7DkAfp3zepsf/OSNs7w3UysmWqKlN3PcBNRcEk+9OsWZdhSNMe+nQnv Yzn9nO213KF2ugQJU1+E2td5wGJldb+je54vmH7e9vG7bPgWtsv6RNunAhaeh/6YVQUx suOmKnhPHk4c3lMI+CZIyU3KAJCt/5L4ajCWejitMZRJ+qLB4fbW52STYsV2bcoCAktx vGi8UykdNNnelP4vFTHx0cW4ldB+SncPw3brG2Qaxh/hxdu1sQa3hLXjZlDwov+omp8D nUHy2jd1nE9MzWEip/5gDmDIaaqrvuFFVMBvt05z4D1RiLheoGdfjX4L3hVsuECGM/Mi AcZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=E8n9ePnUhtnsNw0/UoOy8KZA0t9F5cn2eYE4giKiTxQ=; b=fTKJVXiMBJMyb8Ib+8CW0KGDZiuEC9xqhH1NL0GOhAVMA+6hI0SfNwh/A36xNy1gwb DFx9e4reYpoVkYJRFsZ+9RHh2LdIR+lo8sPh+mDkJ0Jg3CjEeVzWrUzY4HIorzKOMy3X yUEtNAdu9Z2rc+rxN0voC/znVjEEMtMDLaEcyFfAsENEtmKTPkdA5rZyoVeEEd5HQ0Mq oH7Zt2XR/JHVfJLCKBqNx5hvdaaj151G0j+jGjc85R+VQOCCL4VCQp16LWCMcLpu4J1s sxC1sWeAgML9/rroo9Y5gD10sD/yvYrLrI837EpVXbfbOidk5UWJ5xVcQxz7BRj4nkK9 UC+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ZYLMwKJo; dkim=neutral (no key) header.i=@linutronix.de; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bv3-20020a632e03000000b0052883ac6949si5342738pgb.13.2023.06.05.01.45.34; Mon, 05 Jun 2023 01:45:49 -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=@linutronix.de header.s=2020 header.b=ZYLMwKJo; dkim=neutral (no key) header.i=@linutronix.de; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230121AbjFEIfE (ORCPT + 99 others); Mon, 5 Jun 2023 04:35:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230045AbjFEIfB (ORCPT ); Mon, 5 Jun 2023 04:35:01 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E971B0; Mon, 5 Jun 2023 01:35:00 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1685954098; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=E8n9ePnUhtnsNw0/UoOy8KZA0t9F5cn2eYE4giKiTxQ=; b=ZYLMwKJonIHpbWbqUCUtNKvKVLq4FP6ro5oS/wilSBp/vqjxGVCpcgLTYoa1RhxoCJnFPm vxMEYmJhPorHuS/9bsQLXG+h+xrcxlXgJyrHYl6wjLVRyW+sa3UAQQx0x72Sc+aD3QOWNu M6M5n333FFxZ1oXfESc8AZVrsULI2XFJYINjt4WCX5IWUTSD38VRTKmhb+gli3XIyDA+Rf CvoTPDZENltfWrOlu4xOG/89O1D8oVnVJInPiWcvq2sAtPQ43RN8P0CuyCtyk6ov3d3/We mpRDy+TJxK/mtJdBJeX290BhCCGYQAjXPAXwKzUQ0JddPcVTqWrxdrM1fTeEzA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1685954098; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=E8n9ePnUhtnsNw0/UoOy8KZA0t9F5cn2eYE4giKiTxQ=; b=54x6bmSB+5xXMohPCz/svOxKGcZmUS+Ga0otaExKp5Egqb7huWQ3gf7RNn8sDHvn6xoUpl xXid46SPiohH4BCQ== To: Xin Li , linux-kernel@vger.kernel.org, x86@kernel.org, kvm@vger.kernel.org Cc: mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, peterz@infradead.org, andrew.cooper3@citrix.com, seanjc@google.com, pbonzini@redhat.com, ravi.v.shankar@intel.com, jiangshanlai@gmail.com, shan.kang@intel.com Subject: Re: [PATCH v8 03/33] x86/traps: add a system interrupt table for system interrupt dispatch In-Reply-To: <20230410081438.1750-4-xin3.li@intel.com> References: <20230410081438.1750-1-xin3.li@intel.com> <20230410081438.1750-4-xin3.li@intel.com> Date: Mon, 05 Jun 2023 10:34:58 +0200 Message-ID: <877csi8fyl.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Mon, Apr 10 2023 at 01:14, Xin Li wrote: > > /** > * DECLARE_IDTENTRY_IRQ - Declare functions for device interrupt IDT entry > - * points (common/spurious) > + * points (common/spurious) and their corresponding > + * software based dispatch handlers in the non-noinstr > + * text section > * @vector: Vector number (ignored for C) > * @func: Function name of the entry point > * > - * Maps to DECLARE_IDTENTRY_ERRORCODE() > + * Maps to DECLARE_IDTENTRY_ERRORCODE(), plus a dispatch function prototype > */ > #define DECLARE_IDTENTRY_IRQ(vector, func) \ > - DECLARE_IDTENTRY_ERRORCODE(vector, func) > + DECLARE_IDTENTRY_ERRORCODE(vector, func); \ > + void dispatch_##func(struct pt_regs *regs, unsigned long > error_code) Can these IDTENTRY changes please be separate from the actual table implementation? > > +#ifdef CONFIG_X86_64 > + > +#ifndef CONFIG_X86_LOCAL_APIC Seriously? You _cannot_ disable local APIC on x8664 builds. > +/* > + * Used when local APIC is not configured to build into the kernel, but > + * dispatch_table_spurious_interrupt() needs > dispatch_spurious_interrupt(). What? If you there is something which is not used in a certain configuration then just exclude it via #ifdef in the table or provide a #define foo NULL if you want to spare the #ifdeffery. > + */ > +DEFINE_IDTENTRY_IRQ(spurious_interrupt) > +{ > + pr_info("Spurious interrupt (vector 0x%x) on CPU#%d, should never happen.\n", > + vector, smp_processor_id()); > +} But mindlessly copying code which is even never compiled is a pretty pointless exercise. > +#endif > + > +static void dispatch_table_spurious_interrupt(struct pt_regs *regs) > +{ > + dispatch_spurious_interrupt(regs, regs->vector); > +} > + > +#define SYSV(x,y) [(x) - FIRST_SYSTEM_VECTOR] = y > + > +static system_interrupt_handler system_interrupt_handlers[NR_SYSTEM_VECTORS] = { > + [0 ... NR_SYSTEM_VECTORS-1] = dispatch_table_spurious_interrupt, > +#ifdef CONFIG_SMP > + SYSV(RESCHEDULE_VECTOR, dispatch_table_sysvec_reschedule_ipi), > + SYSV(CALL_FUNCTION_VECTOR, dispatch_table_sysvec_call_function), > + SYSV(CALL_FUNCTION_SINGLE_VECTOR, dispatch_table_sysvec_call_function_single), > + SYSV(REBOOT_VECTOR, dispatch_table_sysvec_reboot), > +#endif > + > +#ifdef CONFIG_X86_THERMAL_VECTOR > + SYSV(THERMAL_APIC_VECTOR, dispatch_table_sysvec_thermal), > +#endif > + > +#ifdef CONFIG_X86_MCE_THRESHOLD > + SYSV(THRESHOLD_APIC_VECTOR, dispatch_table_sysvec_threshold), > +#endif > + > +#ifdef CONFIG_X86_MCE_AMD > + SYSV(DEFERRED_ERROR_VECTOR, dispatch_table_sysvec_deferred_error), > +#endif > + > +#ifdef CONFIG_X86_LOCAL_APIC > + SYSV(LOCAL_TIMER_VECTOR, dispatch_table_sysvec_apic_timer_interrupt), > + SYSV(X86_PLATFORM_IPI_VECTOR, dispatch_table_sysvec_x86_platform_ipi), > +# ifdef CONFIG_HAVE_KVM > + SYSV(POSTED_INTR_VECTOR, dispatch_table_sysvec_kvm_posted_intr_ipi), > + SYSV(POSTED_INTR_WAKEUP_VECTOR, dispatch_table_sysvec_kvm_posted_intr_wakeup_ipi), > + SYSV(POSTED_INTR_NESTED_VECTOR, dispatch_table_sysvec_kvm_posted_intr_nested_ipi), > +# endif > +# ifdef CONFIG_IRQ_WORK > + SYSV(IRQ_WORK_VECTOR, dispatch_table_sysvec_irq_work), > +# endif > + SYSV(SPURIOUS_APIC_VECTOR, dispatch_table_sysvec_spurious_apic_interrupt), This is clearly in the #ifdef CONFIG_X86_LOCAL_APIC, so what is the above hackery useful for? > + SYSV(ERROR_APIC_VECTOR, dispatch_table_sysvec_error_interrupt), > +#endif > +}; Thanks, tglx