Skip to contentSkip to conversation

hw/cxl: Fix background completion percentage calculation

PATCH In review [email protected] 4 participants 6 messages Jul 29, 2024 – Sep 14, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/cxl: Fix background completion percentage calculation

From: Ajay Joshi <[email protected]>

The current completion percentage calculation does not account for the relative time since the start of the background activity, this leads to showing incorrect start percentage vs what has actually been completed.

This patch calculates the percentage based on the actual elapsed time since the start of the operation.

Fixes 221d2cfbdb ("hw/cxl/mbox: Add support for background operations")
---
 hw/cxl/cxl-mailbox-utils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/cxl/cxl-mailbox-utils.c +2 -1
index c2ed251bb3..873d60c069 100644
@@ -2708,7 +2708,8 @@ static void bg_timercb(void *opaque)
         }
     } else {
         /* estimate only */
-        cci->bg.complete_pct = 100 * now / total_time;
+        cci->bg.complete_pct =
+            100 * (now - cci->bg.starttime) / cci->bg.runtime;
         timer_mod(cci->bg.timer, now + CXL_MBOX_BG_UPDATE_FREQ);
     }
 
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw

On Mon, 29 Jul 2024, [email protected] wrote:\n

Quoted 8 lines

From: Ajay Joshi <[email protected]>

The current completion percentage calculation does not account for the relative time since the start of the background activity, this leads to showing incorrect start percentage vs what has actually been completed.

Quoted 6 lines

This patch calculates the percentage based on the actual elapsed time since the start of the operation.

Fixes 221d2cfbdb ("hw/cxl/mbox: Add support for background operations")
#2 lore raw
Quoted 12 lines

From: Davidlohr Bueso <[email protected]>

On Mon, 29 Jul 2024, [email protected] wrote:\n

Quoted 9 lines

From: Ajay Joshi <[email protected]>

The current completion percentage calculation does not account for the relative time since the start of the background activity, this leads to showing incorrect start percentage vs what has actually been completed.

This patch calculates the percentage based on the actual elapsed time since the start of the operation.

Quoted 6 lines
Quoted 4 lines
Fixes 221d2cfbdb ("hw/cxl/mbox: Add support for background

operations")

Ping.
Jonathan, this patch was reviewed by Dave already. Do you have any comments on this patch?

Ajay

#3 lore raw
Quoted 15 lines · On Tue, 27 Aug 2024 16:01:54 +0000 ajay.opensrc <[email protected]> wrote:
Quoted 15 lines

From: Davidlohr Bueso <[email protected]>

On Mon, 29 Jul 2024, [email protected] wrote:\n

Quoted 12 lines

From: Ajay Joshi <[email protected]>

The current completion percentage calculation does not account for the relative time since the start of the background activity, this leads to showing incorrect start percentage vs what has actually been completed.

This patch calculates the percentage based on the actual elapsed time since the start of the operation.

Fixes 221d2cfbdb ("hw/cxl/mbox: Add support for background

operations")

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Ping.
Jonathan, this patch was reviewed by Dave already. Do you have any comments on this patch?

Sorry bit behind. Seems fine to me. I'll queue it up, but not sure
when I'll get a fixes series out (hopefully soon!)

+CC Michael in meantime.

in case Michael wants to pick it up directly.

Thanks,

Jonathan

Quoted 2 lines

Ajay

#4 lore raw
In reply to [email protected]
Quoted 8 lines · On Mon, Jul 29, 2024 at 03:53:38PM +0530, [email protected] wrote:

From: Ajay Joshi <[email protected]>

The current completion percentage calculation does not account for the relative time since the start of the background activity, this leads to showing incorrect start percentage vs what has actually been completed.

Quoted 6 lines

This patch calculates the percentage based on the actual elapsed time since the start of the operation.

Fixes 221d2cfbdb ("hw/cxl/mbox: Add support for background operations")

Keep all tags together with no empty lines pls.

Quoted 21 lines
---
 hw/cxl/cxl-mailbox-utils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/cxl/cxl-mailbox-utils.c +2 -1
index c2ed251bb3..873d60c069 100644
@@ -2708,7 +2708,8 @@ static void bg_timercb(void *opaque)
         }
     } else {
         /* estimate only */
-        cci->bg.complete_pct = 100 * now / total_time;
+        cci->bg.complete_pct =
+            100 * (now - cci->bg.starttime) / cci->bg.runtime;
         timer_mod(cci->bg.timer, now + CXL_MBOX_BG_UPDATE_FREQ);
     }
 
Signature · 1 line
2.34.1
#5 lore raw
Quoted 12 lines

From: Michael S. Tsirkin <[email protected]>

Quoted 8 lines · On Mon, Jul 29, 2024 at 03:53:38PM +0530, [email protected] wrote:

From: Ajay Joshi <[email protected]>

The current completion percentage calculation does not account for the relative time since the start of the background activity, this leads to showing incorrect start percentage vs what has actually been completed.

Quoted 8 lines
Quoted 6 lines

This patch calculates the percentage based on the actual elapsed time since the start of the operation.

Fixes 221d2cfbdb ("hw/cxl/mbox: Add support for background operations")

Keep all tags together with no empty lines pls.

I have resent the patch with the all the tags Michael.
https://lore.kernel.org/linux-cxl/[email protected]/T/#u

Quoted 21 lines
Quoted 21 lines
---
 hw/cxl/cxl-mailbox-utils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/cxl/cxl-mailbox-utils.c +2 -2
index c2ed251bb3..873d60c069 100644
@@ -2708,7 +2708,8 @@ static void bg_timercb(void *opaque)
         }
     } else {
         /* estimate only */
-        cci->bg.complete_pct = 100 * now / total_time;
+        cci->bg.complete_pct =
+            100 * (now - cci->bg.starttime) / cci->bg.runtime;
         timer_mod(cci->bg.timer, now + CXL_MBOX_BG_UPDATE_FREQ);
     }
 
--

2.34.1