public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: linux-kernel@vger.kernel.org
Cc: Juergen Gross <jgross@suse.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>,
	xen-devel@lists.xenproject.org, Jan Beulich <jbeulich@suse.com>
Subject: [PATCH 1/7] xen/events: fix delayed eoi list handling
Date: Mon, 16 Oct 2023 08:28:25 +0200	[thread overview]
Message-ID: <20231016062831.20630-2-jgross@suse.com> (raw)
In-Reply-To: <20231016062831.20630-1-jgross@suse.com>

When delaying eoi handling of events, the related elements are queued
into the percpu lateeoi list. In case the list isn't empty, the
elements should be sorted by the time when eoi handling is to happen.

Unfortunately a new element will never be queued at the start of the
list, even if it has a handling time lower than all other list
elements.

Fix that by handling that case the same way as for an empty list.

Fixes: e99502f76271 ("xen/events: defer eoi in case of excessive number of events")
Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
---
 drivers/xen/events/events_base.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
index 1b2136fe0fa5..0e458b1c0c8c 100644
--- a/drivers/xen/events/events_base.c
+++ b/drivers/xen/events/events_base.c
@@ -601,7 +601,9 @@ static void lateeoi_list_add(struct irq_info *info)
 
 	spin_lock_irqsave(&eoi->eoi_list_lock, flags);
 
-	if (list_empty(&eoi->eoi_list)) {
+	elem = list_first_entry_or_null(&eoi->eoi_list, struct irq_info,
+					eoi_list);
+	if (!elem || info->eoi_time < elem->eoi_time) {
 		list_add(&info->eoi_list, &eoi->eoi_list);
 		mod_delayed_work_on(info->eoi_cpu, system_wq,
 				    &eoi->delayed, delay);
-- 
2.35.3


  reply	other threads:[~2023-10-16  6:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16  6:28 [PATCH 0/7] xen/events: do some cleanups in events_base.c Juergen Gross
2023-10-16  6:28 ` Juergen Gross [this message]
2023-11-13 13:51   ` [PATCH 1/7] xen/events: fix delayed eoi list handling Oleksandr Tyshchenko
2023-10-16  6:28 ` [PATCH 2/7] xen/events: remove unused functions Juergen Gross
2023-11-13 14:20   ` Oleksandr Tyshchenko
2023-10-16  6:28 ` [PATCH 3/7] xen/events: reduce externally visible helper functions Juergen Gross
2023-11-13 15:53   ` Oleksandr Tyshchenko
2023-10-16  6:28 ` [PATCH 4/7] xen/events: remove some simple helpers from events_base.c Juergen Gross
2023-11-13 17:35   ` Oleksandr Tyshchenko
2023-11-14  8:28     ` Juergen Gross
2023-10-16  6:28 ` [PATCH 5/7] xen/events: drop xen_allocate_irqs_dynamic() Juergen Gross
2023-11-14  8:20   ` Oleksandr Tyshchenko
2023-11-14  8:35     ` Juergen Gross
2023-11-14 18:29       ` Oleksandr Tyshchenko
2023-10-16  6:28 ` [PATCH 6/7] xen/events: modify internal [un]bind interfaces Juergen Gross
2023-11-14 13:45   ` Oleksandr Tyshchenko
2023-10-16  6:28 ` [PATCH 7/7] xen/events: remove some info_for_irq() calls in pirq handling Juergen Gross
2023-11-14 18:16   ` Oleksandr Tyshchenko
2023-11-15  7:41     ` Juergen Gross
2023-11-13  7:14 ` [PATCH 0/7] xen/events: do some cleanups in events_base.c Juergen Gross

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=20231016062831.20630-2-jgross@suse.com \
    --to=jgross@suse.com \
    --cc=jbeulich@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleksandr_tyshchenko@epam.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.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