Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp981269imu; Wed, 16 Jan 2019 10:37:33 -0800 (PST) X-Google-Smtp-Source: ALg8bN66dxmrNQbTLfan4+852OSflBbJ3XZIzQPyke0x5W1HzazO/zsuzeubs9dEKNquiosC/T9B X-Received: by 2002:a63:6b05:: with SMTP id g5mr9919360pgc.15.1547663852987; Wed, 16 Jan 2019 10:37:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547663852; cv=none; d=google.com; s=arc-20160816; b=nWNyPNBO1umGE5dscqEJr5Pm99cXm0Qfg/ZNmOidVjlTXS5AgQjnLbf5pfWscgh3FC Nz4z7TtG5lwuHm1iStO29yj8ROf+ZhlhwxvnSB3sNZd2jdRskQ2zlrgTit27trwEib9l 0bHYXSCftaaObD4/MVvgNkNkEWY+zjwFsSDEZZOAtthvGeDR+r3fkK3nVRTEIfIJJ5V4 HnSvgiYVYGXWik0D/Xd7auhIkvajoAu/kksHDXTALbhv5HPWXAb4bFW+Rc5IMqXMipcj Y+iNMKPiumJyhw5rne24RJfWqTyPytjdUj4DpOFFLqaQXn933qiXmyI1iKJBF+9Ao3LU PE8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=zcSl8+KZTf3/AGkFSS8AXF895gZ0mCP004ME+Oin7AI=; b=OoBKCEhqTeUuk5jMVSjU4IaRPcaGQHOScCT7N3ppgLOAzfjbgvxDTL+UAh8seawLNP 4Kwv33vbwGXC1HbNiAklN8AxCpjm4ICz7b+JaOwhua6hJVeuHXlwkffx+LtX/EFFJJXw sXGizDq3zkjcpndy+omGt/so2H/Dw9zji9WlZAI1CBxW2xcUlYC5kGyZTfEMrXMw8Gow VehfT6oE63eFRT8ulGQi2+blMp6RqT3nwBE0LaLfqLfJYWnNIBMZtqMH3s6BGYQLZ/WT lPeaQOci9PxlCUXfmsspnhJBjMp9bGr2TVM7M8Fx/LChg7XTvSfo0C/CFap+Uab7Fp0y 4Y6w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f24si6489985pgj.315.2019.01.16.10.37.17; Wed, 16 Jan 2019 10:37:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403857AbfAPJ0X (ORCPT + 99 others); Wed, 16 Jan 2019 04:26:23 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:44440 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729774AbfAPJ0X (ORCPT ); Wed, 16 Jan 2019 04:26:23 -0500 Received: from p4fea4364.dip0.t-ipconnect.de ([79.234.67.100] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gjhSk-00042m-G9; Wed, 16 Jan 2019 10:26:18 +0100 Date: Wed, 16 Jan 2019 10:26:17 +0100 (CET) From: Thomas Gleixner To: =?GB2312?B?s8K7qrLF?= cc: linux-kernel , Fuxin Zhang , wuzhangjin , stable , Christoph Hellwig , Michael Hernandez Subject: Re: [PATCH] genirq/affinity: Assign default affinity to pre/post vectors In-Reply-To: Message-ID: References: <1546225404-6775-1-git-send-email-chenhc@lemote.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-392514603-1547630778=:1655" X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-392514603-1547630778=:1655 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT 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"; > Date: Wed, Jan 16, 2019 03:10 AM > To: "Huacai Chen"; > Cc: "linux-kernel"; "Fuxin Zhang"; "wuzhangjin"; "stable"; "Christoph Hellwig"; "Michael Hernandez"; > 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 --8323329-392514603-1547630778=:1655--