Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3570765pxj; Tue, 11 May 2021 07:23:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxc4F/R1pZrzGN8SikCFhAmfUfuYz+0LHZpruGSDD6QpK1fCZ7yk+j9QTG1809vzWQiquU0 X-Received: by 2002:a05:6402:644:: with SMTP id u4mr36696754edx.386.1620743026627; Tue, 11 May 2021 07:23:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620743026; cv=none; d=google.com; s=arc-20160816; b=jt+N5LvYBwFPTbsBikHBx9NULUcUxArNFIhAFjM9Kz+r3XrC2U4YO3yrFtMuTQXPnK xU+u3WyEYZFMoHFOt0B69adF3dYor+BRHv11WbcMS1oKQkcxqPS7zqeBms37X9K6vRoF ONCtLQFzzWLtXBk5TQG9+s325JfJbHdk/sNu2rYvsoooMe2KsNZ+1ip7uJ2xd9iU6p+Y cY4jq0qnAj6+zMPFS1pHTGsee+jwVyjgVvS/ruAfRvy1YDt8gDbhJZti1jMJVA9BA9NA HtYhp/iMHeRymtX8TAQQvRUCWKigmjbQN/zSCWmR6LWMsKYE0zBvrB5GrMtIFjNDKWDy 1YGg== 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=TcexFrF5RvItiV32i5dbLwb8XIl5kKRJt7Imzjq/iA4=; b=djuXO8ia76EAuy/BaRxNT4z4Znx6Sj0F7RcRI11daFWHsHYDgPCCK9DglTBZUyZuEm 55AIl0XUY2kwa9FnUaPC2bQx3sRBen+HyvNyQqXOJN571/TL6D4RmoWec7KjBlJZU0bn tjuDHW0zpMg6qnLKp/V+lH7C58U3BvHNpRJ6fF+dF3vjJRodZ4yYPS2GPs00OlPX2YeR wy3NLsUTmJdfB9XeTaqRmWxEk/2PRiBDg+xofici9VoQkNlE8VZdKZ+LyU/60w/Ys9+b 8mbx79Tjrg3df7jyed2mx+KlguPYej04Z/ZQjnOb3pRPwJedVdNlqOJ6njPj259L82j7 rprg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Mv0fcxOM; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hy2si140485ejc.324.2021.05.11.07.23.21; Tue, 11 May 2021 07:23:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Mv0fcxOM; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S231673AbhEKOXc (ORCPT + 99 others); Tue, 11 May 2021 10:23:32 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:44380 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231154AbhEKOXc (ORCPT ); Tue, 11 May 2021 10:23:32 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1620742945; 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=TcexFrF5RvItiV32i5dbLwb8XIl5kKRJt7Imzjq/iA4=; b=Mv0fcxOMmkqOLc+JSkChRmhPdCxbpBcP6SrNZ+qdkJrB4gGt293J3cLJukPYe/QfI88t1k BKWTqSeLbAJJUQyUon7qay4JA/Rr4vg9MgVrTJJZPueO0efw8jKG2kj6YIG44By7b2zlcA 53FSAkIOJst/bf2v/+q1X7SXmVh7J0vBKPvP+2DuRG+HvuaxgaUeTcMS6VPh9ykHOpQpcE tEZ8v4mF9uVDvns8qfFoyP09lL1Xv2vUSNvBxmlrkaRIo8WsnA5Z0WRLYgVV6pbhCmysvr +ZQmA05ngToMkIhRmXjRHEYAURHIfVagu3YxEVn4yg2N0//85xvlrtrA/F0CHA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1620742945; 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=TcexFrF5RvItiV32i5dbLwb8XIl5kKRJt7Imzjq/iA4=; b=WrkAMqEdRyP3brMubbgslHGCO+wGguG3P6QEz8cGWutI49JWDKNwZ5wNvzcul3dcq6o7kH uiH/2AX6KBAOqICQ== To: "H. Peter Anvin" , Ingo Molnar , Borislav Petkov , Andy Lutomirski Cc: Steve Wahl , Mike Travis , Dimitri Sivanich , Russ Anderson , Linux Kernel Mailing List , "H. Peter Anvin \(Intel\)" Subject: Re: [PATCH 4/6] x86/irq: merge common code in DEFINE_IDTENTRY_SYSVEC[_SIMPLE] In-Reply-To: <20210511005531.1065536-5-hpa@zytor.com> References: <20210511005531.1065536-1-hpa@zytor.com> <20210511005531.1065536-5-hpa@zytor.com> Date: Tue, 11 May 2021 16:22:24 +0200 Message-ID: <87lf8lfizj.ffs@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 10 2021 at 17:55, H. Peter Anvin wrote: > +/** > + * IDTENTRY_INVOKE_SYSVEC - Common code for system vector IDT entry points > + * @what: What should be called > + * > + * Common code for DEFINE_IDTENTRY_SYSVEC and _SYSVEC_SIMPLE > + */ > +#define IDTENTRY_INVOKE_SYSVEC(what) \ > +do { \ > + irqentry_state_t state = irqentry_enter(regs); \ > + \ > + instrumentation_begin(); \ > + kvm_set_cpu_l1tf_flush_l1d(); \ > + what; \ > + instrumentation_end(); \ > + irqentry_exit(regs, state); \ > +} while (0) \ > + > /** > * DEFINE_IDTENTRY_SYSVEC - Emit code for system vector IDT entry points > * @func: Function name of the entry point > @@ -233,13 +250,7 @@ static void __##func(struct pt_regs *regs); \ > \ > __visible noinstr void func(struct pt_regs *regs) \ > { \ > - irqentry_state_t state = irqentry_enter(regs); \ > - \ > - instrumentation_begin(); \ > - kvm_set_cpu_l1tf_flush_l1d(); \ > - run_sysvec_on_irqstack_cond(__##func, regs); \ > - instrumentation_end(); \ > - irqentry_exit(regs, state); \ > + IDTENTRY_INVOKE_SYSVEC(run_sysvec_on_irqstack_cond(__##func, regs)); \ > } \ > \ > static noinline void __##func(struct pt_regs *regs) > @@ -260,15 +271,7 @@ static __always_inline void __##func(struct pt_regs *regs); \ > \ > __visible noinstr void func(struct pt_regs *regs) \ > { \ > - irqentry_state_t state = irqentry_enter(regs); \ > - \ > - instrumentation_begin(); \ > - __irq_enter_raw(); \ > - kvm_set_cpu_l1tf_flush_l1d(); \ > - __##func (regs); \ > - __irq_exit_raw(); \ > - instrumentation_end(); \ > - irqentry_exit(regs, state); \ > + IDTENTRY_INVOKE_SYSVEC(__irq_enter_raw(); __##func(regs); __irq_exit_raw()); \ That's not really making the code more readable. Something like the below perhaps? #define IDTENTRY_INVOKE_SYSVEC(func, regs, raw) \ do { \ irqentry_state_t state = irqentry_enter(regs); \ \ instrumentation_begin(); \ kvm_set_cpu_l1tf_flush_l1d(); \ if (raw) { \ __irq_enter_raw(); \ func(regs); \ __irq_exit_raw(); \ } else { \ run_sysvec_on_irqstack_cond(func, regs); \ } \ instrumentation_end(); \ irqentry_exit(regs, state); \ } while (0) \ Thanks, tglx