All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Tony Battersby <tonyb-vFAe+i1/wJI5UWNf+nJyDw@public.gmane.org>
Cc: linux-scsi <linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Chaitra P B
	<chaitra.basappa-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	Suganath Prabu Subramani
	<suganath-prabu.subramani-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	Sathya Prakash
	<sathya.prakash-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	Matthew Wilcox <willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	linux-mm <linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org>,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	MPT-FusionLinux.pdl-dY08KVG/lbpWk0Htik3J/w@public.gmane.org,
	Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
Subject: Re: [PATCH v2 2/9] dmapool: cleanup error messages
Date: Fri, 3 Aug 2018 18:59:20 +0300	[thread overview]
Message-ID: <CAHp75VcoLVkp+BkFBLSqn95=3SaV-zr8cO1eSoQsrzZtJZESNQ@mail.gmail.com> (raw)
In-Reply-To: <b8547f8d-ac88-3d7b-9c2d-60a2f779259e-vFAe+i1/wJI5UWNf+nJyDw@public.gmane.org>

On Fri, Aug 3, 2018 at 6:17 PM, Tony Battersby <tonyb-vFAe+i1/wJI5UWNf+nJyDw@public.gmane.org> wrote:
> On 08/03/2018 09:41 AM, Tony Battersby wrote:
>> On 08/03/2018 04:56 AM, Andy Shevchenko wrote:
>>> On Thu, Aug 2, 2018 at 10:57 PM, Tony Battersby <tonyb-vFAe+i1/wJI5UWNf+nJyDw@public.gmane.org> wrote:
>>>> Remove code duplication in error messages.  It is now safe to pas a NULL
>>>> dev to dev_err(), so the checks to avoid doing so are no longer
>>>> necessary.
>>>>
>>>> Example:
>>>>
>>>> Error message with dev != NULL:
>>>>   mpt3sas 0000:02:00.0: dma_pool_destroy chain pool, (____ptrval____) busy
>>>>
>>>> Same error message with dev == NULL before patch:
>>>>   dma_pool_destroy chain pool, (____ptrval____) busy
>>>>
>>>> Same error message with dev == NULL after patch:
>>>>   (NULL device *): dma_pool_destroy chain pool, (____ptrval____) busy
>>> Have you checked a history of this?
>>>
>>> I'm pretty sure this was created in an order to avoid bad looking (and
>>> in some cases frightening) "NULL device *" part.
>>>
>>> If it it's the case, I would rather leave it as is, and even not the
>>> case, I'm slightly more bent to the current state.
>>>
>> I did.  "drivers/base/dmapool.c", later moved to "mm/dmapool.c", was
>> added in linux-2.6.3, for which dev_err() did not work will a NULL dev,
>> so the check was necessary back then.  I agree that the (NULL device *):
>> bit is ugly, but these messages should be printed only after a kernel
>> bug, so it is not like they will be making a regular appearance in
>> dmesg.  Considering that, I think that it is better to keep it simple.
>>
>
> My original unsubmitted patch used the following:
>
> +#define pool_err(pool, fmt, args...) \
> +       do { \
> +               if ((pool)->dev) \
> +                       dev_err((pool)->dev, fmt, args); \
> +               else \
> +                       pr_err(fmt, args); \
> +       } while (0)
>
> But then I decided to simplify it to just use dev_err().  I still have
> the old version.  When I submit v3 of the patchset, which would you prefer?

JFYI: git log --no-merges --grep 'NULL device \*'

P.S. I already shared my opinion on this anyway.

-- 
With Best Regards,
Andy Shevchenko

WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Tony Battersby <tonyb@cybernetics.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	Christoph Hellwig <hch@lst.de>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Sathya Prakash <sathya.prakash@broadcom.com>,
	Chaitra P B <chaitra.basappa@broadcom.com>,
	Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>,
	iommu@lists.linux-foundation.org, linux-mm <linux-mm@kvack.org>,
	linux-scsi <linux-scsi@vger.kernel.org>,
	MPT-FusionLinux.pdl@broadcom.com
Subject: Re: [PATCH v2 2/9] dmapool: cleanup error messages
Date: Fri, 3 Aug 2018 18:59:20 +0300	[thread overview]
Message-ID: <CAHp75VcoLVkp+BkFBLSqn95=3SaV-zr8cO1eSoQsrzZtJZESNQ@mail.gmail.com> (raw)
In-Reply-To: <b8547f8d-ac88-3d7b-9c2d-60a2f779259e@cybernetics.com>

On Fri, Aug 3, 2018 at 6:17 PM, Tony Battersby <tonyb@cybernetics.com> wrote:
> On 08/03/2018 09:41 AM, Tony Battersby wrote:
>> On 08/03/2018 04:56 AM, Andy Shevchenko wrote:
>>> On Thu, Aug 2, 2018 at 10:57 PM, Tony Battersby <tonyb@cybernetics.com> wrote:
>>>> Remove code duplication in error messages.  It is now safe to pas a NULL
>>>> dev to dev_err(), so the checks to avoid doing so are no longer
>>>> necessary.
>>>>
>>>> Example:
>>>>
>>>> Error message with dev != NULL:
>>>>   mpt3sas 0000:02:00.0: dma_pool_destroy chain pool, (____ptrval____) busy
>>>>
>>>> Same error message with dev == NULL before patch:
>>>>   dma_pool_destroy chain pool, (____ptrval____) busy
>>>>
>>>> Same error message with dev == NULL after patch:
>>>>   (NULL device *): dma_pool_destroy chain pool, (____ptrval____) busy
>>> Have you checked a history of this?
>>>
>>> I'm pretty sure this was created in an order to avoid bad looking (and
>>> in some cases frightening) "NULL device *" part.
>>>
>>> If it it's the case, I would rather leave it as is, and even not the
>>> case, I'm slightly more bent to the current state.
>>>
>> I did.  "drivers/base/dmapool.c", later moved to "mm/dmapool.c", was
>> added in linux-2.6.3, for which dev_err() did not work will a NULL dev,
>> so the check was necessary back then.  I agree that the (NULL device *):
>> bit is ugly, but these messages should be printed only after a kernel
>> bug, so it is not like they will be making a regular appearance in
>> dmesg.  Considering that, I think that it is better to keep it simple.
>>
>
> My original unsubmitted patch used the following:
>
> +#define pool_err(pool, fmt, args...) \
> +       do { \
> +               if ((pool)->dev) \
> +                       dev_err((pool)->dev, fmt, args); \
> +               else \
> +                       pr_err(fmt, args); \
> +       } while (0)
>
> But then I decided to simplify it to just use dev_err().  I still have
> the old version.  When I submit v3 of the patchset, which would you prefer?

JFYI: git log --no-merges --grep 'NULL device \*'

P.S. I already shared my opinion on this anyway.

-- 
With Best Regards,
Andy Shevchenko

  parent reply	other threads:[~2018-08-03 15:59 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-02 19:57 [PATCH v2 2/9] dmapool: cleanup error messages Tony Battersby
2018-08-02 19:57 ` Tony Battersby
     [not found] ` <a9f7ca9a-38d5-12e2-7d15-ab026425e85a-vFAe+i1/wJI5UWNf+nJyDw@public.gmane.org>
2018-08-03  8:56   ` Andy Shevchenko
2018-08-03  8:56     ` Andy Shevchenko
     [not found]     ` <CAHp75Ve0su_S3ZWTtUEUohrs-iPiD1uzFOHhesLrWzJPOa2LNg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-08-03 13:41       ` Tony Battersby
2018-08-03 13:41         ` Tony Battersby
     [not found]         ` <7a943124-c65e-f0ed-cc5c-20b23f021505-vFAe+i1/wJI5UWNf+nJyDw@public.gmane.org>
2018-08-03 15:17           ` Tony Battersby
2018-08-03 15:17             ` Tony Battersby
     [not found]             ` <b8547f8d-ac88-3d7b-9c2d-60a2f779259e-vFAe+i1/wJI5UWNf+nJyDw@public.gmane.org>
2018-08-03 15:59               ` Andy Shevchenko [this message]
2018-08-03 15:59                 ` Andy Shevchenko
     [not found]                 ` <CAHp75VcoLVkp+BkFBLSqn95=3SaV-zr8cO1eSoQsrzZtJZESNQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-08-03 16:01                   ` Andy Shevchenko
2018-08-03 16:01                     ` Andy Shevchenko
     [not found]                     ` <CAHp75VdkFfND+Mr+L96kkGEF7K49Fr2HWezQQ3DBOQvxTLjBcw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-08-03 16:10                       ` Tony Battersby
2018-08-03 16:10                         ` Tony Battersby
2018-08-03 16:22                   ` Matthew Wilcox
2018-08-03 16:22                     ` Matthew Wilcox
     [not found]                     ` <20180803162212.GA4718-PfSpb0PWhxZc2C7mugBRk2EX/6BAtgUQ@public.gmane.org>
2018-08-03 17:03                       ` Tony Battersby
2018-08-03 17:03                         ` Tony Battersby
     [not found]                         ` <a2e9e4fd-2aab-bc7e-8dbb-db4ece8cd84f-vFAe+i1/wJI5UWNf+nJyDw@public.gmane.org>
2018-08-03 18:38                           ` Andy Shevchenko
2018-08-03 18:38                             ` Andy Shevchenko
     [not found]                             ` <CAHp75VfZfhHS1Hgrm+3xJL=3gT9Bri16JJSFUJpDY0=Ev5X-PA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-08-03 18:44                               ` Tony Battersby
2018-08-03 18:44                                 ` Tony Battersby
2018-08-03 19:07                               ` Douglas Gilbert
2018-08-03 19:07                                 ` Douglas Gilbert
2018-08-03 18:43                           ` Tony Battersby
2018-08-03 18:43                             ` Tony Battersby
     [not found]                             ` <f0762902-8f28-82eb-b871-337c2da290cf-vFAe+i1/wJI5UWNf+nJyDw@public.gmane.org>
2018-08-03 21:07                               ` Matthew Wilcox
2018-08-03 21:07                                 ` Matthew Wilcox
     [not found]                                 ` <20180803210745.GB9329-PfSpb0PWhxZc2C7mugBRk2EX/6BAtgUQ@public.gmane.org>
2018-08-03 21:18                                   ` Tony Battersby
2018-08-03 21:18                                     ` Tony Battersby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHp75VcoLVkp+BkFBLSqn95=3SaV-zr8cO1eSoQsrzZtJZESNQ@mail.gmail.com' \
    --to=andy.shevchenko-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=MPT-FusionLinux.pdl-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=chaitra.basappa-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=hch-jcswGhMUV9g@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
    --cc=linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sathya.prakash-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=suganath-prabu.subramani-dY08KVG/lbpWk0Htik3J/w@public.gmane.org \
    --cc=tonyb-vFAe+i1/wJI5UWNf+nJyDw@public.gmane.org \
    --cc=willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.