From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
To: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>
Cc: "Ravi V. Shankar" <ravi.v.shankar@intel.com>,
Ricardo Neri <ricardo.neri-calderon@linux.intel.com>,
x86@kernel.org, woodhouse@osuosl.org,
linux-kernel@vger.kernel.org,
Stephane Eranian <eranian@google.com>,
Ricardo Neri <ricardo.neri@intel.com>,
iommu@lists.linux-foundation.org,
Jacob Pan <jacob.jun.pan@intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Borislav Petkov <bp@suse.de>, Ingo Molnar <mingo@kernel.org>
Subject: [RFC PATCH v5 0/7] x86: watchdog/hardlockup/hpet: Add support for interrupt remapping
Date: Tue, 4 May 2021 12:10:42 -0700 [thread overview]
Message-ID: <20210504191049.22661-1-ricardo.neri-calderon@linux.intel.com> (raw)
Hi IOMMU experts,
I proposed a hardlockup detector driven by the HPET timer [1]. Such
detector is driven by a single timer. The hardlockup detector brings the
extra complexity of having to update the affinity of the interrupt
periodically and initiated from NMI context. The proposed design only
requires updating the affinity every watchdog_thresh (the interval is
between [1, 60] seconds). Also, the affinity update is offloaded to
an irq_work. Handling the HPET interrupt affinity is trivial with
!intremap since the detector composes the MSI message and writes it
directly to the HPET registers.
However, for intremap we must use the existing IOMMU drivers as well as
the kernel's irq plumbing. Thomas Gleixner has imposed two restrictions:
1) Do not implement an IRQF_NMI flag for x86 as it is not possible to
determine the source of an NMI [2].
2) Use the irq subsystem to update the affinity of the HPET
interrupt [3].
1) implies that the interrupt remapping drivers need to implement a quirk
to identify the HPET interrupt and update its delivery mode to NMI. 2)
means that the hardlockup detector must use request_irq() to allocate the
HPET interrupt.
This patch series attempts to meet the requirements above by
a) Decoupling the delivery mode of an APIC interrupt from the delivery
mode of the APIC driver (patch 1)
b) Implement quirks in the Intel and AMD IOMMU drivers to identify the
HPET timer and update the delivery mode accordingly (patches 2-5).
c) Add support for interrupt remapping in the HPET hardlockup detector
in [1]. This includes the unavoidable eyesore of using request_irq()
and having a useless regular interrupt handler (patch 6).
I would like to get your feedback on whether the HPET NMI quirk looks
sane to you and whether offloading the affinity setup to an irq_work
could pose issues.
Thanks and BR,
Ricardo
[1]. https://lore.kernel.org/lkml/20210504190526.22347-1-ricardo.neri-calderon@linux.intel.com/T/#mf77988cc98f9ca6988831e17f68394577388959d
[2]. https://lore.kernel.org/lkml/alpine.DEB.2.21.1808021137400.2037@nanos.tec.linutronix.de/
[3]. https://lore.kernel.org/lkml/alpine.DEB.2.21.1906161042080.1760@nanos.tec.linutronix.de/
Changes since v4:
* With !CONFIG_IRQ_REMAP [1] now disables the HPET channel before changing
the MSI Destination ID field. This should avoid races between a pending
interrupt and updating the detector's interrupt affinity. (Ashok)
* Rebased to use new enumeration apic_delivery_modes.
* Removed custom functions to allocate an interrupt for the detector
and instead added support to identify the detector's interrupt and
change the delivery mode.
* With interrupt remapping enabled, use request_irq().
* Added support for AMD IOMMU.
Changes since v3:
* None
Changes since v2:
* None
Changes since v1:
* Introduced support for interrupt remapping
Ricardo Neri (7):
x86/apic: Add irq_cfg::delivery_mode
x86/hpet: Introduce function to identify HPET hardlockup detector irq
iommu/vt-d: Rework prepare_irte() to support per-irq delivery mode
iommu/amd: Set the IRTE delivery mode from irq_cfg
iommu/vt-d: Fixup delivery mode of the HPET hardlockup interrupt
iommu/amd: Fixup delivery mode of the HPET hardlockup interrupt
x86/watchdog/hardlockup/hpet: Support interrupt remapping
arch/x86/include/asm/hpet.h | 5 +++
arch/x86/include/asm/hw_irq.h | 1 +
arch/x86/kernel/apic/vector.c | 10 ++++++
arch/x86/kernel/hpet.c | 36 ++++++++++++++++++++++
arch/x86/kernel/watchdog_hld_hpet.c | 48 +++++++++++++++++++++++++----
drivers/iommu/amd/iommu.c | 11 ++++++-
drivers/iommu/intel/irq_remapping.c | 20 ++++++++----
7 files changed, 118 insertions(+), 13 deletions(-)
--
2.17.1
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next reply other threads:[~2021-05-04 19:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-04 19:10 Ricardo Neri [this message]
2021-05-04 19:10 ` [RFC PATCH v5 1/7] x86/apic: Add irq_cfg::delivery_mode Ricardo Neri
2021-05-04 19:10 ` [RFC PATCH v5 2/7] x86/hpet: Introduce function to identify HPET hardlockup detector irq Ricardo Neri
2021-05-04 19:10 ` [RFC PATCH v5 3/7] iommu/vt-d: Rework prepare_irte() to support per-irq delivery mode Ricardo Neri
2021-05-04 19:10 ` [RFC PATCH v5 4/7] iommu/amd: Set the IRTE delivery mode from irq_cfg Ricardo Neri
2021-05-04 19:10 ` [RFC PATCH v5 5/7] iommu/vt-d: Fixup delivery mode of the HPET hardlockup interrupt Ricardo Neri
2021-05-04 23:03 ` Thomas Gleixner
2021-05-14 1:57 ` Ricardo Neri
2021-05-14 21:31 ` Thomas Gleixner
2021-05-04 19:10 ` [RFC PATCH v5 6/7] iommu/amd: " Ricardo Neri
2021-05-04 19:10 ` [RFC PATCH v5 7/7] x86/watchdog/hardlockup/hpet: Support interrupt remapping Ricardo Neri
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210504191049.22661-1-ricardo.neri-calderon@linux.intel.com \
--to=ricardo.neri-calderon@linux.intel.com \
--cc=bp@suse.de \
--cc=eranian@google.com \
--cc=iommu@lists.linux-foundation.org \
--cc=jacob.jun.pan@intel.com \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=ravi.v.shankar@intel.com \
--cc=ricardo.neri@intel.com \
--cc=tglx@linutronix.de \
--cc=will@kernel.org \
--cc=woodhouse@osuosl.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox