linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC/PATCH] PM / Hibernate : Add wait for disk detection if resume_file is MAJOR:MINOR style
@ 2012-05-07  8:26 Minho Ban
  2012-05-07 19:39 ` Rafael J. Wysocki
  2012-05-09  6:12 ` Srivatsa S. Bhat
  0 siblings, 2 replies; 7+ messages in thread
From: Minho Ban @ 2012-05-07  8:26 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Len Brown, Pavel Machek, linux-pm, linux-kernel

name_to_dev_t is not enough to check device detection when the resume_file is
MAJOR:MINOR format. get_gendisk is needed in that case.

Signed-off-by: Minho Ban <mhban@samsung.com>
---
 kernel/power/hibernate.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index e09dfbf..27efaef 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -25,6 +25,8 @@
 #include <linux/freezer.h>
 #include <linux/gfp.h>
 #include <linux/syscore_ops.h>
+#include <linux/ctype.h>
+#include <linux/genhd.h>
 #include <scsi/scsi_scan.h>
 
 #include "power.h"
@@ -749,6 +751,14 @@ static int software_resume(void)
 		}
 	}
 
+	/* name_to_dev_t is ineffective if resume_file comes in major:minor
+	 * format */
+	if (isdigit(resume_file[0]) && resume_wait) {
+		int partno;
+		while (!get_gendisk(swsusp_resume_device, &partno))
+			msleep(10);
+	}
+
  Check_image:
 	pr_debug("PM: Hibernation image partition %d:%d present\n",
 		MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device));
-- 
1.7.5.4


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

* Re: [RFC/PATCH] PM / Hibernate : Add wait for disk detection if resume_file is MAJOR:MINOR style
  2012-05-07  8:26 [RFC/PATCH] PM / Hibernate : Add wait for disk detection if resume_file is MAJOR:MINOR style Minho Ban
@ 2012-05-07 19:39 ` Rafael J. Wysocki
  2012-05-07 23:56   ` Minho Ban
  2012-05-09  6:12 ` Srivatsa S. Bhat
  1 sibling, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2012-05-07 19:39 UTC (permalink / raw)
  To: Minho Ban, Pavel Machek; +Cc: linux-pm, linux-kernel

On Monday, May 07, 2012, Minho Ban wrote:
> name_to_dev_t is not enough to check device detection when the resume_file is
> MAJOR:MINOR format.

It's not assumed to be in that format, although I suppose we can add the
possibility to specify it this way.

> get_gendisk is needed in that case.
> 
> Signed-off-by: Minho Ban <mhban@samsung.com>
> ---
>  kernel/power/hibernate.c |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
> index e09dfbf..27efaef 100644
> --- a/kernel/power/hibernate.c
> +++ b/kernel/power/hibernate.c
> @@ -25,6 +25,8 @@
>  #include <linux/freezer.h>
>  #include <linux/gfp.h>
>  #include <linux/syscore_ops.h>
> +#include <linux/ctype.h>
> +#include <linux/genhd.h>
>  #include <scsi/scsi_scan.h>
>  
>  #include "power.h"
> @@ -749,6 +751,14 @@ static int software_resume(void)
>  		}
>  	}
>  
> +	/* name_to_dev_t is ineffective if resume_file comes in major:minor
> +	 * format */
> +	if (isdigit(resume_file[0]) && resume_wait) {

The check here is too late.  It should be done before name_to_dev_t() is
used on resume_file for the first time.

> +		int partno;
> +		while (!get_gendisk(swsusp_resume_device, &partno))
> +			msleep(10);
> +	}
> +
>   Check_image:
>  	pr_debug("PM: Hibernation image partition %d:%d present\n",
>  		MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device));

Besides, I'd like the documentation to be updated to reflect this change too.

Thanks,
Rafael

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

* Re: [RFC/PATCH] PM / Hibernate : Add wait for disk detection if resume_file is MAJOR:MINOR style
  2012-05-07 19:39 ` Rafael J. Wysocki
@ 2012-05-07 23:56   ` Minho Ban
  2012-05-08 21:28     ` Rafael J. Wysocki
  0 siblings, 1 reply; 7+ messages in thread
From: Minho Ban @ 2012-05-07 23:56 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Pavel Machek, linux-pm, linux-kernel

On 05/08/2012 04:39 AM, Rafael J. Wysocki wrote:
>> +	/* name_to_dev_t is ineffective if resume_file comes in major:minor
>> +	 * format */
>> +	if (isdigit(resume_file[0]) && resume_wait) {
> 
> The check here is too late.  It should be done before name_to_dev_t() is
> used on resume_file for the first time.
> 

Thanks for comment, I'll pull it up.

>> +		int partno;
>> +		while (!get_gendisk(swsusp_resume_device, &partno))
>> +			msleep(10);
>> +	}
>> +
>>   Check_image:
>>  	pr_debug("PM: Hibernation image partition %d:%d present\n",
>>  		MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device));
> 
> Besides, I'd like the documentation to be updated to reflect this change too.

Do you mean resumewait is needed to be updated in kernel-parameters.txt?



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

* Re: [RFC/PATCH] PM / Hibernate : Add wait for disk detection if resume_file is MAJOR:MINOR style
  2012-05-07 23:56   ` Minho Ban
@ 2012-05-08 21:28     ` Rafael J. Wysocki
  2012-05-09  8:03       ` Minho Ban
  0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2012-05-08 21:28 UTC (permalink / raw)
  To: Minho Ban; +Cc: Pavel Machek, linux-pm, linux-kernel

On Tuesday, May 08, 2012, Minho Ban wrote:
> On 05/08/2012 04:39 AM, Rafael J. Wysocki wrote:
> >> +	/* name_to_dev_t is ineffective if resume_file comes in major:minor
> >> +	 * format */
> >> +	if (isdigit(resume_file[0]) && resume_wait) {
> > 
> > The check here is too late.  It should be done before name_to_dev_t() is
> > used on resume_file for the first time.
> > 
> 
> Thanks for comment, I'll pull it up.
> 
> >> +		int partno;
> >> +		while (!get_gendisk(swsusp_resume_device, &partno))
> >> +			msleep(10);
> >> +	}
> >> +
> >>   Check_image:
> >>  	pr_debug("PM: Hibernation image partition %d:%d present\n",
> >>  		MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device));
> > 
> > Besides, I'd like the documentation to be updated to reflect this change too.
> 
> Do you mean resumewait is needed to be updated in kernel-parameters.txt?

No, but it should be decumented what exactly is to be passed in
the resume= command line option (in kernel-parameters.txt).  Please do that
when you're at it.

Thanks,
Rafael

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

* Re: [RFC/PATCH] PM / Hibernate : Add wait for disk detection if resume_file is MAJOR:MINOR style
  2012-05-07  8:26 [RFC/PATCH] PM / Hibernate : Add wait for disk detection if resume_file is MAJOR:MINOR style Minho Ban
  2012-05-07 19:39 ` Rafael J. Wysocki
@ 2012-05-09  6:12 ` Srivatsa S. Bhat
  2012-05-09  8:03   ` Minho Ban
  1 sibling, 1 reply; 7+ messages in thread
From: Srivatsa S. Bhat @ 2012-05-09  6:12 UTC (permalink / raw)
  To: Minho Ban
  Cc: Rafael J. Wysocki, Len Brown, Pavel Machek, linux-pm, linux-kernel

On 05/07/2012 01:56 PM, Minho Ban wrote:

> name_to_dev_t is not enough to check device detection when the resume_file is
> MAJOR:MINOR format. get_gendisk is needed in that case.
> 
> Signed-off-by: Minho Ban <mhban@samsung.com>
> ---
>  kernel/power/hibernate.c |   10 ++++++++++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
> index e09dfbf..27efaef 100644
> --- a/kernel/power/hibernate.c
> +++ b/kernel/power/hibernate.c
> @@ -25,6 +25,8 @@
>  #include <linux/freezer.h>
>  #include <linux/gfp.h>
>  #include <linux/syscore_ops.h>
> +#include <linux/ctype.h>
> +#include <linux/genhd.h>
>  #include <scsi/scsi_scan.h>
> 
>  #include "power.h"
> @@ -749,6 +751,14 @@ static int software_resume(void)
>  		}
>  	}
> 
> +	/* name_to_dev_t is ineffective if resume_file comes in major:minor
> +	 * format */


Nitpick: Multi-line comments should be of the form:

/*
 * name_to_dev_t is ineffective....
 * ....... major:minor format
 */

Regards,
Srivatsa S. Bhat

> +	if (isdigit(resume_file[0]) && resume_wait) {
> +		int partno;
> +		while (!get_gendisk(swsusp_resume_device, &partno))
> +			msleep(10);
> +	}
> +
>   Check_image:
>  	pr_debug("PM: Hibernation image partition %d:%d present\n",
>  		MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device));


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

* Re: [RFC/PATCH] PM / Hibernate : Add wait for disk detection if resume_file is MAJOR:MINOR style
  2012-05-08 21:28     ` Rafael J. Wysocki
@ 2012-05-09  8:03       ` Minho Ban
  0 siblings, 0 replies; 7+ messages in thread
From: Minho Ban @ 2012-05-09  8:03 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Pavel Machek, linux-pm, linux-kernel

On 05/09/2012 06:28 AM, Rafael J. Wysocki wrote:
> On Tuesday, May 08, 2012, Minho Ban wrote:
>> On 05/08/2012 04:39 AM, Rafael J. Wysocki wrote:
>>>> +		int partno;
>>>> +		while (!get_gendisk(swsusp_resume_device, &partno))
>>>> +			msleep(10);
>>>> +	}
>>>> +
>>>>   Check_image:
>>>>  	pr_debug("PM: Hibernation image partition %d:%d present\n",
>>>>  		MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device));
>>>
>>> Besides, I'd like the documentation to be updated to reflect this change too.
>>
>> Do you mean resumewait is needed to be updated in kernel-parameters.txt?
> 
> No, but it should be decumented what exactly is to be passed in
> the resume= command line option (in kernel-parameters.txt).  Please do that
> when you're at it.
> 
> Thanks,
> Rafael
> 

OK, I'll add some comment on the resume= to clarify what partition format could be 
used.

Regards,
Minho Ban

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

* Re: [RFC/PATCH] PM / Hibernate : Add wait for disk detection if resume_file is MAJOR:MINOR style
  2012-05-09  6:12 ` Srivatsa S. Bhat
@ 2012-05-09  8:03   ` Minho Ban
  0 siblings, 0 replies; 7+ messages in thread
From: Minho Ban @ 2012-05-09  8:03 UTC (permalink / raw)
  To: Srivatsa S. Bhat
  Cc: Rafael J. Wysocki, Len Brown, Pavel Machek, linux-pm, linux-kernel

On 05/09/2012 03:12 PM, Srivatsa S. Bhat wrote:
> On 05/07/2012 01:56 PM, Minho Ban wrote:
>> +	/* name_to_dev_t is ineffective if resume_file comes in major:minor
>> +	 * format */
> 
> 
> Nitpick: Multi-line comments should be of the form:
> 
> /*
>  * name_to_dev_t is ineffective....
>  * ....... major:minor format
>  */
> 

Thank you for pointing this out. I'll fix it.

Regards,
Minho Ban

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

end of thread, other threads:[~2012-05-09  8:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-07  8:26 [RFC/PATCH] PM / Hibernate : Add wait for disk detection if resume_file is MAJOR:MINOR style Minho Ban
2012-05-07 19:39 ` Rafael J. Wysocki
2012-05-07 23:56   ` Minho Ban
2012-05-08 21:28     ` Rafael J. Wysocki
2012-05-09  8:03       ` Minho Ban
2012-05-09  6:12 ` Srivatsa S. Bhat
2012-05-09  8:03   ` Minho Ban

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).