Patch "printk: Use prb_first_seq() as base for 32bit seq macros" has been added to the 6.7-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    printk: Use prb_first_seq() as base for 32bit seq macros

to the 6.7-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     printk-use-prb_first_seq-as-base-for-32bit-seq-macro.patch
and it can be found in the queue-6.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit b4aa90f37b62ea8fb9cc361447e2747656b36f8d
Author: John Ogness <john.ogness@xxxxxxxxxxxxx>
Date:   Wed Feb 7 14:46:52 2024 +0106

    printk: Use prb_first_seq() as base for 32bit seq macros
    
    [ Upstream commit 90ad525c2d9a8a6591ab822234a94b82871ef8e0 ]
    
    Note: This change only applies to 32bit architectures. On 64bit
          architectures the macros are NOPs.
    
    Currently prb_next_seq() is used as the base for the 32bit seq
    macros __u64seq_to_ulseq() and __ulseq_to_u64seq(). However, in
    a follow-up commit, prb_next_seq() will need to make use of the
    32bit seq macros.
    
    Use prb_first_seq() as the base for the 32bit seq macros instead
    because it is guaranteed to return 64bit sequence numbers without
    relying on any 32bit seq macros.
    
    Signed-off-by: John Ogness <john.ogness@xxxxxxxxxxxxx>
    Reviewed-by: Petr Mladek <pmladek@xxxxxxxx>
    Link: https://lore.kernel.org/r/20240207134103.1357162-4-john.ogness@xxxxxxxxxxxxx
    Signed-off-by: Petr Mladek <pmladek@xxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/printk/printk_ringbuffer.c b/kernel/printk/printk_ringbuffer.c
index 3d98232902cfd..f5a8bb606fe50 100644
--- a/kernel/printk/printk_ringbuffer.c
+++ b/kernel/printk/printk_ringbuffer.c
@@ -1931,7 +1931,7 @@ static int prb_read(struct printk_ringbuffer *rb, u64 seq,
 }
 
 /* Get the sequence number of the tail descriptor. */
-static u64 prb_first_seq(struct printk_ringbuffer *rb)
+u64 prb_first_seq(struct printk_ringbuffer *rb)
 {
 	struct prb_desc_ring *desc_ring = &rb->desc_ring;
 	enum desc_state d_state;
diff --git a/kernel/printk/printk_ringbuffer.h b/kernel/printk/printk_ringbuffer.h
index d729387726900..cb887489d00f0 100644
--- a/kernel/printk/printk_ringbuffer.h
+++ b/kernel/printk/printk_ringbuffer.h
@@ -378,6 +378,7 @@ bool prb_read_valid(struct printk_ringbuffer *rb, u64 seq,
 bool prb_read_valid_info(struct printk_ringbuffer *rb, u64 seq,
 			 struct printk_info *info, unsigned int *line_count);
 
+u64 prb_first_seq(struct printk_ringbuffer *rb);
 u64 prb_first_valid_seq(struct printk_ringbuffer *rb);
 u64 prb_next_seq(struct printk_ringbuffer *rb);
 u64 prb_next_reserve_seq(struct printk_ringbuffer *rb);
@@ -393,12 +394,12 @@ u64 prb_next_reserve_seq(struct printk_ringbuffer *rb);
 
 static inline u64 __ulseq_to_u64seq(struct printk_ringbuffer *rb, u32 ulseq)
 {
+	u64 rb_first_seq = prb_first_seq(rb);
 	u64 seq;
-	u64 rb_next_seq;
 
 	/*
 	 * The provided sequence is only the lower 32 bits of the ringbuffer
-	 * sequence. It needs to be expanded to 64bit. Get the next sequence
+	 * sequence. It needs to be expanded to 64bit. Get the first sequence
 	 * number from the ringbuffer and fold it.
 	 *
 	 * Having a 32bit representation in the console is sufficient.
@@ -407,8 +408,7 @@ static inline u64 __ulseq_to_u64seq(struct printk_ringbuffer *rb, u32 ulseq)
 	 *
 	 * Also the access to the ring buffer is always safe.
 	 */
-	rb_next_seq = prb_next_seq(rb);
-	seq = rb_next_seq - (s32)((u32)rb_next_seq - ulseq);
+	seq = rb_first_seq - (s32)((u32)rb_first_seq - ulseq);
 
 	return seq;
 }




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux