Patchwork kernel/range.c: subtract_range: fix the broken phrase issued by printk

login
register
mail settings
Submitter Lin Feng
Date March 19, 2013, 3:54 a.m.
Message ID <1363665251-14377-1-git-send-email-linfeng@cn.fujitsu.com>
Download mbox | patch
Permalink /patch/228910/
State Not Applicable
Headers show

Comments

Lin Feng - March 19, 2013, 3:54 a.m.
Also replace deprecated printk(KERN_ERR...) with pr_err() as suggested
by Yinghai, attaching the function name to provide plenty info.

Cc: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Lin Feng <linfeng@cn.fujitsu.com>
---
 kernel/range.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Bjorn Helgaas - March 27, 2013, 5:27 p.m.
On Mon, Mar 18, 2013 at 9:54 PM, Lin Feng <linfeng@cn.fujitsu.com> wrote:
> Also replace deprecated printk(KERN_ERR...) with pr_err() as suggested
> by Yinghai, attaching the function name to provide plenty info.
>
> Cc: Yinghai Lu <yinghai@kernel.org>
> Signed-off-by: Lin Feng <linfeng@cn.fujitsu.com>
> ---
>  kernel/range.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/range.c b/kernel/range.c
> index 9b8ae2d..071b0ab 100644
> --- a/kernel/range.c
> +++ b/kernel/range.c
> @@ -97,7 +97,8 @@ void subtract_range(struct range *range, int az, u64 start, u64 end)
>                                 range[i].end = range[j].end;
>                                 range[i].start = end;
>                         } else {
> -                               printk(KERN_ERR "run of slot in ranges\n");
> +                               pr_err("%s: run out of slot in ranges\n",
> +                                       __func__);
>                         }
>                         range[j].end = start;
>                         continue;

So now the user might see:

    subtract_range: run out of slot in ranges

What is the user supposed to do when he sees that?  If he happens to
mention it on LKML, what are we going to do about it?  If he attaches
the complete dmesg log, is there enough information to do something?

IMHO, that message is still totally useless.
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yinghai Lu - March 27, 2013, 5:51 p.m.
On Wed, Mar 27, 2013 at 10:27 AM, Bjorn Helgaas <bhelgaas@google.com> wrote:

> So now the user might see:
>
>     subtract_range: run out of slot in ranges
>
> What is the user supposed to do when he sees that?  If he happens to
> mention it on LKML, what are we going to do about it?  If he attaches
> the complete dmesg log, is there enough information to do something?
>
> IMHO, that message is still totally useless.

Change to WARN_ONCE?

Yinghai
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Lin Feng - March 28, 2013, 1:49 a.m.
Hi Bjorn and others,

On 03/28/2013 01:27 AM, Bjorn Helgaas wrote:
>> -                               printk(KERN_ERR "run of slot in ranges\n");
>> > +                               pr_err("%s: run out of slot in ranges\n",
>> > +                                       __func__);
>> >                         }
>> >                         range[j].end = start;
>> >                         continue;
> So now the user might see:
> 
>     subtract_range: run out of slot in ranges
> 
> What is the user supposed to do when he sees that?  If he happens to
> mention it on LKML, what are we going to do about it?  If he attaches
> the complete dmesg log, is there enough information to do something?
> 
> IMHO, that message is still totally useless.
> 

Yes, we need to issue some useful message. 
How about dump_stack() there so that we can find some clues more since
subtract_range() is called mtrr_bp_init path and pci relative path, then
it may help to instruct us to do something ;-) ?

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

Patch

diff --git a/kernel/range.c b/kernel/range.c
index 9b8ae2d..071b0ab 100644
--- a/kernel/range.c
+++ b/kernel/range.c
@@ -97,7 +97,8 @@  void subtract_range(struct range *range, int az, u64 start, u64 end)
 				range[i].end = range[j].end;
 				range[i].start = end;
 			} else {
-				printk(KERN_ERR "run of slot in ranges\n");
+				pr_err("%s: run out of slot in ranges\n",
+					__func__);
 			}
 			range[j].end = start;
 			continue;