All of lore.kernel.org
 help / color / mirror / Atom feed
From: dmkhn@proton.me
To: xen-devel@lists.xenproject.org
Cc: andrew.cooper3@citrix.com, anthony.perard@vates.tech,
	jbeulich@suse.com, julien@xen.org, michal.orzel@amd.com,
	roger.pau@citrix.com, sstabellini@kernel.org, dmukhin@ford.com
Subject: [PATCH v1 1/3] xen/console: cleanup conring management
Date: Thu, 03 Apr 2025 00:06:22 +0000	[thread overview]
Message-ID: <20250403000604.169619-2-dmukhin@ford.com> (raw)
In-Reply-To: <20250403000604.169619-1-dmukhin@ford.com>

From: Denis Mukhin <dmukhin@ford.com>

Move console_locks_busted handling inside conring_puts() to remove
tasklet code duplication.

Signed-off-by: Denis Mukhin <dmukhin@ford.com>
---
 xen/drivers/char/console.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index c3150fbdb7..aaa97088aa 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -325,6 +325,17 @@ static void cf_check do_dec_thresh(unsigned char key, bool unused)
  * ********************************************************
  */
 
+static void cf_check notify_dom0_con_ring(void *unused)
+{
+    send_global_virq(VIRQ_CON_RING);
+}
+
+static DECLARE_SOFTIRQ_TASKLET(notify_dom0_con_ring_tasklet,
+                               notify_dom0_con_ring,
+                               NULL);
+
+static bool console_locks_busted;
+
 static void conring_puts(const char *str, size_t len)
 {
     ASSERT(rspin_is_locked(&console_lock));
@@ -334,6 +345,9 @@ static void conring_puts(const char *str, size_t len)
 
     if ( conringp - conringc > conring_size )
         conringc = conringp - conring_size;
+
+    if ( !console_locks_busted )
+        tasklet_schedule(&notify_dom0_con_ring_tasklet);
 }
 
 long read_console_ring(struct xen_sysctl_readconsole *op)
@@ -594,13 +608,6 @@ static void cf_check serial_rx(char c)
     __serial_rx(c);
 }
 
-static void cf_check notify_dom0_con_ring(void *unused)
-{
-    send_global_virq(VIRQ_CON_RING);
-}
-static DECLARE_SOFTIRQ_TASKLET(notify_dom0_con_ring_tasklet,
-                               notify_dom0_con_ring, NULL);
-
 #ifdef CONFIG_X86
 static inline void xen_console_write_debug_port(const char *buf, size_t len)
 {
@@ -648,10 +655,7 @@ static long guest_console_write(XEN_GUEST_HANDLE_PARAM(char) buffer,
 #endif
 
             if ( opt_console_to_ring )
-            {
                 conring_puts(kbuf, kcount);
-                tasklet_schedule(&notify_dom0_con_ring_tasklet);
-            }
 
             nrspin_unlock_irq(&console_lock);
         }
@@ -753,8 +757,6 @@ long do_console_io(
  * *****************************************************
  */
 
-static bool console_locks_busted;
-
 static void __putstr(const char *str)
 {
     size_t len = strlen(str);
@@ -775,9 +777,6 @@ static void __putstr(const char *str)
 #endif
 
     conring_puts(str, len);
-
-    if ( !console_locks_busted )
-        tasklet_schedule(&notify_dom0_con_ring_tasklet);
 }
 
 static int printk_prefix_check(char *p, char **pp)
-- 
2.34.1




  reply	other threads:[~2025-04-03  0:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-03  0:06 [PATCH v1 0/3] xen/console: few cleanups in console driver dmkhn
2025-04-03  0:06 ` dmkhn [this message]
2025-04-08 15:10   ` [PATCH v1 1/3] xen/console: cleanup conring management Jan Beulich
2025-04-25 22:18   ` Stefano Stabellini
2025-04-28  6:47     ` Jan Beulich
2025-04-28 20:10       ` dmkhn
2025-04-03  0:06 ` [PATCH v1 2/3] xen/console: introduce console_puts() dmkhn
2025-04-25 22:35   ` Stefano Stabellini
2025-04-25 22:47   ` Stefano Stabellini
2025-04-28  1:47     ` dmkhn
2025-04-03  0:06 ` [PATCH v1 3/3] xen/console: introduce conring_flush() dmkhn
2025-04-25 22:53   ` Stefano Stabellini

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=20250403000604.169619-2-dmukhin@ford.com \
    --to=dmkhn@proton.me \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=dmukhin@ford.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=roger.pau@citrix.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.