Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1391622 > unrolled thread
| Started by | Borislav Petkov <bp@suse.de> |
|---|---|
| First post | 2016-04-30 15:30 +0200 |
| Last post | 2016-05-11 17:30 +0200 |
| Articles | 6 — 4 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH] Cleanup __pvclock_read_cycles to remove useless variables Borislav Petkov <bp@suse.de> - 2016-04-30 15:30 +0200
Re: [PATCH] Cleanup __pvclock_read_cycles to remove useless variables Andy Lutomirski <luto@amacapital.net> - 2016-04-30 19:50 +0200
Re: [PATCH] Cleanup __pvclock_read_cycles to remove useless variables Borislav Petkov <bp@suse.de> - 2016-04-30 21:20 +0200
Re: [PATCH] Cleanup __pvclock_read_cycles to remove useless variables Andy Lutomirski <luto@amacapital.net> - 2016-05-01 00:00 +0200
Re: [PATCH] Cleanup __pvclock_read_cycles to remove useless variables Paolo Bonzini <pbonzini@redhat.com> - 2016-05-11 16:30 +0200
Re: [PATCH] Cleanup __pvclock_read_cycles to remove useless variables Minfei Huang <mnghuan@gmail.com> - 2016-05-11 17:30 +0200
| From | Borislav Petkov <bp@suse.de> |
|---|---|
| Date | 2016-04-30 15:30 +0200 |
| Subject | Re: [PATCH] Cleanup __pvclock_read_cycles to remove useless variables |
| Message-ID | <rtD85-4Q-1@gated-at.bofh.it> |
On Mon, Apr 25, 2016 at 02:53:14PM +0800, Minfei Huang wrote:
> The value of cycles and flags can be assigned directly without
> intermediate variables.
>
> Remove the useless variables.
>
> Signed-off-by: Minfei Huang <mnghuan@gmail.com>
> ---
> arch/x86/include/asm/pvclock.h | 15 ++++-----------
> 1 file changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h
> index fdcc040..fb95dac 100644
> --- a/arch/x86/include/asm/pvclock.h
> +++ b/arch/x86/include/asm/pvclock.h
> @@ -80,19 +80,12 @@ static __always_inline
> unsigned __pvclock_read_cycles(const struct pvclock_vcpu_time_info *src,
> cycle_t *cycles, u8 *flags)
> {
> - unsigned version;
> - cycle_t ret, offset;
> - u8 ret_flags;
> -
> - version = src->version;
> + cycle_t offset;
>
> offset = pvclock_get_nsec_offset(src);
You could go a step further and get rid of that
pvclock_get_nsec_offset() simple wrapper too and move its meat into
__pvclock_read_cycles()...
--
Regards/Gruss,
Boris.
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
--
[toc] | [next] | [standalone]
| From | Andy Lutomirski <luto@amacapital.net> |
|---|---|
| Date | 2016-04-30 19:50 +0200 |
| Message-ID | <rtHbI-384-15@gated-at.bofh.it> |
| In reply to | #1391622 |
On Sat, Apr 30, 2016 at 6:24 AM, Borislav Petkov <bp@suse.de> wrote:
> On Mon, Apr 25, 2016 at 02:53:14PM +0800, Minfei Huang wrote:
>> The value of cycles and flags can be assigned directly without
>> intermediate variables.
>>
>> Remove the useless variables.
>>
>> Signed-off-by: Minfei Huang <mnghuan@gmail.com>
>> ---
>> arch/x86/include/asm/pvclock.h | 15 ++++-----------
>> 1 file changed, 4 insertions(+), 11 deletions(-)
>>
>> diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h
>> index fdcc040..fb95dac 100644
>> --- a/arch/x86/include/asm/pvclock.h
>> +++ b/arch/x86/include/asm/pvclock.h
>> @@ -80,19 +80,12 @@ static __always_inline
>> unsigned __pvclock_read_cycles(const struct pvclock_vcpu_time_info *src,
>> cycle_t *cycles, u8 *flags)
>> {
>> - unsigned version;
>> - cycle_t ret, offset;
>> - u8 ret_flags;
>> -
>> - version = src->version;
>> + cycle_t offset;
>>
>> offset = pvclock_get_nsec_offset(src);
>
> You could go a step further and get rid of that
> pvclock_get_nsec_offset() simple wrapper too and move its meat into
> __pvclock_read_cycles()...
>
Take a look at vread_pvclock. I decided that __pvclock_read_cycles
was too ugly to use and was very slow and I just gave up and rewrote
it.
> --
> Regards/Gruss,
> Boris.
>
> SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
> --
--
Andy Lutomirski
AMA Capital Management, LLC
[toc] | [prev] | [next] | [standalone]
| From | Borislav Petkov <bp@suse.de> |
|---|---|
| Date | 2016-04-30 21:20 +0200 |
| Message-ID | <rtIAO-4s0-17@gated-at.bofh.it> |
| In reply to | #1391649 |
On Sat, Apr 30, 2016 at 10:47:49AM -0700, Andy Lutomirski wrote:
> Take a look at vread_pvclock. I decided that __pvclock_read_cycles
> was too ugly to use and was very slow and I just gave up and rewrote
> it.
Should we kill __pvclock_read_cycles in favor of vread_pvclock? It looks
doable at a quick scan...
--
Regards/Gruss,
Boris.
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
--
[toc] | [prev] | [next] | [standalone]
| From | Andy Lutomirski <luto@amacapital.net> |
|---|---|
| Date | 2016-05-01 00:00 +0200 |
| Message-ID | <rtL5H-6vQ-37@gated-at.bofh.it> |
| In reply to | #1391658 |
On Apr 30, 2016 12:17 PM, "Borislav Petkov" <bp@suse.de> wrote: > > On Sat, Apr 30, 2016 at 10:47:49AM -0700, Andy Lutomirski wrote: > > Take a look at vread_pvclock. I decided that __pvclock_read_cycles > > was too ugly to use and was very slow and I just gave up and rewrote > > it. > > Should we kill __pvclock_read_cycles in favor of vread_pvclock? It looks > doable at a quick scan... > The in-kernel version might have to be a bit different because it needs to handle the !stable case. If !stable, it should just use the current CPU's copy which means that, realistically, it should just get_cpu and use the local copy unconditionally. Other than that, it could look a lot like the vread_pvclock variant. But I agree, the current thing is incomprehensible. --Andy > -- > Regards/Gruss, > Boris. > > SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) > --
[toc] | [prev] | [next] | [standalone]
| From | Paolo Bonzini <pbonzini@redhat.com> |
|---|---|
| Date | 2016-05-11 16:30 +0200 |
| Message-ID | <rxDjc-1to-35@gated-at.bofh.it> |
| In reply to | #1391706 |
On 30/04/2016 23:57, Andy Lutomirski wrote: >> > Should we kill __pvclock_read_cycles in favor of vread_pvclock? It looks >> > doable at a quick scan... >> > > The in-kernel version might have to be a bit different because it > needs to handle the !stable case. If !stable, it should just use the > current CPU's copy which means that, realistically, it should just > get_cpu and use the local copy unconditionally. Other than that, it > could look a lot like the vread_pvclock variant. > > But I agree, the current thing is incomprehensible. It also lacks smp_rmb()s. One is more or less implicit in rdtsc, but you need one to separate __pvclock_read_cycles's reads of src->foo from pvclock_read_flags's read of src->version. Minfei, would you like to take a look? Paolo
[toc] | [prev] | [next] | [standalone]
| From | Minfei Huang <mnghuan@gmail.com> |
|---|---|
| Date | 2016-05-11 17:30 +0200 |
| Message-ID | <rxEfg-2vs-15@gated-at.bofh.it> |
| In reply to | #1399174 |
On 05/11/16 at 04:24P, Paolo Bonzini wrote: > > > On 30/04/2016 23:57, Andy Lutomirski wrote: > >> > Should we kill __pvclock_read_cycles in favor of vread_pvclock? It looks > >> > doable at a quick scan... > >> > > > The in-kernel version might have to be a bit different because it > > needs to handle the !stable case. If !stable, it should just use the > > current CPU's copy which means that, realistically, it should just > > get_cpu and use the local copy unconditionally. Other than that, it > > could look a lot like the vread_pvclock variant. > > > > But I agree, the current thing is incomprehensible. > > It also lacks smp_rmb()s. One is more or less implicit in rdtsc, but > you need one to separate __pvclock_read_cycles's reads of src->foo from > pvclock_read_flags's read of src->version. > > Minfei, would you like to take a look? Sure. I will take a look about this issue. Thanks Minfei > > Paolo
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web