All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] makedumpfile: Fix a bug when multi-threads feature meets enospace
@ 2018-01-29 12:54 Zhou Wenjian
  2018-02-08 11:53 ` Zhou Wenjian
  0 siblings, 1 reply; 6+ messages in thread
From: Zhou Wenjian @ 2018-01-29 12:54 UTC (permalink / raw)
  To: kexec; +Cc: ats-kumagai, Zhou Wenjian

Currently, when multi-threads feature meets enospace error,
the main thread will call pthread_join(). However, there is one
thread doing while{} and won't stop.

                pthread_mutex_lock(&info->page_data_mutex);
                while (page_data_buf[index].used != FALSE) {
                        index = (index + 1) % info->num_buffers;
                }
                page_data_buf[index].used = TRUE;
                pthread_mutex_unlock(&info->page_data_mutex);

Then makedumpfile hangs.

This patch add a cancel point in while{}.

Signed-off-by: Zhou Wenjian <zhouwj.fi@gmail.com>
---
 makedumpfile.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/makedumpfile.c b/makedumpfile.c
index ed138d3..f7ad50c 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -7731,11 +7731,13 @@ kdump_thread_function_cyclic(void *arg) {
 		buf_ready = FALSE;
 
 		pthread_mutex_lock(&info->page_data_mutex);
+		pthread_cleanup_push(pthread_mutex_unlock, &info->page_data_mutex);
 		while (page_data_buf[index].used != FALSE) {
+			pthread_testcancel();
 			index = (index + 1) % info->num_buffers;
 		}
 		page_data_buf[index].used = TRUE;
-		pthread_mutex_unlock(&info->page_data_mutex);
+		pthread_cleanup_pop(1); 
 
 		while (buf_ready == FALSE) {
 			pthread_testcancel();
-- 
1.8.3.1


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] makedumpfile: Fix a bug when multi-threads feature meets enospace
  2018-01-29 12:54 [PATCH] makedumpfile: Fix a bug when multi-threads feature meets enospace Zhou Wenjian
@ 2018-02-08 11:53 ` Zhou Wenjian
       [not found]   ` <61D4E5D821F1674CB87C99F080A210BE0117AC32@BPXM01GP.gisp.nec.co.jp>
  2018-02-16  2:45   ` Masaki Tachibana
  0 siblings, 2 replies; 6+ messages in thread
From: Zhou Wenjian @ 2018-02-08 11:53 UTC (permalink / raw)
  To: kexec; +Cc: ats-kumagai, Keiichirou Suzuki

ping...


On 01/29/2018 08:54 PM, Zhou Wenjian wrote:
> Currently, when multi-threads feature meets enospace error,
> the main thread will call pthread_join(). However, there is one
> thread doing while{} and won't stop.
>
>                  pthread_mutex_lock(&info->page_data_mutex);
>                  while (page_data_buf[index].used != FALSE) {
>                          index = (index + 1) % info->num_buffers;
>                  }
>                  page_data_buf[index].used = TRUE;
>                  pthread_mutex_unlock(&info->page_data_mutex);
>
> Then makedumpfile hangs.
>
> This patch add a cancel point in while{}.
>
> Signed-off-by: Zhou Wenjian <zhouwj.fi@gmail.com>
> ---
>   makedumpfile.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/makedumpfile.c b/makedumpfile.c
> index ed138d3..f7ad50c 100644
> --- a/makedumpfile.c
> +++ b/makedumpfile.c
> @@ -7731,11 +7731,13 @@ kdump_thread_function_cyclic(void *arg) {
>   		buf_ready = FALSE;
>   
>   		pthread_mutex_lock(&info->page_data_mutex);
> +		pthread_cleanup_push(pthread_mutex_unlock, &info->page_data_mutex);
>   		while (page_data_buf[index].used != FALSE) {
> +			pthread_testcancel();
>   			index = (index + 1) % info->num_buffers;
>   		}
>   		page_data_buf[index].used = TRUE;
> -		pthread_mutex_unlock(&info->page_data_mutex);
> +		pthread_cleanup_pop(1);
>   
>   		while (buf_ready == FALSE) {
>   			pthread_testcancel();

-- 
Thanks
Zhou


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* FW: [PATCH] makedumpfile: Fix a bug when multi-threads feature meets enospace
       [not found]   ` <61D4E5D821F1674CB87C99F080A210BE0117AC32@BPXM01GP.gisp.nec.co.jp>
@ 2018-02-09 11:23     ` Masahiko Hayashi
  2018-02-09 11:31     ` Masahiko Hayashi
  1 sibling, 0 replies; 6+ messages in thread
From: Masahiko Hayashi @ 2018-02-09 11:23 UTC (permalink / raw)
  To: Zhou Wenjian; +Cc: kexec

>-----Original Message-----
>From: Tachibana Masaki(橘 正樹)
>Sent: Friday, February 09, 2018 8:05 PM
>To: Zhou Wenjian <zhouwj.fi@gmail.com>
>Cc: kexec@lists.infradead.org; Hayashi Masahiko(林 正彦) <mas-hayashi@tg.jp.nec.com>
>Subject: RE: [PATCH] makedumpfile: Fix a bug when multi-threads feature meets enospace
>
>Hi Zhou,
>
>Sorry for the late reply.
>Makedumpfile team are busy now for another development.
>I'll reply in about a week.
>
>Thanks
>tachibana
>
>> -----Original Message-----
>> From: kexec [mailto:kexec-bounces@lists.infradead.org] On Behalf Of Zhou Wenjian
>> Sent: Thursday, February 08, 2018 8:53 PM
>> To: kexec@lists.infradead.org
>> Cc: Kumagai Atsushi <ats-kumagai@wm.jp.nec.com>; Suzuki Keiichirou <kei-suzuki@xr.jp.nec.com>
>> Subject: Re: [PATCH] makedumpfile: Fix a bug when multi-threads feature meets enospace
>>
>> ping...
>>
>>
>> On 01/29/2018 08:54 PM, Zhou Wenjian wrote:
>> > Currently, when multi-threads feature meets enospace error,
>> > the main thread will call pthread_join(). However, there is one
>> > thread doing while{} and won't stop.
>> >
>> >                  pthread_mutex_lock(&info->page_data_mutex);
>> >                  while (page_data_buf[index].used != FALSE) {
>> >                          index = (index + 1) % info->num_buffers;
>> >                  }
>> >                  page_data_buf[index].used = TRUE;
>> >                  pthread_mutex_unlock(&info->page_data_mutex);
>> >
>> > Then makedumpfile hangs.
>> >
>> > This patch add a cancel point in while{}.
>> >
>> > Signed-off-by: Zhou Wenjian <zhouwj.fi@gmail.com>
>> > ---
>> >   makedumpfile.c | 4 +++-
>> >   1 file changed, 3 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/makedumpfile.c b/makedumpfile.c
>> > index ed138d3..f7ad50c 100644
>> > --- a/makedumpfile.c
>> > +++ b/makedumpfile.c
>> > @@ -7731,11 +7731,13 @@ kdump_thread_function_cyclic(void *arg) {
>> >   		buf_ready = FALSE;
>> >
>> >   		pthread_mutex_lock(&info->page_data_mutex);
>> > +		pthread_cleanup_push(pthread_mutex_unlock, &info->page_data_mutex);
>> >   		while (page_data_buf[index].used != FALSE) {
>> > +			pthread_testcancel();
>> >   			index = (index + 1) % info->num_buffers;
>> >   		}
>> >   		page_data_buf[index].used = TRUE;
>> > -		pthread_mutex_unlock(&info->page_data_mutex);
>> > +		pthread_cleanup_pop(1);
>> >
>> >   		while (buf_ready == FALSE) {
>> >   			pthread_testcancel();
>>
>> --
>> Thanks
>> Zhou
>>
>>
>> _______________________________________________
>> kexec mailing list
>> kexec@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/kexec



_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* RE: [PATCH] makedumpfile: Fix a bug when multi-threads feature meets enospace
       [not found]   ` <61D4E5D821F1674CB87C99F080A210BE0117AC32@BPXM01GP.gisp.nec.co.jp>
  2018-02-09 11:23     ` FW: " Masahiko Hayashi
@ 2018-02-09 11:31     ` Masahiko Hayashi
  1 sibling, 0 replies; 6+ messages in thread
From: Masahiko Hayashi @ 2018-02-09 11:31 UTC (permalink / raw)
  To: Zhou Wenjian; +Cc: kexec

Hi  Zhou-san

I will forward Tachibana's mail.

Thank you

>-----Original Message-----
>From: Hayashi Masahiko(林 正彦)
>Sent: Friday, February 09, 2018 8:24 PM
>To: Zhou Wenjian <zhouwj.fi@gmail.com>
>Cc: kexec@lists.infradead.org
>Subject: FW: [PATCH] makedumpfile: Fix a bug when multi-threads feature meets enospace
>
>>-----Original Message-----
>>From: Tachibana Masaki(橘 正樹)
>>Sent: Friday, February 09, 2018 8:05 PM
>>To: Zhou Wenjian <zhouwj.fi@gmail.com>
>>Cc: kexec@lists.infradead.org; Hayashi Masahiko(林 正彦) <mas-hayashi@tg.jp.nec.com>
>>Subject: RE: [PATCH] makedumpfile: Fix a bug when multi-threads feature meets enospace
>>
>>Hi Zhou,
>>
>>Sorry for the late reply.
>>Makedumpfile team are busy now for another development.
>>I'll reply in about a week.
>>
>>Thanks
>>tachibana
>>
>>> -----Original Message-----
>>> From: kexec [mailto:kexec-bounces@lists.infradead.org] On Behalf Of Zhou Wenjian
>>> Sent: Thursday, February 08, 2018 8:53 PM
>>> To: kexec@lists.infradead.org
>>> Cc: Kumagai Atsushi <ats-kumagai@wm.jp.nec.com>; Suzuki Keiichirou <kei-suzuki@xr.jp.nec.com>
>>> Subject: Re: [PATCH] makedumpfile: Fix a bug when multi-threads feature meets enospace
>>>
>>> ping...
>>>
>>>
>>> On 01/29/2018 08:54 PM, Zhou Wenjian wrote:
>>> > Currently, when multi-threads feature meets enospace error,
>>> > the main thread will call pthread_join(). However, there is one
>>> > thread doing while{} and won't stop.
>>> >
>>> >                  pthread_mutex_lock(&info->page_data_mutex);
>>> >                  while (page_data_buf[index].used != FALSE) {
>>> >                          index = (index + 1) % info->num_buffers;
>>> >                  }
>>> >                  page_data_buf[index].used = TRUE;
>>> >                  pthread_mutex_unlock(&info->page_data_mutex);
>>> >
>>> > Then makedumpfile hangs.
>>> >
>>> > This patch add a cancel point in while{}.
>>> >
>>> > Signed-off-by: Zhou Wenjian <zhouwj.fi@gmail.com>
>>> > ---
>>> >   makedumpfile.c | 4 +++-
>>> >   1 file changed, 3 insertions(+), 1 deletion(-)
>>> >
>>> > diff --git a/makedumpfile.c b/makedumpfile.c
>>> > index ed138d3..f7ad50c 100644
>>> > --- a/makedumpfile.c
>>> > +++ b/makedumpfile.c
>>> > @@ -7731,11 +7731,13 @@ kdump_thread_function_cyclic(void *arg) {
>>> >   		buf_ready = FALSE;
>>> >
>>> >   		pthread_mutex_lock(&info->page_data_mutex);
>>> > +		pthread_cleanup_push(pthread_mutex_unlock, &info->page_data_mutex);
>>> >   		while (page_data_buf[index].used != FALSE) {
>>> > +			pthread_testcancel();
>>> >   			index = (index + 1) % info->num_buffers;
>>> >   		}
>>> >   		page_data_buf[index].used = TRUE;
>>> > -		pthread_mutex_unlock(&info->page_data_mutex);
>>> > +		pthread_cleanup_pop(1);
>>> >
>>> >   		while (buf_ready == FALSE) {
>>> >   			pthread_testcancel();
>>>
>>> --
>>> Thanks
>>> Zhou
>>>
>>>
>>> _______________________________________________
>>> kexec mailing list
>>> kexec@lists.infradead.org
>>> http://lists.infradead.org/mailman/listinfo/kexec



_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* RE: [PATCH] makedumpfile: Fix a bug when multi-threads feature meets enospace
  2018-02-08 11:53 ` Zhou Wenjian
       [not found]   ` <61D4E5D821F1674CB87C99F080A210BE0117AC32@BPXM01GP.gisp.nec.co.jp>
@ 2018-02-16  2:45   ` Masaki Tachibana
  2018-02-27 13:08     ` Zhou Wenjian
  1 sibling, 1 reply; 6+ messages in thread
From: Masaki Tachibana @ 2018-02-16  2:45 UTC (permalink / raw)
  To: kexec; +Cc: Masahiko Hayashi

Hi,

Atsushi Kumagai has retired, so other members will maintain makedumpfile.


Wenjian

Sorry for the late reply.
Your patch looks good to me.
I'll merge it into V1.6.4.

Thanks
tachibana


> -----Original Message-----
> From: kexec [mailto:kexec-bounces@lists.infradead.org] On Behalf Of Zhou Wenjian
> Sent: Thursday, February 08, 2018 8:53 PM
> To: kexec@lists.infradead.org
> Cc: Kumagai Atsushi() <ats-kumagai@wm.jp.nec.com>; Suzuki Keiichirou() <kei-suzuki@xr.jp.nec.com>
> Subject: Re: [PATCH] makedumpfile: Fix a bug when multi-threads feature meets enospace
> 
> ping...
> 
> 
> On 01/29/2018 08:54 PM, Zhou Wenjian wrote:
> > Currently, when multi-threads feature meets enospace error,
> > the main thread will call pthread_join(). However, there is one
> > thread doing while{} and won't stop.
> >
> >                  pthread_mutex_lock(&info->page_data_mutex);
> >                  while (page_data_buf[index].used != FALSE) {
> >                          index = (index + 1) % info->num_buffers;
> >                  }
> >                  page_data_buf[index].used = TRUE;
> >                  pthread_mutex_unlock(&info->page_data_mutex);
> >
> > Then makedumpfile hangs.
> >
> > This patch add a cancel point in while{}.
> >
> > Signed-off-by: Zhou Wenjian <zhouwj.fi@gmail.com>
> > ---
> >   makedumpfile.c | 4 +++-
> >   1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/makedumpfile.c b/makedumpfile.c
> > index ed138d3..f7ad50c 100644
> > --- a/makedumpfile.c
> > +++ b/makedumpfile.c
> > @@ -7731,11 +7731,13 @@ kdump_thread_function_cyclic(void *arg) {
> >   		buf_ready = FALSE;
> >
> >   		pthread_mutex_lock(&info->page_data_mutex);
> > +		pthread_cleanup_push(pthread_mutex_unlock, &info->page_data_mutex);
> >   		while (page_data_buf[index].used != FALSE) {
> > +			pthread_testcancel();
> >   			index = (index + 1) % info->num_buffers;
> >   		}
> >   		page_data_buf[index].used = TRUE;
> > -		pthread_mutex_unlock(&info->page_data_mutex);
> > +		pthread_cleanup_pop(1);
> >
> >   		while (buf_ready == FALSE) {
> >   			pthread_testcancel();
> 
> --
> Thanks
> Zhou
> 
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec



_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] makedumpfile: Fix a bug when multi-threads feature meets enospace
  2018-02-16  2:45   ` Masaki Tachibana
@ 2018-02-27 13:08     ` Zhou Wenjian
  0 siblings, 0 replies; 6+ messages in thread
From: Zhou Wenjian @ 2018-02-27 13:08 UTC (permalink / raw)
  To: Masaki Tachibana, kexec; +Cc: Masahiko Hayashi

Hi Tachibana,

Thanks for your reply.

And I do appreciate Kumagai-san's help these years.


On 02/16/2018 10:45 AM, Masaki Tachibana wrote:
> Hi,
>
> Atsushi Kumagai has retired, so other members will maintain makedumpfile.
>
>
> Wenjian
>
> Sorry for the late reply.
> Your patch looks good to me.
> I'll merge it into V1.6.4.
>
> Thanks
> tachibana
>
>
>> -----Original Message-----
>> From: kexec [mailto:kexec-bounces@lists.infradead.org] On Behalf Of Zhou Wenjian
>> Sent: Thursday, February 08, 2018 8:53 PM
>> To: kexec@lists.infradead.org
>> Cc: Kumagai Atsushi() <ats-kumagai@wm.jp.nec.com>; Suzuki Keiichirou() <kei-suzuki@xr.jp.nec.com>
>> Subject: Re: [PATCH] makedumpfile: Fix a bug when multi-threads feature meets enospace
>>
>> ping...
>>
>>
>> On 01/29/2018 08:54 PM, Zhou Wenjian wrote:
>>> Currently, when multi-threads feature meets enospace error,
>>> the main thread will call pthread_join(). However, there is one
>>> thread doing while{} and won't stop.
>>>
>>>                   pthread_mutex_lock(&info->page_data_mutex);
>>>                   while (page_data_buf[index].used != FALSE) {
>>>                           index = (index + 1) % info->num_buffers;
>>>                   }
>>>                   page_data_buf[index].used = TRUE;
>>>                   pthread_mutex_unlock(&info->page_data_mutex);
>>>
>>> Then makedumpfile hangs.
>>>
>>> This patch add a cancel point in while{}.
>>>
>>> Signed-off-by: Zhou Wenjian <zhouwj.fi@gmail.com>
>>> ---
>>>    makedumpfile.c | 4 +++-
>>>    1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/makedumpfile.c b/makedumpfile.c
>>> index ed138d3..f7ad50c 100644
>>> --- a/makedumpfile.c
>>> +++ b/makedumpfile.c
>>> @@ -7731,11 +7731,13 @@ kdump_thread_function_cyclic(void *arg) {
>>>    		buf_ready = FALSE;
>>>
>>>    		pthread_mutex_lock(&info->page_data_mutex);
>>> +		pthread_cleanup_push(pthread_mutex_unlock, &info->page_data_mutex);
>>>    		while (page_data_buf[index].used != FALSE) {
>>> +			pthread_testcancel();
>>>    			index = (index + 1) % info->num_buffers;
>>>    		}
>>>    		page_data_buf[index].used = TRUE;
>>> -		pthread_mutex_unlock(&info->page_data_mutex);
>>> +		pthread_cleanup_pop(1);
>>>
>>>    		while (buf_ready == FALSE) {
>>>    			pthread_testcancel();
>> --
>> Thanks
>> Zhou
>>
>>
>> _______________________________________________
>> kexec mailing list
>> kexec@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/kexec
>
>
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec
>

-- 
Thanks
Zhou


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

end of thread, other threads:[~2018-02-27 13:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-29 12:54 [PATCH] makedumpfile: Fix a bug when multi-threads feature meets enospace Zhou Wenjian
2018-02-08 11:53 ` Zhou Wenjian
     [not found]   ` <61D4E5D821F1674CB87C99F080A210BE0117AC32@BPXM01GP.gisp.nec.co.jp>
2018-02-09 11:23     ` FW: " Masahiko Hayashi
2018-02-09 11:31     ` Masahiko Hayashi
2018-02-16  2:45   ` Masaki Tachibana
2018-02-27 13:08     ` Zhou Wenjian

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.