lkml.org 
[lkml]   [2019]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] genirq/affinity: Assign default affinity to pre/post vectors
Date
Hi, Thomas,

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.

Huacai

------------------ 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

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?

Thanks,

tglx
\
 
 \ /
  Last update: 2019-01-16 04:01    [W:0.067 / U:5.520 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site