hw/cxl: Fix background completion percentage calculation
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.
--- hw/cxl/cxl-mailbox-utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/cxl/cxl-mailbox-utils.c +2 -1
@@ -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
Quoted 8 lines · On Sat, 14 Sep 2024 16:50:21 +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 5 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")
I'll include this is a fixes series I send to Michael + list later today. However for future reference, no line break between tags in the tags block as it breaks some scripting. I'll tidy that up. Note I think you missed Michael's point about this on the first version.
+ as a second version, even without changes, this should have been v2.
Thanks
Jonathan
Quoted 21 lines
Signed-off-by Ajay Joshi <[email protected]>Reviewed-by Davidlohr Bueso <[email protected]>Acked-by Jonathan Cameron <[email protected]>--- hw/cxl/cxl-mailbox-utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)hw/cxl/cxl-mailbox-utils.c +2
-1@@ -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 ); }
Quoted 17 lines
On Mon, 14 Oct 2024 10:32 +0530
<[email protected]> wrote:Quoted 11 lines · On Sat, 14 Sep 2024 16:50:21 +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.
This patch calculates the percentage based on the actual elapsed time since the start of the operation.
Quoted 8 lines
Quoted 2 lines
Fixes 221d2cfbdb ("hw/cxl/mbox: Add support for background operations")I'll include this is a fixes series I send to Michael + list later today. However for future reference, no line break between tags in the tags block as it breaks some scripting. I'll tidy that up. Note I think you missed Michael's point about this on the first version.
+ as a second version, even without changes, this should have been v2.
Thanks Jonathan! Got it.
Sorry missed the versioning, will be more careful about it.
Quoted 26 lines
Thanks
Jonathan
Quoted 21 lines
Signed-off-by Ajay Joshi <[email protected]>Reviewed-by Davidlohr Bueso <[email protected]>Acked-by Jonathan Cameron <[email protected]>--- hw/cxl/cxl-mailbox-utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)hw/cxl/cxl-mailbox-utils.c +2
-1@@ -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 ); }