qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/s390x: Fix bad mask in time2tod()
@ 2018-12-14 13:08 Thomas Huth
  2018-12-14 13:12 ` David Hildenbrand
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Thomas Huth @ 2018-12-14 13:08 UTC (permalink / raw)
  To: qemu-s390x, Cornelia Huck
  Cc: qemu-devel, Halil Pasic, Christian Borntraeger, David Hildenbrand,
	qemu-stable

The time2tod() function tries to deal with the 9 uppermost bits in the
time value, but uses the wrong mask for this: 0xff80000000000000 should
be used instead of 0xff10000000000000 here.

Fixes: 14055ce53c2d901d826ffad7fb7d6bb8ab46bdfd
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 include/hw/s390x/tod.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/hw/s390x/tod.h b/include/hw/s390x/tod.h
index cbd7552..47ef9de 100644
--- a/include/hw/s390x/tod.h
+++ b/include/hw/s390x/tod.h
@@ -56,7 +56,7 @@ typedef struct S390TODClass {
 /* Converts ns to s390's clock format */
 static inline uint64_t time2tod(uint64_t ns)
 {
-    return (ns << 9) / 125 + (((ns & 0xff10000000000000ull) / 125) << 9);
+    return (ns << 9) / 125 + (((ns & 0xff80000000000000ull) / 125) << 9);
 }
 
 /* Converts s390's clock format to ns */
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/s390x: Fix bad mask in time2tod()
  2018-12-14 13:08 [Qemu-devel] [PATCH] hw/s390x: Fix bad mask in time2tod() Thomas Huth
@ 2018-12-14 13:12 ` David Hildenbrand
  2018-12-14 13:15 ` Christian Borntraeger
  2018-12-14 13:38 ` Cornelia Huck
  2 siblings, 0 replies; 8+ messages in thread
From: David Hildenbrand @ 2018-12-14 13:12 UTC (permalink / raw)
  To: Thomas Huth, qemu-s390x, Cornelia Huck
  Cc: qemu-devel, Halil Pasic, Christian Borntraeger, qemu-stable

On 14.12.18 14:08, Thomas Huth wrote:
> The time2tod() function tries to deal with the 9 uppermost bits in the
> time value, but uses the wrong mask for this: 0xff80000000000000 should
> be used instead of 0xff10000000000000 here.
> 
> Fixes: 14055ce53c2d901d826ffad7fb7d6bb8ab46bdfd
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  include/hw/s390x/tod.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/hw/s390x/tod.h b/include/hw/s390x/tod.h
> index cbd7552..47ef9de 100644
> --- a/include/hw/s390x/tod.h
> +++ b/include/hw/s390x/tod.h
> @@ -56,7 +56,7 @@ typedef struct S390TODClass {
>  /* Converts ns to s390's clock format */
>  static inline uint64_t time2tod(uint64_t ns)
>  {
> -    return (ns << 9) / 125 + (((ns & 0xff10000000000000ull) / 125) << 9);
> +    return (ns << 9) / 125 + (((ns & 0xff80000000000000ull) / 125) << 9);
>  }
>  
>  /* Converts s390's clock format to ns */
> 

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 

Thanks,

David / dhildenb

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/s390x: Fix bad mask in time2tod()
  2018-12-14 13:08 [Qemu-devel] [PATCH] hw/s390x: Fix bad mask in time2tod() Thomas Huth
  2018-12-14 13:12 ` David Hildenbrand
@ 2018-12-14 13:15 ` Christian Borntraeger
  2018-12-14 13:23   ` Thomas Huth
  2018-12-14 13:38 ` Cornelia Huck
  2 siblings, 1 reply; 8+ messages in thread
From: Christian Borntraeger @ 2018-12-14 13:15 UTC (permalink / raw)
  To: Thomas Huth, qemu-s390x, Cornelia Huck
  Cc: qemu-devel, Halil Pasic, David Hildenbrand, qemu-stable



On 14.12.2018 14:08, Thomas Huth wrote:
> The time2tod() function tries to deal with the 9 uppermost bits in the
> time value, but uses the wrong mask for this: 0xff80000000000000 should
> be used instead of 0xff10000000000000 here.
> 
> Fixes: 14055ce53c2d901d826ffad7fb7d6bb8ab46bdfd

Can you alsways have commit id and subject

like
Fixes: 14055ce53c2d ("s390x/tcg: avoid overflows in time2tod/tod2time")

> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  include/hw/s390x/tod.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/hw/s390x/tod.h b/include/hw/s390x/tod.h
> index cbd7552..47ef9de 100644
> --- a/include/hw/s390x/tod.h
> +++ b/include/hw/s390x/tod.h
> @@ -56,7 +56,7 @@ typedef struct S390TODClass {
>  /* Converts ns to s390's clock format */
>  static inline uint64_t time2tod(uint64_t ns)
>  {
> -    return (ns << 9) / 125 + (((ns & 0xff10000000000000ull) / 125) << 9);
> +    return (ns << 9) / 125 + (((ns & 0xff80000000000000ull) / 125) << 9);
>  }
>  
>  /* Converts s390's clock format to ns */
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/s390x: Fix bad mask in time2tod()
  2018-12-14 13:15 ` Christian Borntraeger
@ 2018-12-14 13:23   ` Thomas Huth
  2018-12-14 13:26     ` Christian Borntraeger
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Huth @ 2018-12-14 13:23 UTC (permalink / raw)
  To: Christian Borntraeger, qemu-s390x, Cornelia Huck
  Cc: qemu-devel, Halil Pasic, David Hildenbrand, qemu-stable

On 2018-12-14 14:15, Christian Borntraeger wrote:
> 
> 
> On 14.12.2018 14:08, Thomas Huth wrote:
>> The time2tod() function tries to deal with the 9 uppermost bits in the
>> time value, but uses the wrong mask for this: 0xff80000000000000 should
>> be used instead of 0xff10000000000000 here.
>>
>> Fixes: 14055ce53c2d901d826ffad7fb7d6bb8ab46bdfd
> 
> Can you alsways have commit id and subject
> 
> like
> Fixes: 14055ce53c2d ("s390x/tcg: avoid overflows in time2tod/tod2time")

In https://wiki.qemu.org/Contribute/SubmitAPatch we currently have:

 Fixes: <full-SHA-commit-id>

... and the full commit ID is sometimes very useful for downstream, so
I'd rather avoid to abbreviate that here. But I can try to remember to
put the title of the patch in another spot of the description, too.

 Thomas

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/s390x: Fix bad mask in time2tod()
  2018-12-14 13:23   ` Thomas Huth
@ 2018-12-14 13:26     ` Christian Borntraeger
  2018-12-14 13:30       ` Thomas Huth
  0 siblings, 1 reply; 8+ messages in thread
From: Christian Borntraeger @ 2018-12-14 13:26 UTC (permalink / raw)
  To: Thomas Huth, qemu-s390x, Cornelia Huck
  Cc: qemu-devel, Halil Pasic, David Hildenbrand, qemu-stable



On 14.12.2018 14:23, Thomas Huth wrote:
> On 2018-12-14 14:15, Christian Borntraeger wrote:
>>
>>
>> On 14.12.2018 14:08, Thomas Huth wrote:
>>> The time2tod() function tries to deal with the 9 uppermost bits in the
>>> time value, but uses the wrong mask for this: 0xff80000000000000 should
>>> be used instead of 0xff10000000000000 here.
>>>
>>> Fixes: 14055ce53c2d901d826ffad7fb7d6bb8ab46bdfd
>>
>> Can you alsways have commit id and subject
>>
>> like
>> Fixes: 14055ce53c2d ("s390x/tcg: avoid overflows in time2tod/tod2time")
> 
> In https://wiki.qemu.org/Contribute/SubmitAPatch we currently have:
> 
>  Fixes: <full-SHA-commit-id>


Interesting. Linus strongly opposed to only have the commit id as people often
do cut and paste errors so nobody could actually find out which commit was meant.
So the Linux variant is not sha commit of at least 12 digits + subject.

> 
> ... and the full commit ID is sometimes very useful for downstream, so
> I'd rather avoid to abbreviate that here. But I can try to remember to
> put the title of the patch in another spot of the description, too.
> 
>  Thomas
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/s390x: Fix bad mask in time2tod()
  2018-12-14 13:26     ` Christian Borntraeger
@ 2018-12-14 13:30       ` Thomas Huth
  2018-12-14 14:09         ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Huth @ 2018-12-14 13:30 UTC (permalink / raw)
  To: Christian Borntraeger, qemu-s390x, Cornelia Huck
  Cc: qemu-devel, Halil Pasic, David Hildenbrand, qemu-stable

On 2018-12-14 14:26, Christian Borntraeger wrote:
> 
> 
> On 14.12.2018 14:23, Thomas Huth wrote:
>> On 2018-12-14 14:15, Christian Borntraeger wrote:
>>>
>>>
>>> On 14.12.2018 14:08, Thomas Huth wrote:
>>>> The time2tod() function tries to deal with the 9 uppermost bits in the
>>>> time value, but uses the wrong mask for this: 0xff80000000000000 should
>>>> be used instead of 0xff10000000000000 here.
>>>>
>>>> Fixes: 14055ce53c2d901d826ffad7fb7d6bb8ab46bdfd
>>>
>>> Can you alsways have commit id and subject
>>>
>>> like
>>> Fixes: 14055ce53c2d ("s390x/tcg: avoid overflows in time2tod/tod2time")
>>
>> In https://wiki.qemu.org/Contribute/SubmitAPatch we currently have:
>>
>>  Fixes: <full-SHA-commit-id>
> 
> Interesting. Linus strongly opposed to only have the commit id as people often
> do cut and paste errors so nobody could actually find out which commit was meant.
> So the Linux variant is not sha commit of at least 12 digits + subject.

Mentioning the title certainly makes sense, too, so feel free to extend
the Wiki page if you like!

 Thomas

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/s390x: Fix bad mask in time2tod()
  2018-12-14 13:08 [Qemu-devel] [PATCH] hw/s390x: Fix bad mask in time2tod() Thomas Huth
  2018-12-14 13:12 ` David Hildenbrand
  2018-12-14 13:15 ` Christian Borntraeger
@ 2018-12-14 13:38 ` Cornelia Huck
  2 siblings, 0 replies; 8+ messages in thread
From: Cornelia Huck @ 2018-12-14 13:38 UTC (permalink / raw)
  To: Thomas Huth
  Cc: qemu-s390x, qemu-devel, Halil Pasic, Christian Borntraeger,
	David Hildenbrand, qemu-stable

On Fri, 14 Dec 2018 14:08:07 +0100
Thomas Huth <thuth@redhat.com> wrote:

> The time2tod() function tries to deal with the 9 uppermost bits in the
> time value, but uses the wrong mask for this: 0xff80000000000000 should
> be used instead of 0xff10000000000000 here.

I've tweaked this to

Since "s390x/tcg: avoid overflows in time2tod/tod2time", the
time2tod() function tries to deal with the 9 uppermost bits in the
time value, but uses the wrong mask for this: 0xff80000000000000 should
be used instead of 0xff10000000000000 here.

> 
> Fixes: 14055ce53c2d901d826ffad7fb7d6bb8ab46bdfd

I'll add cc:stable in the patch description as well.

> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  include/hw/s390x/tod.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/hw/s390x/tod.h b/include/hw/s390x/tod.h
> index cbd7552..47ef9de 100644
> --- a/include/hw/s390x/tod.h
> +++ b/include/hw/s390x/tod.h
> @@ -56,7 +56,7 @@ typedef struct S390TODClass {
>  /* Converts ns to s390's clock format */
>  static inline uint64_t time2tod(uint64_t ns)
>  {
> -    return (ns << 9) / 125 + (((ns & 0xff10000000000000ull) / 125) << 9);
> +    return (ns << 9) / 125 + (((ns & 0xff80000000000000ull) / 125) << 9);
>  }
>  
>  /* Converts s390's clock format to ns */

Thanks, applied.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/s390x: Fix bad mask in time2tod()
  2018-12-14 13:30       ` Thomas Huth
@ 2018-12-14 14:09         ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-12-14 14:09 UTC (permalink / raw)
  To: Thomas Huth, Christian Borntraeger, qemu-s390x, Cornelia Huck
  Cc: Halil Pasic, qemu-stable, qemu-devel, David Hildenbrand

On 12/14/18 2:30 PM, Thomas Huth wrote:
> On 2018-12-14 14:26, Christian Borntraeger wrote:
>>
>>
>> On 14.12.2018 14:23, Thomas Huth wrote:
>>> On 2018-12-14 14:15, Christian Borntraeger wrote:
>>>>
>>>>
>>>> On 14.12.2018 14:08, Thomas Huth wrote:
>>>>> The time2tod() function tries to deal with the 9 uppermost bits in the
>>>>> time value, but uses the wrong mask for this: 0xff80000000000000 should
>>>>> be used instead of 0xff10000000000000 here.
>>>>>
>>>>> Fixes: 14055ce53c2d901d826ffad7fb7d6bb8ab46bdfd
>>>>
>>>> Can you alsways have commit id and subject
>>>>
>>>> like
>>>> Fixes: 14055ce53c2d ("s390x/tcg: avoid overflows in time2tod/tod2time")
>>>
>>> In https://wiki.qemu.org/Contribute/SubmitAPatch we currently have:
>>>
>>>  Fixes: <full-SHA-commit-id>
>>
>> Interesting. Linus strongly opposed to only have the commit id as people often
>> do cut and paste errors so nobody could actually find out which commit was meant.
>> So the Linux variant is not sha commit of at least 12 digits + subject.
> 
> Mentioning the title certainly makes sense, too, so feel free to extend
> the Wiki page if you like!

Done :)

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-12-14 14:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-14 13:08 [Qemu-devel] [PATCH] hw/s390x: Fix bad mask in time2tod() Thomas Huth
2018-12-14 13:12 ` David Hildenbrand
2018-12-14 13:15 ` Christian Borntraeger
2018-12-14 13:23   ` Thomas Huth
2018-12-14 13:26     ` Christian Borntraeger
2018-12-14 13:30       ` Thomas Huth
2018-12-14 14:09         ` Philippe Mathieu-Daudé
2018-12-14 13:38 ` Cornelia Huck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).