lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrWidbbfERQ0uEca8uOZvVzDWo-qF+0+NjwiF9A0R6Bthg@mail.gmail.com>
Date:	Thu, 9 Jun 2016 10:12:41 -0700
From:	Andy Lutomirski <luto@...capital.net>
To:	Paolo Bonzini <pbonzini@...hat.com>
Cc:	Roman Kagan <rkagan@...tuozzo.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	kvm list <kvm@...r.kernel.org>,
	Minfei Huang <mnghuan@...il.com>,
	Andrew Lutomirski <luto@...nel.org>
Subject: Re: [PATCH] pvclock: introduce seqcount-like API

On Thu, Jun 9, 2016 at 6:45 AM, Paolo Bonzini <pbonzini@...hat.com> wrote:
>
>
> On 09/06/2016 15:35, Roman Kagan wrote:
>> On Thu, Jun 09, 2016 at 02:47:54PM +0200, Paolo Bonzini wrote:
>>> On 09/06/2016 14:43, Roman Kagan wrote:
>>>> On Thu, Jun 09, 2016 at 01:23:23PM +0200, Paolo Bonzini wrote:
>>>>> The version field in struct pvclock_vcpu_time_info basically implements
>>>>> a seqcount.  Wrap it with the usual read_begin and read_retry functions,
>>>>> and use these APIs instead of peppering the code with smp_rmb()s.
>>>>> While at it, change it to the more pedantically correct virt_rmb().
>>>>>
>>>>> With this change, __pvclock_read_cycles can be simplified noticeably.
>>>>>
>>>>> Signed-off-by: Paolo Bonzini <pbonzini@...hat.com>
>>>>> ---
>>>>>  arch/x86/entry/vdso/vclock_gettime.c | 25 +++++------------------
>>>>>  arch/x86/include/asm/pvclock.h       | 39 +++++++++++++++++++++---------------
>>>>>  arch/x86/kernel/pvclock.c            | 17 ++++++----------
>>>>>  3 files changed, 34 insertions(+), 47 deletions(-)
>>>> [...]
>>>>> --- a/arch/x86/include/asm/pvclock.h
>>>>> +++ b/arch/x86/include/asm/pvclock.h
>>>> [...]
>>>>> @@ -69,23 +87,12 @@ static inline u64 pvclock_scale_delta(u64 delta, u32 mul_frac, int shift)
>>>>>  }
>>>>>
>>>>>  static __always_inline
>>>>> -unsigned __pvclock_read_cycles(const struct pvclock_vcpu_time_info *src,
>>>>> -                         cycle_t *cycles, u8 *flags)
>>>>> +cycle_t __pvclock_read_cycles(const struct pvclock_vcpu_time_info *src)
>>>>>  {
>>>>> -  unsigned version;
>>>>> -  cycle_t offset;
>>>>> -  u64 delta;
>>>>> -
>>>>> -  version = src->version;
>>>>> -  /* Make the latest version visible */
>>>>> -  smp_rmb();
>>>>
>>>> This is on top of Minfei's patch, right?  It isn't in Linus' tree yet so
>>>> I wonder if it makes sense to merge the two patches into one.
>>>>
>>>> Will you post it to stable, too?
>>>
>>> Not this one, because Minfei's patch is enough to fix the bug, but I do
>>
>> Has it landed in any public tree?  I'm unable to find any.  There
>> appears to be another version of the patch on the list, so I'm confused.
>
> I'm about to push it to kvm/master.
>

Sorry for being slow.  I'm catching up.  In its current form, I don't
like this patch.  Please don't apply it.

The problem is that this makes two significant changes at once:

1. Use the new version helpers.  I like that change.

2. Use __pvclock_read_cycles.  That should be separate, and it should
come with timing numbers in the changelog.

--Andy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ