Re: [EXT] Re: [PATCH] hw/cxl: Fix background completion percentage calculation

ajay.opensrc
2024-09-14T11:29:59Z

>From: Michael S. Tsirkin <mst@redhat.com>
>On Mon, Jul 29, 2024 at 03:53:38PM +0530, ajay.opensrc@micron.com wrote:
>> From: Ajay Joshi <ajayjoshi@micron.com>
>>
>> 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")
>>
>> Signed-off-by: Ajay Joshi <ajay.opensrc@micron.com>
>
>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/20240914112021.2730383-1-ajay.opensrc@micron.com/T/#u

>
>> ---
>> hw/cxl/cxl-mailbox-utils.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c
>> index c2ed251bb3..873d60c069 100644
>> --- a/hw/cxl/cxl-mailbox-utils.c
>> +++ b/hw/cxl/cxl-mailbox-utils.c
>> @@ -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