[PATCH v6 0/2] IV Generation algorithms for dm-crypt

2017-06-21 Thread Binoy Jayan
ation for sub-requests using mempool v1 --> v2 -- 1. dm-crypt changes to process larger block sizes (one segment in a bio) 2. Incorporated changes w.r.t. comments from Herbert. Binoy Jayan (2): crypto: Add IV generation algorithms crypto: Multikey template for essiv drivers/md

[PATCH v6 1/2] crypto: Add IV generation algorithms

2017-06-21 Thread Binoy Jayan
to encrypt/decrypt a sector are processed sequentially. Asynchronous requests if processed in parallel, are freed in the async callback. The storage space for the initialization vectors are allocated in the iv generator implementations. Interface to the crypto layer - include/crypto/geniv.h Signed-off

[PATCH v6 2/2] crypto: Multikey template for essiv

2017-06-21 Thread Binoy Jayan
for which it was written for. The underlying IV generator 'essiv-aes-du512-dx' generates IV for every 512 byte blocks. Signed-off-by: Binoy Jayan --- drivers/md/dm-crypt.c|5 +- drivers/staging/ccree/Makefile |2 +- drivers/staging/ccr

[PATCH v4] HID: Remove the semaphore driver_lock

2017-06-14 Thread Binoy Jayan
The semaphore 'driver_lock' is used as a simple mutex, and also unnecessary as suggested by Arnd. Hence removing it, as the concurrency between the probe and remove is already handled in the driver core. Suggested-by: Arnd Bergmann Signed-off-by: Binoy Jayan Acked-by: Benjamin

[PATCH v3] HID: Replace semaphore driver_lock with mutex

2017-06-13 Thread Binoy Jayan
The semaphore 'driver_lock' is used as a simple mutex, and also unnecessary as suggested by Arnd. Hence removing it, as the concurrency between the probe and remove is already handled in the driver core. Suggested-by: Arnd Bergmann Signed-off-by: Binoy Jayan Acked-by: Benjamin

Re: [PATCH v2] HID: Replace semaphore driver_lock with mutex

2017-06-13 Thread Binoy Jayan
Hi, On 14 June 2017 at 01:55, Arnd Bergmann wrote: >> The mutex code clearly states mutex_trylock() must not be used in >> interrupt context (see kernel/locking/mutex.c), hence we used a >> semaphore here. Unless the mutex code is changed to allow this, we >> cannot switch away from semaphores.

Re: [PATCH v2 0/3] ngene: Replace semaphores with mutexes

2017-06-13 Thread Binoy Jayan
Hi Arnd, On 13 June 2017 at 15:19, Arnd Bergmann wrote: > On Tue, Jun 13, 2017 at 10:58 AM, Binoy Jayan wrote: >> These are a set of patches [v2] which removes semaphores from ngene. >> These are part of a bigger effort to eliminate unwanted semaphores >> from the linux

Re: [PATCH v2] HID: Replace semaphore driver_lock with mutex

2017-06-13 Thread Binoy Jayan
Hi Arnd, On 13 June 2017 at 15:15, Arnd Bergmann wrote: > Looks good to me, but I see you didn't include David and Andrew on > Cc, it would be good for at least one of them to provide an Ack as well. Will include them, thank you yet again for reminding me. > You forgot to actually drop the defi

Re: [PATCH v2] HID: Replace semaphore driver_lock with mutex

2017-06-13 Thread Binoy Jayan
Hi, On 13 June 2017 at 15:26, Benjamin Tissoires wrote: >> Looks good to me, but I see you didn't include David and Andrew on >> Cc, it would be good for at least one of them to provide an Ack as well. > > Please also CC linux-input@ Will do that. > (one more nitpick below too) > A little bit b

[PATCH v2] HID: Replace semaphore driver_lock with mutex

2017-06-13 Thread Binoy Jayan
The semaphore 'driver_lock' is used as a simple mutex, and also unnecessary as suggested by Arnd. Hence removing it, as the concurrency between the probe and remove is already handled in the driver core. Signed-off-by: Binoy Jayan Suggested-by: Arnd Bergmann --- v1 --> v2 Remove

[PATCH v2 3/3] media: ngene: Replace semaphore i2c_switch_mutex with mutex

2017-06-13 Thread Binoy Jayan
The semaphore 'i2c_switch_mutex' is used as a simple mutex, so it should be written as one. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- drivers/media/pci/ngene/ngene-core.c | 2 +- drivers/media/pci/ngene/ngene-i2c.c | 6 +++--- drivers/media/pci/nge

Re: [PATCH 1/3] media: ngene: Replace semaphore cmd_mutex with mutex

2017-06-13 Thread Binoy Jayan
Hi Arnd, On 9 June 2017 at 16:06, Arnd Bergmann wrote: >> Thank you for pointing out that. I'll check the >> concurrency part. By the way why do we need mutex_destoy? >> To debug an aberrate condition? > > At first I suspected the down() here was added for the same > purpose as a mutex_destroy:

[PATCH v2 1/3] media: ngene: Replace semaphore cmd_mutex with mutex

2017-06-13 Thread Binoy Jayan
The semaphore 'cmd_mutex' is used as a simple mutex, so it should be written as one. Also, replace down with mutex_destroy to ensure sane state when ngene_stop is called. Signed-off-by: Binoy Jayan --- drivers/media/pci/ngene/ngene-core.c | 12 ++-- drivers/media/pci/nge

[PATCH v2 0/3] ngene: Replace semaphores with mutexes

2017-06-13 Thread Binoy Jayan
c.c | 6 +++--- drivers/media/pci/ngene/ngene.h | 6 +++--- 3 files changed, 20 insertions(+), 24 deletions(-) -- Binoy Jayan

[PATCH v2 2/3] media: ngene: Replace semaphore stream_mutex with mutex

2017-06-13 Thread Binoy Jayan
The semaphore 'stream_mutex' is used as a simple mutex, so it should be written as one. Also moving the mutex_[lock/unlock] to the caller as it is anyway locked at the beginning of the callee thus avoiding repetition. Signed-off-by: Binoy Jayan --- drivers/media/pci/ngene/ngene-c

Re: [PATCH 1/3] media: ngene: Replace semaphore cmd_mutex with mutex

2017-06-08 Thread Binoy Jayan
On 8 June 2017 at 20:40, Arnd Bergmann wrote: > On Thu, Jun 8, 2017 at 12:04 PM, Binoy Jayan wrote: >> The semaphore 'cmd_mutex' is used as a simple mutex, so >> it should be written as one. Semaphores are going away in the future. >> >> Signed-off-by: Binoy

[PATCH 0/2] esas2r: Replace semaphores with mutexes

2017-06-08 Thread Binoy Jayan
These are a set of patches which removes semaphores from esas2r. These are part of a bigger effort to eliminate unwanted semaphores from the linux kernel. Binoy Jayan (2): scsi: esas2r: Replace semaphore fm_api_semaphore with mutex scsi: esas2r: Replace semaphore fs_api_semaphore with mutex

[PATCH 1/2] scsi: esas2r: Replace semaphore fm_api_semaphore with mutex

2017-06-08 Thread Binoy Jayan
The semaphore 'fm_api_semaphore' is used as a simple mutex, so it should be written as one. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- drivers/scsi/esas2r/esas2r.h | 2 +- drivers/scsi/esas2r/esas2r_init.c | 2 +- drivers/scsi/esas2r/esas2r_i

[PATCH 2/2] scsi: esas2r: Replace semaphore fs_api_semaphore with mutex

2017-06-08 Thread Binoy Jayan
The semaphore 'fs_api_semaphore' is used as a simple mutex, so it should be written as one. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- drivers/scsi/esas2r/esas2r.h | 2 +- drivers/scsi/esas2r/esas2r_init.c | 2 +- drivers/scsi/esas2r/esas2r_i

[PATCH 3/3] media: ngene: Replace semaphore i2c_switch_mutex with mutex

2017-06-08 Thread Binoy Jayan
The semaphore 'i2c_switch_mutex' is used as a simple mutex, so it should be written as one. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- drivers/media/pci/ngene/ngene-core.c | 2 +- drivers/media/pci/ngene/ngene-i2c.c | 6 +++--- drivers/media/pci/nge

[PATCH 1/3] media: ngene: Replace semaphore cmd_mutex with mutex

2017-06-08 Thread Binoy Jayan
The semaphore 'cmd_mutex' is used as a simple mutex, so it should be written as one. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- drivers/media/pci/ngene/ngene-core.c | 12 ++-- drivers/media/pci/ngene/ngene.h | 2 +- 2 files changed, 7 insert

[PATCH 2/3] media: ngene: Replace semaphore stream_mutex with mutex

2017-06-08 Thread Binoy Jayan
The semaphore 'stream_mutex' is used as a simple mutex, so it should be written as one. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- drivers/media/pci/ngene/ngene-core.c | 14 +++--- drivers/media/pci/ngene/ngene.h | 2 +- 2 files changed, 8

[PATCH 0/3] ngene: Replace semaphores with mutexes

2017-06-08 Thread Binoy Jayan
These are a set of patches which removes semaphores from ngene. These are part of a bigger effort to eliminate unwanted semaphores from the linux kernel. Binoy Jayan (3): media: ngene: Replace semaphore cmd_mutex with mutex media: ngene: Replace semaphore stream_mutex with mutex media

[PATCH] net: ethernet: micrel: ksz884x: Replace semaphore proc_sem with mutex

2017-06-08 Thread Binoy Jayan
The semaphore 'proc_sem' is used as a simple mutex, so it should be written as one. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- This patch is part of a bigger effort to eliminate unwanted semaphores from the linux kernel. drivers/net/ethernet/micrel/ksz8

[PATCH] mwifiex: Replace semaphore async_sem with mutex

2017-06-08 Thread Binoy Jayan
The semaphore 'async_sem' is used as a simple mutex, so it should be written as one. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- This patch is part of a bigger effort to eliminate unwanted semaphores from the linux kernel. drivers/net/wireless/marve

[PATCH] HID: Replace semaphore driver_lock with mutex

2017-06-08 Thread Binoy Jayan
The semaphore 'driver_lock' is used as a simple mutex, so it should be written as one. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- This patch is part of a bigger effort to eliminate unwanted semaphores from the linux kernel. drivers/hid/hid-c

[ACTIVITY] (Binoy Jayan) 2017-05-08 to 2017-05-15

2017-05-15 Thread Binoy Jayan
=== Binoy Jayan === === Highlights === dm-crypt optimization - No progress dm-crypt:store keys in secure storage - Read OPTEE ClientAPI specification to figure out how to communicate with optee from a client application - No examples available for using client api from kernel so need

Re: [RFC PATCH v5] IV Generation algorithms for dm-crypt

2017-04-13 Thread Binoy Jayan
Hi Milan, On 10 April 2017 at 19:30, Milan Broz wrote: Thank you for the reply. > Well, it is good that there is no performance degradation but it > would be nice to have some user of it that proves it is really > working for your hw. I have been able to get access to a hardware with IV genera

[RFC PATCH v5] crypto: Add IV generation algorithms

2017-04-07 Thread Binoy Jayan
ude/crypto/geniv.h Signed-off-by: Binoy Jayan --- drivers/md/dm-crypt.c | 1916 ++-- include/crypto/geniv.h | 47 ++ 2 files changed, 1424 insertions(+), 539 deletions(-) create mode 100644 include/crypto/geniv.h diff --git a/drivers/md/dm-crypt.c b/dri

[RFC PATCH v5] IV Generation algorithms for dm-crypt

2017-04-07 Thread Binoy Jayan
equests are processed in parallel and is freed in the async callback. 4. Changed allocation for sub-requests using mempool v1 --> v2 -- 1. dm-crypt changes to process larger block sizes (one segment in a bio) 2. Incorporated changes w.r.t. comments from Herbert. Binoy Jayan (1): crypto: A

Re: [RFC PATCH v4] IV Generation algorithms for dm-crypt

2017-03-20 Thread Binoy Jayan
On 6 March 2017 at 20:08, Gilad Ben-Yossef wrote: > > I gave it a spin on a x86_64 with 8 CPUs with AES-NI using cryptd and > on Arm using CryptoCell hardware accelerator. > > There was no difference in performance between 512 and 4096 bytes > cluster size on the x86_64 (800 MB loop file system)

Re: [RFC PATCH v4] IV Generation algorithms for dm-crypt

2017-02-21 Thread Binoy Jayan
Hi Herbert, On 8 February 2017 at 13:02, Gilad Ben-Yossef wrote: > On Tue, Feb 7, 2017 at 12:35 PM, Binoy Jayan wrote: >> === >> dm-crypt optimization for lar

Re: [RFC PATCH v4] IV Generation algorithms for dm-crypt

2017-02-09 Thread Binoy Jayan
On 8 February 2017 at 13:02, Gilad Ben-Yossef wrote: > > Ran Bonnie++ on it last night (Luks mode, plain64, Qemu Virt platform > Arm64) and it works just fine. > > Tested-by: Gilad Ben-Yossef > Hi Gilad, Thank you for testing it. Do you have access to a device having crypto hardware with IV ge

[RFC PATCH v4] crypto: Add IV generation algorithms

2017-02-07 Thread Binoy Jayan
ude/crypto/geniv.h Signed-off-by: Binoy Jayan --- drivers/md/dm-crypt.c | 1894 ++-- include/crypto/geniv.h | 47 ++ 2 files changed, 1402 insertions(+), 539 deletions(-) create mode 100644 include/crypto/geniv.h diff --git a/drivers/md/dm-crypt.c b/dri

[RFC PATCH v4] IV Generation algorithms for dm-crypt

2017-02-07 Thread Binoy Jayan
s are processed sequentially. Asynchronous requests are processed in parallel and is freed in the async callback. 4. Changed allocation for sub-requests using mempool v1 --> v2 -- 1. dm-crypt changes to process larger block sizes (one segment in a bio) 2. Incorporated changes w

Re: [RFC PATCH v3] crypto: Add IV generation algorithms

2017-01-19 Thread Binoy Jayan
Hi Gilad, On 19 January 2017 at 15:17, Gilad Ben-Yossef wrote: > I tried adding sg_init_table() where I thought it was appropriate and > it didn't resolve the issue. > > For what it's worth, my guess is that the difference between our > setups is not related to Arm but to other options or the sto

Re: [RFC PATCH v3] crypto: Add IV generation algorithms

2017-01-18 Thread Binoy Jayan
Hi Gilad, On 18 January 2017 at 20:51, Gilad Ben-Yossef wrote: > I have some review comments and a bug report - Thank you very much for testing this on ARM and for the comments. > I'm pretty sure this needs to be > > n2 = bio_segments(ctx->bio_out); Yes you are right, that was a typo :) >> +

[RFC PATCH v3] crypto: Add IV generation algorithms

2017-01-18 Thread Binoy Jayan
ude/crypto/geniv.h Signed-off-by: Binoy Jayan --- drivers/md/dm-crypt.c | 1891 ++-- include/crypto/geniv.h | 47 ++ 2 files changed, 1399 insertions(+), 539 deletions(-) create mode 100644 include/crypto/geniv.h diff --git a/drivers/md/dm-crypt.c b/dri

[RFC PATCH v3] IV Generation algorithms for dm-crypt

2017-01-18 Thread Binoy Jayan
allel and is freed in the async callback. 4. Changed allocation for sub-requests using mempool v1 --> v2 -- 1. dm-crypt changes to process larger block sizes (one segment in a bio) 2. Incorporated changes w.r.t. comments from Herbert. Binoy Jayan (1): crypto: Add IV generation algor

Re: [RFC PATCH v2] crypto: Add IV generation algorithms

2017-01-04 Thread Binoy Jayan
Hi Herbert, On 2 January 2017 at 12:23, Herbert Xu wrote: > On Mon, Jan 02, 2017 at 12:16:45PM +0530, Binoy Jayan wrote: > > Right. The actual number of underlying tfms that do the work > won't change compared to the status quo. We're just structuring > it such that

Re: [RFC PATCH v2] crypto: Add IV generation algorithms

2017-01-03 Thread Binoy Jayan
Hi Gilad, On 3 January 2017 at 19:53, Gilad Ben-Yossef wrote: > Good idea. I wanted to test the patch but alas it does not apply cleanly. > You seem to have a blank line at the end of files and other small > transgressions that makes checkpatch grumpy. I think that is because there were some key

Re: [RFC PATCH v2] crypto: Add IV generation algorithms

2017-01-01 Thread Binoy Jayan
On 2 January 2017 at 12:23, Herbert Xu wrote: > On Mon, Jan 02, 2017 at 12:16:45PM +0530, Binoy Jayan wrote: >> >> Even if ciphers are allocated this way, all the encryption requests >> for cbc should still go through IV generators? So that should mean, >> create o

Re: [RFC PATCH v2] crypto: Add IV generation algorithms

2017-01-01 Thread Binoy Jayan
Hi Herbert, On 30 December 2016 at 15:57, Herbert Xu wrote: > This is just a matter of structuring the key for the IV generator. > The IV generator's key in this case should be a combination of the > key to the underlying CBC plus the set of all keys for the IV > generator itself. It should the

Re: [RFC PATCH v2] crypto: Add IV generation algorithms

2016-12-29 Thread Binoy Jayan
crypt: add ability to use keys from the kernel key retention service On Thu, Dec 22, 2016 at 04:25:12PM +0530, Binoy Jayan wrote: > > > It doesn't have to live outside of dm-crypt. You can register > > these IV generators from there if you really want. > > Sorry, but I didn&

Re: [RFC PATCH v2] crypto: Add IV generation algorithms

2016-12-22 Thread Binoy Jayan
Hi Herbert, On 22 December 2016 at 14:25, Herbert Xu wrote: > On Tue, Dec 13, 2016 at 11:01:08AM +0100, Milan Broz wrote: >> >> By the move everything to cryptoAPI we are basically introducing some >> strange mix >> of IV and modes there, I wonder how this is going to be maintained. >> Anyway, H

Re: dm-crypt optimization

2016-12-22 Thread Binoy Jayan
Hi Milan, On 21 December 2016 at 18:17, Milan Broz wrote: > So the core problem is that your crypto accelerator can operate efficiently > only > with bigger batch sizes. Thank you for the reply. Yes, that would be rather an improvement when having bigger block sizes. > How big blocks your cry

dm-crypt optimization

2016-12-20 Thread Binoy Jayan
At a high level the goal is to maximize the size of data blocks that get passed to hardware accelerators, minimizing the overhead from setting up and tearing down operations in the hardware. Currently dm-crypt itself is a big blocker as it manually implements ESSIV and similar algorithms which allo

Re: [RFC PATCH v2] crypto: Add IV generation algorithms

2016-12-15 Thread Binoy Jayan
Hi Milan, On 13 December 2016 at 15:31, Milan Broz wrote: > I think that IV generators should not modify or read encrypted data directly, > it should only generate IV. I was trying to find more information about what you said and how a iv generator should be written. I saw two examples of IV ge

Re: [RFC PATCH v2] crypto: Add IV generation algorithms

2016-12-13 Thread Binoy Jayan
Hi Milan, Thank you for the reply. On 13 December 2016 at 15:31, Milan Broz wrote: > I really do not think the disk encryption key management should be moved > outside of dm-crypt. We cannot then change key structure later easily. Yes, I agree. but the key selection based on sector number rest

[RFC PATCH v2] crypto: Add IV generation algorithms

2016-12-13 Thread Binoy Jayan
from dm layer, each cipher instance set with a unique subkey (part of the bigger master key) and these instances themselves do not have access to each other's instances or contexts. This way, a single instance cannot encryt/decrypt a whole bio. This has to be fixed. Not-signed-off-by: Binoy

[RFC PATCH v2] IV Generation algorithms for dm-crypt

2016-12-13 Thread Binoy Jayan
count=1 cat out.txt mkfs.ext4 -j /dev/mapper/crypt_fun # Mount if fs creation succeeds mount -t ext4 /dev/mapper/crypt_fun /mnt <-- Use the encrypted file system --> umount /mnt cryptsetup luksClose crypt_fun cryptsetup luksRemoveKey /dev/sdb This seems to work well. The file system

Re: [RFC PATCH] crypto: Add IV generation algorithms

2016-11-28 Thread Binoy Jayan
Hi Herbert, On 29 November 2016 at 12:58, Herbert Xu wrote: > But that begs the question, who is supposed to use crypto_geniv_set_ctx? > I thought it was dm-crypt but your patch doesn't contain any uses > of it at all. No one is using it as of now. It was just a thought to pass context informati

Re: [RFC PATCH] crypto: Add IV generation algorithms

2016-11-28 Thread Binoy Jayan
On 28 November 2016 at 18:17, Herbert Xu wrote: > On Mon, Nov 21, 2016 at 03:40:09PM +0530, Binoy Jayan wrote: >> Currently, the iv generation algorithms are implemented in dm-crypt.c. >> The goal is to move these algorithms from the dm layer to the kernel >> crypto layer by

[RFC PATCH] crypto: Add IV generation algorithms

2016-11-21 Thread Binoy Jayan
and tcw. These templates are to be configured and has to be invoked as: crypto_alloc_skcipher("plain(cbc(aes))", 0, 0); crypto_alloc_skcipher("essiv(cbc(aes))", 0, 0); ... from the dm layer. Signed-off-by: Binoy Jayan --- crypto/Kconfig|8 + crypto/Makef

[RFC PATCH] IV Generation algorithms for dm-crypt

2016-11-21 Thread Binoy Jayan
ext4 /dev/mapper/crypt_fun /mnt <-- Use the encrypted file system --> umount /mnt cryptsetup luksClose crypt_fun cryptsetup luksRemoveKey /dev/sdb This seems to work well. The file system mounts successfully and the files written to in the file system remain persistent across reboots. Bino

[PATCH v5 2/9] IB/core: Replace semaphore sm_sem with an atomic wait

2016-11-20 Thread Binoy Jayan
The semaphore 'sm_sem' is used for an exclusive ownership of the device so model the same as an atomic variable with an associated wait_event. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- drivers/infiniband/core/user_mad.c | 20 ++-- 1 file c

[PATCH v5 5/9] IB/isert: Replace semaphore sem with completion

2016-11-20 Thread Binoy Jayan
t isert_np-pending in the same order in which they were enqueued (FIFO). So, convert it to struct completion. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- drivers/infiniband/ulp/isert/ib_isert.c | 6 +++--- drivers/infiniband/ulp/isert/ib_isert.h | 3 ++- 2 files changed, 5

[PATCH v5 4/9] IB/mthca: Replace semaphore poll_sem with mutex

2016-11-20 Thread Binoy Jayan
The semaphore 'poll_sem' is a simple mutex, so it should be written as one. Semaphores are going away in the future. So replace it with a mutex. Also, remove mutex_[un]lock from mthca_cmd_use_events and mthca_cmd_use_polling respectively. Signed-off-by: Binoy Jayan --- drivers/inf

[PATCH v5 6/9] IB/hns: Replace counting semaphore event_sem with wait_event

2016-11-20 Thread Binoy Jayan
Counting semaphores are going away in the future, so replace the semaphore mthca_cmd::event_sem with a conditional wait_event. Signed-off-by: Binoy Jayan --- drivers/infiniband/hw/hns/hns_roce_cmd.c| 46 - drivers/infiniband/hw/hns/hns_roce_device.h | 2 +- 2

[PATCH v5 7/9] IB/mthca: Replace counting semaphore event_sem with wait_event

2016-11-20 Thread Binoy Jayan
Counting semaphores are going away in the future, so replace the semaphore mthca_cmd::event_sem with a conditional wait_event. Signed-off-by: Binoy Jayan --- drivers/infiniband/hw/mthca/mthca_cmd.c | 47 ++--- drivers/infiniband/hw/mthca/mthca_dev.h | 3 ++- 2 files

[PATCH v5 8/9] IB/mlx5: Add helper mlx5_ib_post_send_wait

2016-11-20 Thread Binoy Jayan
the semaphore, which can then be rewritten to use something else. Signed-off-by: Binoy Jayan --- drivers/infiniband/hw/mlx5/mr.c | 115 +++- 1 file changed, 32 insertions(+), 83 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/h

[PATCH v5 9/9] IB/mlx5: Replace semaphore umr_common:sem with wait_event

2016-11-20 Thread Binoy Jayan
Remove semaphore umr_common:sem used to limit concurrent access to umr qp and introduce an atomic value 'users' to keep track of the same. Use a wait_event to block when the limit is reached. Signed-off-by: Binoy Jayan --- drivers/infiniband/hw/mlx5/main.c| 6 +- drivers/inf

[PATCH v5 3/9] IB/hns: Replace semaphore poll_sem with mutex

2016-11-20 Thread Binoy Jayan
The semaphore 'poll_sem' is a simple mutex, so it should be written as one. Semaphores are going away in the future. So replace it with a mutex. Also, remove mutex_[un]lock from mthca_cmd_use_events and mthca_cmd_use_polling respectively. Signed-off-by: Binoy Jayan --- drivers/infinib

[PATCH v5 1/9] IB/core: iwpm_nlmsg_request: Replace semaphore with completion

2016-11-20 Thread Binoy Jayan
Semaphore sem in iwpm_nlmsg_request is used as completion, so convert it to a struct completion type. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- drivers/infiniband/core/iwpm_msg.c | 8 drivers/infiniband/core/iwpm_util.c | 7 +++ drivers/infiniband

[PATCH v5 0/9] infiniband: Remove semaphores

2016-11-20 Thread Binoy Jayan
unting semaphore event_sem with wait condition IB/mthca: Replace counting semaphore event_sem with wait condition IB/mlx5: Replace counting semaphore sem with wait condition Thanks, Binoy Binoy Jayan (9): IB/core: iwpm_nlmsg_request: Replace semaphore with completion IB/core: Replace semap

Re: [PATCH v4 05/10] IB/isert: Replace semaphore sem with completion

2016-11-18 Thread Binoy Jayan
Hi Arnd, On 18 November 2016 at 14:28, Arnd Bergmann wrote: > On Friday, November 18, 2016 12:27:32 PM CET Binoy Jayan wrote: >> Hi Sagi, > I think you are right. This is behavior is actuallly documented in > Documentation/scheduler/completion.txt: Thanking for having a look.

Re: [PATCH v4 05/10] IB/isert: Replace semaphore sem with completion

2016-11-17 Thread Binoy Jayan
Hi Sagi, On 31 October 2016 at 02:42, Sagi Grimberg wrote: >> The semaphore 'sem' in isert_device is used as completion, so convert >> it to struct completion. Semaphores are going away in the future. > > > Umm, this is 100% *not* true. np->sem is designed as a counting to > sync the iscsi login

Re: [PATCH v4 10/10] IB/mlx5: Simplify completion into a wait_event

2016-11-06 Thread Binoy Jayan
Hi Linus, On 3 November 2016 at 21:07, Linus Torvalds wrote: > This is wrong. Will change it back. > Since that "umr_context" variable is on the stack, and you are waiting > for it to be fully done, it really should be a completion. Thank you for sharing your insight with wait_event and comple

Re: [PATCH v4 10/10] IB/mlx5: Simplify completion into a wait_event

2016-11-02 Thread Binoy Jayan
Hi, On 31 October 2016 at 02:47, Sagi Grimberg wrote: > How is this simpler? It is simpler in the sense that it is a light weight primitive and that only one thread waits on the event here. In our case since 'umr_context.done' is an "on stack" variable, and has only one thread waiting on that e

[PATCH v4 08/10] IB/mlx5: Add helper mlx5_ib_post_send_wait

2016-10-27 Thread Binoy Jayan
the semaphore, which can then be rewritten to use something else. Signed-off-by: Binoy Jayan --- drivers/infiniband/hw/mlx5/mr.c | 115 +++- 1 file changed, 32 insertions(+), 83 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/h

[PATCH v4 05/10] IB/isert: Replace semaphore sem with completion

2016-10-27 Thread Binoy Jayan
The semaphore 'sem' in isert_device is used as completion, so convert it to struct completion. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- drivers/infiniband/ulp/isert/ib_isert.c | 6 +++--- drivers/infiniband/ulp/isert/ib_isert.h | 3 ++- 2 files

[PATCH v4 09/10] IB/mlx5: Replace semaphore umr_common:sem with wait_event

2016-10-27 Thread Binoy Jayan
Remove semaphore umr_common:sem used to limit concurrent access to umr qp and introduce an atomic value 'users' to keep track of the same. Use a wait_event to block when the limit is reached. Signed-off-by: Binoy Jayan --- drivers/infiniband/hw/mlx5/main.c| 6 +- drivers/inf

[PATCH v4 04/10] IB/mthca: Replace semaphore poll_sem with mutex

2016-10-27 Thread Binoy Jayan
The semaphore 'poll_sem' is a simple mutex, so it should be written as one. Semaphores are going away in the future. So replace it with a mutex. Also, remove mutex_[un]lock from mthca_cmd_use_events and mthca_cmd_use_polling respectively. Signed-off-by: Binoy Jayan --- drivers/inf

[PATCH v4 10/10] IB/mlx5: Simplify completion into a wait_event

2016-10-27 Thread Binoy Jayan
Convert the completion 'mlx5_ib_umr_context:done' to a wait_event as it just waits for the return value to be filled. Signed-off-by: Binoy Jayan --- drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 +- drivers/infiniband/hw/mlx5/mr.c | 9 + include/rdma/ib_verbs.h

[PATCH v4 07/10] IB/mthca: Replace counting semaphore event_sem with wait_event

2016-10-27 Thread Binoy Jayan
Counting semaphores are going away in the future, so replace the semaphore mthca_cmd::event_sem with a conditional wait_event. Signed-off-by: Binoy Jayan --- drivers/infiniband/hw/mthca/mthca_cmd.c | 47 ++--- drivers/infiniband/hw/mthca/mthca_dev.h | 3 ++- 2 files

[PATCH v4 02/10] IB/core: Replace semaphore sm_sem with an atomic wait

2016-10-27 Thread Binoy Jayan
The semaphore 'sm_sem' is used for an exclusive ownership of the device so model the same as an atomic variable with an associated wait_event. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- drivers/infiniband/core/user_mad.c | 20 ++-- 1 file c

[PATCH v4 00/10] infiniband: Remove semaphores

2016-10-27 Thread Binoy Jayan
eon Romanovsky Thanks, Binoy Binoy Jayan (10): IB/core: iwpm_nlmsg_request: Replace semaphore with completion IB/core: Replace semaphore sm_sem with an atomic wait IB/hns: Replace semaphore poll_sem with mutex IB/mthca: Replace semaphore poll_sem with mutex IB/isert: Replace semaphore sem w

[PATCH v4 06/10] IB/hns: Replace counting semaphore event_sem with wait_event

2016-10-27 Thread Binoy Jayan
Counting semaphores are going away in the future, so replace the semaphore mthca_cmd::event_sem with a conditional wait_event. Signed-off-by: Binoy Jayan --- drivers/infiniband/hw/hns/hns_roce_cmd.c| 46 - drivers/infiniband/hw/hns/hns_roce_device.h | 2 +- 2

[PATCH v4 03/10] IB/hns: Replace semaphore poll_sem with mutex

2016-10-27 Thread Binoy Jayan
The semaphore 'poll_sem' is a simple mutex, so it should be written as one. Semaphores are going away in the future. So replace it with a mutex. Also, remove mutex_[un]lock from mthca_cmd_use_events and mthca_cmd_use_polling respectively. Signed-off-by: Binoy Jayan --- drivers/infinib

[PATCH v4 01/10] IB/core: iwpm_nlmsg_request: Replace semaphore with completion

2016-10-27 Thread Binoy Jayan
Semaphore sem in iwpm_nlmsg_request is used as completion, so convert it to a struct completion type. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- drivers/infiniband/core/iwpm_msg.c | 8 drivers/infiniband/core/iwpm_util.c | 7 +++ drivers/infiniband

Re: [PATCH v2 8/8] IB/mlx5: Add helper mlx5_ib_post_send_wait

2016-10-26 Thread Binoy Jayan
On 27 October 2016 at 11:35, Leon Romanovsky wrote: > On Tue, Oct 25, 2016 at 06:46:58PM +0530, Binoy Jayan wrote: >> On 25 October 2016 at 17:56, Leon Romanovsky wrote: >> > On Tue, Oct 25, 2016 at 05:31:59PM +0530, Binoy Jayan wrote: >> >> > In case of suc

[PATCH v3 0/9] infiniband: Remove semaphores

2016-10-26 Thread Binoy Jayan
/hns: Restructure hns_roce_cmd.c to manage free_head IB/core: Convert completion to wait_event IB/mlx5: Simplify completion into a wait_event Thanks, Binoy Binoy Jayan (9): IB/core: iwpm_nlmsg_request: Replace semaphore with completion IB/core: Replace semaphore sm_sem with an atomic wait

[PATCH v3 5/9] IB/isert: Replace semaphore sem with completion

2016-10-26 Thread Binoy Jayan
The semaphore 'sem' in isert_device is used as completion, so convert it to struct completion. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- drivers/infiniband/ulp/isert/ib_isert.c | 6 +++--- drivers/infiniband/ulp/isert/ib_isert.h | 3 ++- 2 files

[PATCH v3 7/9] IB/mthca: Replace counting semaphore event_sem with wait_event

2016-10-26 Thread Binoy Jayan
Counting semaphores are going away in the future, so replace the semaphore mthca_cmd::event_sem with a conditional wait_event. Signed-off-by: Binoy Jayan --- drivers/infiniband/hw/mthca/mthca_cmd.c | 45 ++--- drivers/infiniband/hw/mthca/mthca_dev.h | 3 ++- 2 files

[PATCH v3 6/9] IB/hns: Replace counting semaphore event_sem with wait_event

2016-10-26 Thread Binoy Jayan
Counting semaphores are going away in the future, so replace the semaphore mthca_cmd::event_sem with a conditional wait_event. Signed-off-by: Binoy Jayan --- drivers/infiniband/hw/hns/hns_roce_cmd.c| 44 - drivers/infiniband/hw/hns/hns_roce_device.h | 2 +- 2

[PATCH v3 9/9] IB/mlx5: Simplify completion into a wait_event

2016-10-26 Thread Binoy Jayan
Convert the completion 'mlx5_ib_umr_context:done' to a wait_event as it just waits for the return value to be filled. Signed-off-by: Binoy Jayan --- drivers/infiniband/hw/mlx5/mlx5_ib.h | 2 +- drivers/infiniband/hw/mlx5/mr.c | 7 --- include/rdma/ib_verbs.h

[PATCH v3 4/9] IB/mthca: Replace semaphore poll_sem with mutex

2016-10-26 Thread Binoy Jayan
The semaphore 'poll_sem' is a simple mutex, so it should be written as one. Semaphores are going away in the future. So replace the semaphore 'poll_sem' with a mutex. Also, remove mutex_[un]lock from mthca_cmd_use_events and mthca_cmd_use_polling respectively. Signed

[PATCH v3 8/9] IB/mlx5: Add helper mlx5_ib_post_send_wait

2016-10-26 Thread Binoy Jayan
the semaphore, which can then be rewritten to use something else. Signed-off-by: Binoy Jayan --- drivers/infiniband/hw/mlx5/mr.c | 115 +++- 1 file changed, 32 insertions(+), 83 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/h

[PATCH v3 3/9] IB/hns: Replace semaphore poll_sem with mutex

2016-10-26 Thread Binoy Jayan
The semaphore 'poll_sem' is a simple mutex, so it should be written as one. Semaphores are going away in the future. So replace the semaphore 'poll_sem' with a mutex. Also, remove mutex_[un]lock from mthca_cmd_use_events and mthca_cmd_use_polling respectively. Signed

[PATCH v3 2/9] IB/core: Replace semaphore sm_sem with an atomic wait

2016-10-26 Thread Binoy Jayan
The semaphore 'sm_sem' is used for an exclusive ownership of the device so model the same as an atomic variable with an associated wait_event. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- drivers/infiniband/core/user_mad.c | 20 ++-- 1 file c

[PATCH v3 1/9] IB/core: iwpm_nlmsg_request: Replace semaphore with completion

2016-10-26 Thread Binoy Jayan
Semaphore sem in iwpm_nlmsg_request is used as completion, so convert it to a struct completion type. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- drivers/infiniband/core/iwpm_msg.c | 8 drivers/infiniband/core/iwpm_util.c | 7 +++ drivers/infiniband

Re: [PATCH v2 2/8] IB/core: Replace semaphore sm_sem with completion

2016-10-25 Thread Binoy Jayan
On 25 October 2016 at 18:13, Jack Wang wrote: > Hi Binoy, > > snip >> >> port->ib_dev = device; >> port->port_num = port_num; >> - sema_init(&port->sm_sem, 1); >> + init_completion(&port->sm_comp); >> + complete(&port->sm_comp); > > Why complete here? > >>

Re: [PATCH v2 6/8] IB/hns: Replace counting semaphore event_sem with wait_event

2016-10-25 Thread Binoy Jayan
On 25 October 2016 at 18:51, Arnd Bergmann wrote: > On Tuesday, October 25, 2016 6:29:45 PM CEST Binoy Jayan wrote: > > Something like > > static struct hns_roce_cmd_context *hns_roce_try_get_context(struct > hns_roce_cmdq *cmd) > { > struct hns_roce_cmd

Re: [PATCH v2 8/8] IB/mlx5: Add helper mlx5_ib_post_send_wait

2016-10-25 Thread Binoy Jayan
On 25 October 2016 at 17:56, Leon Romanovsky wrote: > On Tue, Oct 25, 2016 at 05:31:59PM +0530, Binoy Jayan wrote: > In case of success (err == 0), you will call to unmap_dma instead of > normal flow. > > NAK, > Leon Romanovsky Hi Loen, Even in the original code, the reg

Re: [PATCH v2 6/8] IB/hns: Replace counting semaphore event_sem with wait_event

2016-10-25 Thread Binoy Jayan
On 25 October 2016 at 17:58, Arnd Bergmann wrote: > On Tuesday, October 25, 2016 5:31:57 PM CEST Binoy Jayan wrote: >> static int __hns_roce_cmd_mbox_wait(struct hns_roce_dev *hr_dev, u64 >> in_param, >> u64 out_param, unsigned long in_mo

Re: [PATCH v2 8/8] IB/mlx5: Add helper mlx5_ib_post_send_wait

2016-10-25 Thread Binoy Jayan
On 25 October 2016 at 17:53, Arnd Bergmann wrote: > On Tuesday, October 25, 2016 5:31:59 PM CEST Binoy Jayan wrote: > Looks reasonable. Thank you Arnd for looking at it again. > Did you get a warning about 'bad' being unused here? I would have > guessed not, since the orig

[PATCH v2 7/8] IB/mthca: Replace counting semaphore event_sem with wait_event

2016-10-25 Thread Binoy Jayan
Counting semaphores are going away in the future, so replace the semaphore mthca_cmd::event_sem with a conditional wait_event. Signed-off-by: Binoy Jayan --- drivers/infiniband/hw/mthca/mthca_cmd.c | 37 - drivers/infiniband/hw/mthca/mthca_dev.h | 3 ++- 2 files

[PATCH v2 3/8] IB/hns: Replace semaphore poll_sem with mutex

2016-10-25 Thread Binoy Jayan
The semaphore 'poll_sem' is a simple mutex, so it should be written as one. Semaphores are going away in the future. So replace the semaphore 'poll_sem' with a mutex. Also, remove mutex_[un]lock from mthca_cmd_use_events and mthca_cmd_use_polling respectively. Signed

[PATCH v2 1/8] IB/core: iwpm_nlmsg_request: Replace semaphore with completion

2016-10-25 Thread Binoy Jayan
Semaphore sem in iwpm_nlmsg_request is used as completion, so convert it to a struct completion type. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- drivers/infiniband/core/iwpm_msg.c | 8 drivers/infiniband/core/iwpm_util.c | 7 +++ drivers/infiniband

[PATCH v2 5/8] IB/isert: Replace semaphore sem with completion

2016-10-25 Thread Binoy Jayan
The semaphore 'sem' in isert_device is used as completion, so convert it to struct completion. Semaphores are going away in the future. Signed-off-by: Binoy Jayan --- drivers/infiniband/ulp/isert/ib_isert.c | 6 +++--- drivers/infiniband/ulp/isert/ib_isert.h | 3 ++- 2 files

  1   2   3   >