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]
Date:	Thu, 25 Aug 2011 19:57:30 +0530
From:	"Koul, Vinod" <vinod.koul@...el.com>
To:	Guennadi Liakhovetski <g.liakhovetski@....de>,
	Dan Williams <dan.j.williams@...el.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] dmatest: make dmatest threads freezable

On Thu, 2011-08-18 at 16:50 +0200, Guennadi Liakhovetski wrote:
> Making dmatest threads freezable allows its use for system PM testing.
> 
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@....de>
Looks good to me, Dan if you give me your ack, I will carry this in my
tree

-- 
~Vinod
> ---
>  drivers/dma/dmatest.c |   17 +++++++++++++++--
>  1 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
> index 765f5ff..fc0ea6c 100644
> --- a/drivers/dma/dmatest.c
> +++ b/drivers/dma/dmatest.c
> @@ -10,6 +10,7 @@
>  #include <linux/delay.h>
>  #include <linux/dma-mapping.h>
>  #include <linux/dmaengine.h>
> +#include <linux/freezer.h>
>  #include <linux/init.h>
>  #include <linux/kthread.h>
>  #include <linux/module.h>
> @@ -251,6 +252,7 @@ static int dmatest_func(void *data)
>  	int			i;
>  
>  	thread_name = current->comm;
> +	set_freezable_with_signal();
>  
>  	ret = -ENOMEM;
>  
> @@ -305,7 +307,8 @@ static int dmatest_func(void *data)
>  		dma_addr_t dma_srcs[src_cnt];
>  		dma_addr_t dma_dsts[dst_cnt];
>  		struct completion cmp;
> -		unsigned long tmo = msecs_to_jiffies(timeout);
> +		unsigned long start, tmo, end = 0 /* compiler... */;
> +		bool reload = true;
>  		u8 align = 0;
>  
>  		total_tests++;
> @@ -404,7 +407,17 @@ static int dmatest_func(void *data)
>  		}
>  		dma_async_issue_pending(chan);
>  
> -		tmo = wait_for_completion_timeout(&cmp, tmo);
> +		do {
> +			start = jiffies;
> +			if (reload)
> +				end = start + msecs_to_jiffies(timeout);
> +			else if (end <= start)
> +				end = start + 1;
> +			tmo = wait_for_completion_interruptible_timeout(&cmp,
> +								end - start);
> +			reload = try_to_freeze();
> +		} while (tmo == -ERESTARTSYS);
> +
>  		status = dma_async_is_tx_complete(chan, cookie, NULL, NULL);
>  
>  		if (tmo == 0) {


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ