linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: 陈华才 <chenhc@lemote.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	Fuxin Zhang <zhangfx@lemote.com>,
	wuzhangjin <wuzhangjin@gmail.com>,
	stable <stable@vger.kernel.org>, Christoph Hellwig <hch@lst.de>,
	Michael Hernandez <michael.hernandez@cavium.com>
Subject: Re: [PATCH] genirq/affinity: Assign default affinity to pre/post vectors
Date: Wed, 16 Jan 2019 10:26:17 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.21.1901161016270.1655@nanos.tec.linutronix.de> (raw)
In-Reply-To: <tencent_7CB943266ADCFDB06DDDE6EF@qq.com>

[-- Attachment #1: Type: text/plain, Size: 2465 bytes --]

Chen,

On Wed, 16 Jan 2019, 陈华才 wrote:

please do not top-post and use line breaks around 78 char.

> I'm not removing all return NULL of irq_create_affinity_masks(), so the ......

Moved content to the place where it belongs so the context is preserved.

> ------------------ Original ------------------
> From:  "Thomas Gleixner"<tglx@linutronix.de>;
> Date:  Wed, Jan 16, 2019 03:10 AM
> To:  "Huacai Chen"<chenhc@lemote.com>;
> Cc:  "linux-kernel"<linux-kernel@vger.kernel.org>; "Fuxin Zhang"<zhangfx@lemote.com>; "wuzhangjin"<wuzhangjin@gmail.com>; "stable"<stable@vger.kernel.org>; "Christoph Hellwig"<hch@lst.de>; "Michael Hernandez"<michael.hernandez@cavium.com>;
> Subject:  Re: [PATCH] genirq/affinity: Assign default affinity to pre/post vectors

And please configure your e-mail client to NOT copy the full headers into
the reply.

> > On Mon, 31 Dec 2018, Huacai Chen wrote:
> > 
> > > Generally, irq_create_affinity_masks() assign default affinity to pre/
> > > post vectors correctly. However, it ignore the case that there are only
> > > pre/post vectors (when nvecs == affd->pre_vectors + affd->post_vectors)
> > > and return NULL. This case usually happens when nvecs = 1 (e.g. in nvme
> > > driver when MSI-X is unavailable and fallback to MSI) and will trigger
> > > the warning in pci_irq_get_affinity(). This patch fix the corner case.
> > 
> > Errm. This is just wrong. When this function returns NULL, then it has
> > failed and the caller or any subsequent code is not supposed to use the
> > result.
> > 
> > The function can return NULL for other reasons, e.g. when the memory
> > allocation failed. How are you going to duct tape that one?
>
> I'm not removing all return NULL of irq_create_affinity_masks(), so the 
> memory allocation failure still return NULL. I just handle the case that
> there are not enough irq vectors. E.g. in nvme driver, the caller may call
> irq_create_affinity_masks() with nvecs=1,pre_vectors=1,post_vectors=0. In
> this case, the only one vector's default affinity assigning is skipped.

I did not say that you removed all NULL returns. I said that this function
can return NULL for other reasons and then the same situation will happen.

If the masks pointer returned is NULL then the calling code or any
subsequent usage needs to handle it properly. Yes, I understand that this
change makes the warning go away for that particular case, but that's not
making it any more correct.

Thanks,

	tglx


  reply	other threads:[~2019-01-16  9:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-31  3:03 [PATCH] genirq/affinity: Assign default affinity to pre/post vectors Huacai Chen
2019-01-15 19:10 ` Thomas Gleixner
2019-01-16  3:00   ` 陈华才
2019-01-16  9:26     ` Thomas Gleixner [this message]
2019-01-17  1:14       ` 陈华才
2019-01-18  1:52         ` Huacai Chen
2019-01-22 21:04           ` Thomas Gleixner

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=alpine.DEB.2.21.1901161016270.1655@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=chenhc@lemote.com \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.hernandez@cavium.com \
    --cc=stable@vger.kernel.org \
    --cc=wuzhangjin@gmail.com \
    --cc=zhangfx@lemote.com \
    /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 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).