Thank you, Laszlo. I'll make sure to do that moving forward!

Patrick Henz

-----Original Message-----
From: Laszlo Ersek <ler...@redhat.com> 
Sent: Thursday, November 2, 2023 6:28 AM
To: devel@edk2.groups.io; mike.maslen...@gmail.com; Henz, Patrick 
<patrick.h...@hpe.com>
Cc: hao.a...@intel.com; ray...@intel.com
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Non-zero start/stop 
values in XhcGetElapsedTicks

On 11/1/23 02:12, Mike Maslenkin wrote:
> On Tue, Oct 31, 2023 at 7:52 PM Henz, Patrick <patrick.h...@hpe.com> wrote:
>>
>> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4578
>>
>> The implementation of XhcGetElapsedTicks did not account for non-zero 
>> start and stop values for the performance counter timer, potentially 
>> resulting in an incorrect elapsed tick count getting returned to the 
>> caller. Account for non-zero start and stop values when calculating 
>> the elapsed tick count.
>>
>> Cc: Hao A Wu <hao.a...@intel.com>
>> Cc: Ray Ni <ray...@intel.com>
>> Signed-off-by: Patrick Henz <patrick.h...@hpe.com>
>> Reviewed-by:
>> ---
>>  MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c 
>> b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
>> index 7a2e32a9dd..6cb97b7452 100644
>> --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
>> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
>> @@ -2389,7 +2389,7 @@ XhcGetElapsedTicks (
>>      // Counter counts upwards, check for an overflow condition
>>      //
>>      if (*PreviousTick > CurrentTick) {
>> -      Delta = (mPerformanceCounterEndValue - *PreviousTick) + CurrentTick;
>> +      Delta = (CurrentTick - mPerformanceCounterStartValue) + 
>> + (mPerformanceCounterEndValue - *PreviousTick);
>>      } else {
>>        Delta = CurrentTick - *PreviousTick;
>>      }
>> @@ -2398,7 +2398,7 @@ XhcGetElapsedTicks (
>>      // Counter counts downwards, check for an underflow condition
>>      //
>>      if (*PreviousTick < CurrentTick) {
>> -      Delta = (mPerformanceCounterStartValue - CurrentTick) + *PreviousTick;
>> +      Delta = (mPerformanceCounterStartValue - CurrentTick) + 
>> + (*PreviousTick - mPerformanceCounterEndValue);
>>      } else {
>>        Delta = *PreviousTick - CurrentTick;
>>      }
>> --
>> 2.34.1
>>
>>
>>
>> ------------
>> Groups.io Links: You receive all messages sent to this group.
>> View/Reply Online (#110434): 
>> https://edk2.groups.io/g/devel/message/110434
>> Mute This Topic: https://groups.io/mt/102301510/1770412
>> Group Owner: devel+ow...@edk2.groups.io
>> Unsubscribe: https://edk2.groups.io/g/devel/unsub 
>> [mike.maslen...@gmail.com]
>> ------------
>>
>>
> Hello, All
>
> Just curious why this patch was broken by google groups.
>
> Some patches to edk2 and edk2-redfish-client have unintended line 
> breaks marked with "=",  additional "0D" and additional "3D" to "="
> Web shows https://edk2.groups.io/g/devel/message/110434 exactly as it 
> saved by mailer.
> What do sender should setup to avoid this?

I recommend selecting base64 content-transfer-encoding, rather than 
quode-printable. Base64 will ensure that the embedded CRLFs (which are used in 
the edk2 source tree) survive intact, and also that "git-am" can cleanly apply 
the patch (as saved from the mailing list).

Base64 is more robust than 8bit too. (If 8bit survived all mail servers along 
the way, it would work fine as well.)

... According to my notes, git has always *ignored* the

[sendemail]
        transferEncoding = base64

stanza in my git config file. Which is why I have an alias around 
git-send-email that open-codes

  git send-email --transfer-encoding=base64 ...

So that's what I recommend.

(BTW, our "BaseTools/Scripts/SetupGit.py" script sets 
"sendemail.transferEncoding=8bit", but that is problematic for two
reasons: (1) git ignores it anyway, per my records mentioned above, (2) 8bit is 
inferior to base64 in practice, when it comes to CRLF integrity across all 
email servers.)

... Side comment: I can apply quoted-printable-encoded patches as well, from 
the list, but that's only because I manually transcode them to 8bit, before 
passing them to git-am. I use the following hairy script:

----------------------------
#!/bin/bash
set -e -u -C

TMPD=$(mktemp -d)
trap 'rm -f -r -- "$TMPD"' EXIT

cd "$TMPD"
tee input | dos2unix | csplit -s - '/^$/'
HEAD_LINES=$(wc -l < xx00)

head -n "$HEAD_LINES" input \
| sed -r 's/^(Content-Transfer-Encoding: )quoted-printable/\18bit/'

tail -n +$((HEAD_LINES + 1)) input \
| perl -p -e 'use MIME::QuotedPrint; $_=MIME::QuotedPrint::decode($_);' 
| \ unix2dos
----------------------------

(The perl command is from Paolo Bonzini.)

Summary: send your patches with

  git send-email --transfer-encoding=base64 ...

Laszlo



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#110575): https://edk2.groups.io/g/devel/message/110575
Mute This Topic: https://groups.io/mt/102301510/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to