Re: [PATCH v3 00/13] crypto: Documentation of kernel crypto API

2014-11-13 Thread Herbert Xu
On Wed, Nov 12, 2014 at 05:22:00AM +0100, Stephan Mueller wrote:
> Hi,
> 
> The following patch set adds documentation files under Documentation/crypto/
> covering the high-level description of the API. In addition, it contains
> source code comments added to the header files of the kernel crypto API
> documenting the API functions.
> 
> The documentation is provided in a DocBook whose output can be reviewed at:
> 
> http://www.chronox.de/crypto-API/index.html
> 
> Changes v2:

All applied.  Thanks everyone!
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC PATCH 00/16] Replace smp_read_barrier_depends() with lockless_derefrence()

2014-11-13 Thread Pranith Kumar
Recently lockless_dereference() was added which can be used in place of
hard-coding smp_read_barrier_depends(). 

http://lkml.iu.edu/hypermail/linux/kernel/1410.3/04561.html

The following series tries to do this.

There are still some hard-coded locations which I was not sure how to replace
with. I will send in separate patches/questions regarding them.

Pranith Kumar (16):
  crypto: caam - Remove unnecessary smp_read_barrier_depends()
  doc: memory-barriers.txt: Document use of lockless_dereference()
  drivers: dma: Replace smp_read_barrier_depends() with
lockless_dereference()
  dcache: Replace smp_read_barrier_depends() with lockless_dereference()
  overlayfs: Replace smp_read_barrier_depends() with
lockless_dereference()
  assoc_array: Replace smp_read_barrier_depends() with
lockless_dereference()
  hyperv: Replace smp_read_barrier_depends() with lockless_dereference()
  rcupdate: Replace smp_read_barrier_depends() with
lockless_dereference()
  percpu: Replace smp_read_barrier_depends() with lockless_dereference()
  perf: Replace smp_read_barrier_depends() with lockless_dereference()
  seccomp: Replace smp_read_barrier_depends() with
lockless_dereference()
  task_work: Replace smp_read_barrier_depends() with
lockless_dereference()
  ksm: Replace smp_read_barrier_depends() with lockless_dereference()
  slab: Replace smp_read_barrier_depends() with lockless_dereference()
  netfilter: Replace smp_read_barrier_depends() with
lockless_dereference()
  rxrpc: Replace smp_read_barrier_depends() with lockless_dereference()

 Documentation/memory-barriers.txt |  2 +-
 drivers/crypto/caam/jr.c  |  3 ---
 drivers/dma/ioat/dma_v2.c |  3 +--
 drivers/dma/ioat/dma_v3.c |  3 +--
 fs/dcache.c   |  7 ++-
 fs/overlayfs/super.c  |  4 +---
 include/linux/assoc_array_priv.h  | 11 +++
 include/linux/hyperv.h|  9 -
 include/linux/percpu-refcount.h   |  4 +---
 include/linux/rcupdate.h  | 10 +-
 kernel/events/core.c  |  3 +--
 kernel/events/uprobes.c   |  8 
 kernel/seccomp.c  |  7 +++
 kernel/task_work.c|  3 +--
 lib/assoc_array.c |  7 ---
 mm/ksm.c  |  7 +++
 mm/slab.h |  6 +++---
 net/ipv4/netfilter/arp_tables.c   |  3 +--
 net/ipv4/netfilter/ip_tables.c|  3 +--
 net/ipv6/netfilter/ip6_tables.c   |  3 +--
 net/rxrpc/ar-ack.c| 22 +-
 security/keys/keyring.c   |  6 --
 22 files changed, 50 insertions(+), 84 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/16] crypto: caam - Remove unnecessary smp_read_barrier_depends()

2014-11-13 Thread Pranith Kumar
Recently lockless_dereference() was added which can be used in place of
hard-coding smp_read_barrier_depends(). The following PATCH makes the change.

Signed-off-by: Pranith Kumar 
---
 drivers/crypto/caam/jr.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c
index bae20d8..9b3ef1bc 100644
--- a/drivers/crypto/caam/jr.c
+++ b/drivers/crypto/caam/jr.c
@@ -181,8 +181,6 @@ static void caam_jr_dequeue(unsigned long devarg)
for (i = 0; CIRC_CNT(head, tail + i, JOBR_DEPTH) >= 1; i++) {
sw_idx = (tail + i) & (JOBR_DEPTH - 1);
 
-   smp_read_barrier_depends();
-
if (jrp->outring[hw_idx].desc ==
jrp->entinfo[sw_idx].desc_addr_dma)
break; /* found */
@@ -218,7 +216,6 @@ static void caam_jr_dequeue(unsigned long devarg)
if (sw_idx == tail) {
do {
tail = (tail + 1) & (JOBR_DEPTH - 1);
-   smp_read_barrier_depends();
} while (CIRC_CNT(head, tail, JOBR_DEPTH) >= 1 &&
 jrp->entinfo[tail].desc_addr_dma == 0);
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH 00/16] Replace smp_read_barrier_depends() with lockless_derefrence()

2014-11-13 Thread Paul E. McKenney
On Thu, Nov 13, 2014 at 02:24:06PM -0500, Pranith Kumar wrote:
> Recently lockless_dereference() was added which can be used in place of
> hard-coding smp_read_barrier_depends(). 
> 
> http://lkml.iu.edu/hypermail/linux/kernel/1410.3/04561.html
> 
> The following series tries to do this.
> 
> There are still some hard-coded locations which I was not sure how to replace
> with. I will send in separate patches/questions regarding them.

Thank you for taking this on!  Some questions and comments in response
to the individual patches.

Thanx, Paul

> Pranith Kumar (16):
>   crypto: caam - Remove unnecessary smp_read_barrier_depends()
>   doc: memory-barriers.txt: Document use of lockless_dereference()
>   drivers: dma: Replace smp_read_barrier_depends() with
> lockless_dereference()
>   dcache: Replace smp_read_barrier_depends() with lockless_dereference()
>   overlayfs: Replace smp_read_barrier_depends() with
> lockless_dereference()
>   assoc_array: Replace smp_read_barrier_depends() with
> lockless_dereference()
>   hyperv: Replace smp_read_barrier_depends() with lockless_dereference()
>   rcupdate: Replace smp_read_barrier_depends() with
> lockless_dereference()
>   percpu: Replace smp_read_barrier_depends() with lockless_dereference()
>   perf: Replace smp_read_barrier_depends() with lockless_dereference()
>   seccomp: Replace smp_read_barrier_depends() with
> lockless_dereference()
>   task_work: Replace smp_read_barrier_depends() with
> lockless_dereference()
>   ksm: Replace smp_read_barrier_depends() with lockless_dereference()
>   slab: Replace smp_read_barrier_depends() with lockless_dereference()
>   netfilter: Replace smp_read_barrier_depends() with
> lockless_dereference()
>   rxrpc: Replace smp_read_barrier_depends() with lockless_dereference()
> 
>  Documentation/memory-barriers.txt |  2 +-
>  drivers/crypto/caam/jr.c  |  3 ---
>  drivers/dma/ioat/dma_v2.c |  3 +--
>  drivers/dma/ioat/dma_v3.c |  3 +--
>  fs/dcache.c   |  7 ++-
>  fs/overlayfs/super.c  |  4 +---
>  include/linux/assoc_array_priv.h  | 11 +++
>  include/linux/hyperv.h|  9 -
>  include/linux/percpu-refcount.h   |  4 +---
>  include/linux/rcupdate.h  | 10 +-
>  kernel/events/core.c  |  3 +--
>  kernel/events/uprobes.c   |  8 
>  kernel/seccomp.c  |  7 +++
>  kernel/task_work.c|  3 +--
>  lib/assoc_array.c |  7 ---
>  mm/ksm.c  |  7 +++
>  mm/slab.h |  6 +++---
>  net/ipv4/netfilter/arp_tables.c   |  3 +--
>  net/ipv4/netfilter/ip_tables.c|  3 +--
>  net/ipv6/netfilter/ip6_tables.c   |  3 +--
>  net/rxrpc/ar-ack.c| 22 +-
>  security/keys/keyring.c   |  6 --
>  22 files changed, 50 insertions(+), 84 deletions(-)
> 
> -- 
> 1.9.1
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/16] crypto: caam - Remove unnecessary smp_read_barrier_depends()

2014-11-13 Thread Paul E. McKenney
On Thu, Nov 13, 2014 at 02:24:07PM -0500, Pranith Kumar wrote:
> Recently lockless_dereference() was added which can be used in place of
> hard-coding smp_read_barrier_depends(). The following PATCH makes the change.
> 
> Signed-off-by: Pranith Kumar 
> ---
>  drivers/crypto/caam/jr.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c
> index bae20d8..9b3ef1bc 100644
> --- a/drivers/crypto/caam/jr.c
> +++ b/drivers/crypto/caam/jr.c
> @@ -181,8 +181,6 @@ static void caam_jr_dequeue(unsigned long devarg)
>   for (i = 0; CIRC_CNT(head, tail + i, JOBR_DEPTH) >= 1; i++) {
>   sw_idx = (tail + i) & (JOBR_DEPTH - 1);
> 
> - smp_read_barrier_depends();
> -

Did you mean to add a lockless_dereference() somewhere?  I would guess
that one is required on the load into sw_idx before the "for" loop,
but I cannot claim to be familiar with this code.

Thanx, Paul

>   if (jrp->outring[hw_idx].desc ==
>   jrp->entinfo[sw_idx].desc_addr_dma)
>   break; /* found */
> @@ -218,7 +216,6 @@ static void caam_jr_dequeue(unsigned long devarg)
>   if (sw_idx == tail) {
>   do {
>   tail = (tail + 1) & (JOBR_DEPTH - 1);
> - smp_read_barrier_depends();
>   } while (CIRC_CNT(head, tail, JOBR_DEPTH) >= 1 &&
>jrp->entinfo[tail].desc_addr_dma == 0);
> 
> -- 
> 1.9.1
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 01/16] crypto: caam - Remove unnecessary smp_read_barrier_depends()

2014-11-13 Thread Kim Phillips
On Thu, 13 Nov 2014 16:51:12 -0500
Pranith Kumar  wrote:

> On 11/13/2014 03:10 PM, Paul E. McKenney wrote:
> > On Thu, Nov 13, 2014 at 02:24:07PM -0500, Pranith Kumar wrote:
> >> Recently lockless_dereference() was added which can be used in place of
> >> hard-coding smp_read_barrier_depends(). The following PATCH makes the 
> >> change.
> >>
> >> Signed-off-by: Pranith Kumar 
> >> ---
> >>  drivers/crypto/caam/jr.c | 3 ---
> >>  1 file changed, 3 deletions(-)
> >>
> >> diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c
> >> index bae20d8..9b3ef1bc 100644
> >> --- a/drivers/crypto/caam/jr.c
> >> +++ b/drivers/crypto/caam/jr.c
> >> @@ -181,8 +181,6 @@ static void caam_jr_dequeue(unsigned long devarg)
> >>for (i = 0; CIRC_CNT(head, tail + i, JOBR_DEPTH) >= 1; i++) {
> >>sw_idx = (tail + i) & (JOBR_DEPTH - 1);
> >>
> >> -  smp_read_barrier_depends();
> >> -
> > 
> > Did you mean to add a lockless_dereference() somewhere?  I would guess
> > that one is required on the load into sw_idx before the "for" loop,
> > but I cannot claim to be familiar with this code.
> 
> No, I could not understand why the barrier was here in the first place. The 
> change log does not reflect the subject line.
> 
> sw_idx is a local variable and is used to index the entinfo array. It does 
> not seem like the barrier is needed. If not a comment saying why could be 
> added I guess.

I likely misinterpreted the "read index before reading contents at
that index" instructions in early circular buffer documentation, and
left it in for the benefit of the doubt.  Now it looks to me it's not
necessary, given both sw_idx and tail are just being computed within
a lock, and removing both barriers doesn't affect the compiler
output, so:

Reviewed-by: Kim Phillips 

Thanks,

Kim
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH RFC 4/4] crypto: qat - Add new algif interface for userspace

2014-11-13 Thread Herbert Xu
On Fri, Nov 07, 2014 at 11:48:16AM -0800, Tadeusz Struk wrote:
>
> This way I can get much higher throughput than with algif_skcipher.

Yes that's a worthy optimisation.  See if you can change the
current implementation (without changing the interface) to achieve
this.

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH RFC 4/4] crypto: qat - Add new algif interface for userspace

2014-11-13 Thread Tadeusz Struk
Hi Herbert,
On 11/13/2014 05:19 PM, Herbert Xu wrote:
>> > This way I can get much higher throughput than with algif_skcipher.
> Yes that's a worthy optimisation.  See if you can change the
> current implementation (without changing the interface) to achieve
> this.
Ok, I'll have a look. What about the asymmetric algorithms?
Regards,
Tadeusz
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH RFC 4/4] crypto: qat - Add new algif interface for userspace

2014-11-13 Thread Herbert Xu
On Thu, Nov 13, 2014 at 05:25:29PM -0800, Tadeusz Struk wrote:
> Hi Herbert,
> On 11/13/2014 05:19 PM, Herbert Xu wrote:
> >> > This way I can get much higher throughput than with algif_skcipher.
> > Yes that's a worthy optimisation.  See if you can change the
> > current implementation (without changing the interface) to achieve
> > this.
> Ok, I'll have a look. What about the asymmetric algorithms?

I will be taking a look at them but it'll be a while before I
get some free time to do so.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] crypto: Documentation - document uncovered member variables

2014-11-13 Thread Stephan Mueller
Fix documentation typo for shash_alg->descsize.

Add documentation for initially uncovered member variables.

Signed-off-by: Stephan Mueller 
---
 include/crypto/hash.h | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/crypto/hash.h b/include/crypto/hash.h
index 3d66e8b..98abda9 100644
--- a/include/crypto/hash.h
+++ b/include/crypto/hash.h
@@ -38,6 +38,10 @@ struct crypto_ahash;
  *will save the partial state of the transformation into it. On the
  *other side, the @import function will load the state from a
  *buffer of this size as well.
+ * @base: Start of data structure of cipher algorithm. The common data
+ *   structure of crypto_alg contains information common to all ciphers.
+ *   The hash_alg_common data structure now adds the hash-specific
+ *   information.
  */
 struct hash_alg_common {
unsigned int digestsize;
@@ -114,6 +118,7 @@ struct ahash_request {
  * entire state of the ongoing transformation from a provided block of
  * data so the transformation can continue from this point onward. No
  * data processing happens at this point.
+ * @halg: see struct hash_alg_common
  */
 struct ahash_alg {
int (*init)(struct ahash_request *req);
@@ -153,7 +158,7 @@ struct shash_desc {
  * @setkey: see struct ahash_alg
  * @digestsize: see struct ahash_alg
  * @statesize: see struct ahash_alg
- * @dedcsize: Size of the operational state for the message digest. This state
+ * @descsize: Size of the operational state for the message digest. This state
  *   size is the memory size that needs to be allocated for
  *   shash_desc.__ctx
  * @base: internally used
-- 
2.1.0


--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html