public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH net-next v3 2/2] net: Adding support for Cavium ThunderX network controller
       [not found] ` <1431747401-20847-3-git-send-email-aleksey.makarov@auriga.com>
@ 2015-05-18  8:46   ` Paul Bolle
  2015-05-18 20:09   ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: Paul Bolle @ 2015-05-18  8:46 UTC (permalink / raw)
  To: linux-arm-kernel

Just a nit: a license mismatch.

On Fri, 2015-05-15 at 20:36 -0700, Aleksey Makarov wrote:
> --- /dev/null
> +++ b/drivers/net/ethernet/cavium/thunder/nic_main.c

> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.

This states the license is GPL v2 or later. (The other files used for
this module contain an identical comment.)

> +MODULE_LICENSE("GPL v2");

And, according to include/linux/module.h, this states the license is
just GPL v2. So I think that either the license used in the comment at
the top of those files or the ident used in the MODULE_LICENSE() macro
needs to change.

Ditto for the thunder_bgx.ko and the nicvf.ko module.

Thanks,


Paul Bolle

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

* [PATCH net-next v3 2/2] net: Adding support for Cavium ThunderX network controller
       [not found] ` <1431747401-20847-3-git-send-email-aleksey.makarov@auriga.com>
  2015-05-18  8:46   ` [PATCH net-next v3 2/2] net: Adding support for Cavium ThunderX network controller Paul Bolle
@ 2015-05-18 20:09   ` David Miller
  2015-05-18 21:52     ` David Daney
  1 sibling, 1 reply; 4+ messages in thread
From: David Miller @ 2015-05-18 20:09 UTC (permalink / raw)
  To: linux-arm-kernel

From: Aleksey Makarov <aleksey.makarov@auriga.com>
Date: Fri, 15 May 2015 20:36:39 -0700

> +/* Register read/write APIs */
> +static void nic_reg_write(struct nicpf *nic, u64 offset, u64 val)
> +{
> +	writeq_relaxed(val, nic->reg_base + offset);
> +}
> +
> +static u64 nic_reg_read(struct nicpf *nic, u64 offset)
> +{
> +	return readq_relaxed(nic->reg_base + offset);
> +}

Are you really sure it's OK to used relaxed ordering for all register
accesses like this?

Personally, I think it's asking for trouble.

Maybe in _extremely_ specific situations in the packet processing
fast path where you can clearly define the ordering needs when
programming the mailbox registers, I'd say it's OK.

But universally across the entire driver?  No way, no way at all.

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

* [PATCH net-next v3 2/2] net: Adding support for Cavium ThunderX network controller
  2015-05-18 20:09   ` David Miller
@ 2015-05-18 21:52     ` David Daney
  2015-05-18 23:52       ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: David Daney @ 2015-05-18 21:52 UTC (permalink / raw)
  To: linux-arm-kernel

On 05/18/2015 01:09 PM, David Miller wrote:
> From: Aleksey Makarov <aleksey.makarov@auriga.com>
> Date: Fri, 15 May 2015 20:36:39 -0700
>
>> +/* Register read/write APIs */
>> +static void nic_reg_write(struct nicpf *nic, u64 offset, u64 val)
>> +{
>> +	writeq_relaxed(val, nic->reg_base + offset);
>> +}
>> +
>> +static u64 nic_reg_read(struct nicpf *nic, u64 offset)
>> +{
>> +	return readq_relaxed(nic->reg_base + offset);
>> +}
>
> Are you really sure it's OK to used relaxed ordering for all register
> accesses like this?

Yes.

>
> Personally, I think it's asking for trouble.
>
 > Maybe in _extremely_ specific situations in the packet processing
 > fast path where you can clearly define the ordering needs when
 > programming the mailbox registers, I'd say it's OK.
 >
 > But universally across the entire driver?  No way, no way at all.
 >

I think for an ordinary NIC you would be 100% correct.  However, ...

... there is something that may not be evident from the patch:

The Cavium ThunderX network controller can *only* be found in SoCs 
containing the ThunderX ARM64 CPU implementation.  So, we know quite a 
bit (i.e. everything) about the memory ordering semantics of the system.

A slightly more detailed explanation of why it is safe to use 
writeq_relaxed/readq_relaxed is that all accesses to the device 
registers are implicitly strongly ordered with respect to memory 
accesses, so even though the function names imply otherwise, there is no 
relaxed ordering.  The readq/writeq functions add explicit ordering 
operation which in this case are redundant, and only add overhead.

So this leaves us with the question:  What should we do?

As I see it there are two options:

1) Keep the writeq_relaxed()/readq_relaxed(), but add a comment about 
why they are safe.

2) Change the patch so that we are using writeq()/readq() and suffer a 
decrease in performance.

I/we wouldn't object to either of these, so it is really up to you. 
Please let us know what you think the best way forward is.

Thanks,
David Daney

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

* [PATCH net-next v3 2/2] net: Adding support for Cavium ThunderX network controller
  2015-05-18 21:52     ` David Daney
@ 2015-05-18 23:52       ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2015-05-18 23:52 UTC (permalink / raw)
  To: linux-arm-kernel

From: David Daney <ddaney@caviumnetworks.com>
Date: Mon, 18 May 2015 14:52:30 -0700

> As I see it there are two options:
> 
> 1) Keep the writeq_relaxed()/readq_relaxed(), but add a comment about
> why they are safe.
> 
> 2) Change the patch so that we are using writeq()/readq() and suffer a
> decrease in performance.

I want a detailed comment added, so #1 would be my choice.

There are more than one set of register accessors, so make sure you
annotate them all.

Thanks.

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

end of thread, other threads:[~2015-05-18 23:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1431747401-20847-1-git-send-email-aleksey.makarov@auriga.com>
     [not found] ` <1431747401-20847-3-git-send-email-aleksey.makarov@auriga.com>
2015-05-18  8:46   ` [PATCH net-next v3 2/2] net: Adding support for Cavium ThunderX network controller Paul Bolle
2015-05-18 20:09   ` David Miller
2015-05-18 21:52     ` David Daney
2015-05-18 23:52       ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox