From: Lukas Wunner <lukas@wunner.de>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: linux-pci@vger.kernel.org, Bjorn Helgaas <helgaas@kernel.org>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Wilczy??ski <kw@linux.com>,
Alexandru Gagniuc <mr.nuke.me@gmail.com>,
Krishna chaitanya chundru <quic_krichai@quicinc.com>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
"Rafael J . Wysocki" <rafael@kernel.org>,
linux-pm@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>,
LKML <linux-kernel@vger.kernel.org>,
Alex Deucher <alexdeucher@gmail.com>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>
Subject: Re: [PATCH v3 07/10] PCI/LINK: Re-add BW notification portdrv as PCIe BW controller
Date: Mon, 1 Jan 2024 19:11:46 +0100 [thread overview]
Message-ID: <20240101181146.GA26390@wunner.de> (raw)
In-Reply-To: <ada759ad-c2e-41d7-e15f-a7a3dc208771@linux.intel.com>
On Mon, Jan 01, 2024 at 07:37:25PM +0200, Ilpo Järvinen wrote:
> On Sat, 30 Dec 2023, Lukas Wunner wrote:
> > On Fri, Sep 29, 2023 at 02:57:20PM +0300, Ilpo Järvinen wrote:
> > > + pcie_capability_write_word(dev, PCI_EXP_LNKSTA, PCI_EXP_LNKSTA_LBMS);
> > > + pcie_capability_set_word(dev, PCI_EXP_LNKCTL, PCI_EXP_LNKCTL_LBMIE);
> >
> > I'm wondering why we're not enabling LABIE as well?
> > (And clear LABS.)
> >
> > Can't it happen that we miss bandwidth changes unless we enable that
> > as well?
>
> Thanks. Reading the spec, it sounds like both are necessary to not miss
> changes.
I guess this is an artefact of Alex' original patch.
I don't know why he enabled one but not the other.
> > > + ret = request_irq(srv->irq, pcie_bw_notification_irq,
> > > + IRQF_SHARED, "PCIe BW ctrl", srv);
> >
> > Is there a reason to run the IRQ handler in hardirq context
> > or would it work to run it in an IRQ thread? Usually on systems
> > than enable PREEMPT_RT, a threaded IRQ handler is preferred,
> > so unless hardirq context is necessary, I'd recommend using
> > an IRQ thread.
>
> Can I somehow postpone the decision between IRQ_NONE / IRQ_HANDLED
> straight into the thread_fn? One LNKSTA read is necessary to decide
> that.
>
> I suppose the other write + reread of LNKSTA could be moved into
> thread_fn even if the first read would not be movable.
You can just use request_threaded_irq(), pass NULL for the "handler"
argument and pcie_bw_notification_irq for the "thread_fn" argument.
Because of the NULL argument for "handler", the hardirq handler will
then become irq_default_primary_handler(). Which does nothing else
but return IRQ_WAKE_THREAD. And the decision between IRQ_NONE and
IRQ_HANDLED is then indeed postponed to the IRQ thread.
Alternatively you can split the IRQ handler, move the check whether
PCI_EXP_LNKSTA_LBMS is set to the hardirq handler and keep the rest
in the IRQ thread. Means you won't have unnecessary wakeups of the
IRQ thread if the interrupt is caused by something else (I understand
it's always shared with PME and hotplug). But you'll spend more time
in hardirq context. In practice bandwidth notifications may be more
frequent than PME and hotplug interrupts, so unnecessary wakeups of
the IRQ thread will be rare. Hence not splitting the IRQ handler
may be better. Dunno. Ask Thomas Gleixner or Sebastian Siewior. :)
Thanks,
Lukas
next prev parent reply other threads:[~2024-01-01 18:11 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-29 11:57 [PATCH v3 00/10] Add PCIe Bandwidth Controller Ilpo Järvinen
2023-09-29 11:57 ` [PATCH v3 01/10] PCI: Protect Link Control 2 Register with RMW locking Ilpo Järvinen
2023-12-30 10:33 ` Lukas Wunner
2023-09-29 11:57 ` [PATCH v3 02/10] drm/radeon: Use RMW accessors for changing LNKCTL2 Ilpo Järvinen
2023-09-29 11:57 ` [PATCH v3 03/10] drm/amdgpu: " Ilpo Järvinen
2023-09-29 11:57 ` [PATCH v3 04/10] RDMA/hfi1: " Ilpo Järvinen
2023-09-29 13:03 ` Dean Luick
2023-09-29 11:57 ` [PATCH v3 05/10] PCI: Store all PCIe Supported Link Speeds Ilpo Järvinen
2023-12-30 11:45 ` Lukas Wunner
2023-12-30 19:30 ` Lukas Wunner
2024-01-01 16:26 ` Ilpo Järvinen
2024-01-01 16:40 ` Lukas Wunner
2024-01-01 16:53 ` Ilpo Järvinen
2023-09-29 11:57 ` [PATCH v3 06/10] PCI: Cache PCIe device's Supported Speed Vector Ilpo Järvinen
2023-12-30 15:19 ` Lukas Wunner
2024-01-01 18:31 ` Ilpo Järvinen
2024-01-03 16:51 ` Lukas Wunner
2023-09-29 11:57 ` [PATCH v3 07/10] PCI/LINK: Re-add BW notification portdrv as PCIe BW controller Ilpo Järvinen
2023-12-30 15:58 ` Lukas Wunner
2024-01-01 17:37 ` Ilpo Järvinen
2024-01-01 18:11 ` Lukas Wunner [this message]
2023-09-29 11:57 ` [PATCH v3 08/10] PCI/bwctrl: Add "controller" part into PCIe bwctrl Ilpo Järvinen
2023-12-30 18:49 ` Lukas Wunner
2024-01-01 18:12 ` Ilpo Järvinen
2024-01-03 16:40 ` Lukas Wunner
2023-09-29 11:57 ` [PATCH v3 09/10] thermal: Add PCIe cooling driver Ilpo Järvinen
2023-12-30 19:08 ` Lukas Wunner
2024-01-01 16:39 ` Ilpo Järvinen
2023-09-29 11:57 ` [PATCH v3 10/10] selftests/pcie_bwctrl: Create selftests Ilpo Järvinen
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=20240101181146.GA26390@wunner.de \
--to=lukas@wunner.de \
--cc=alexdeucher@gmail.com \
--cc=amitk@kernel.org \
--cc=bhelgaas@google.com \
--cc=daniel.lezcano@linaro.org \
--cc=helgaas@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=mr.nuke.me@gmail.com \
--cc=quic_krichai@quicinc.com \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=rui.zhang@intel.com \
--cc=srinivas.pandruvada@linux.intel.com \
/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;
as well as URLs for NNTP newsgroup(s).