Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2592577imu; Thu, 17 Jan 2019 17:48:39 -0800 (PST) X-Google-Smtp-Source: ALg8bN4YF6X0OOopzHSOfxbJdiLYutq7aBQRvX+I+F3g7z65ILYjW75ybX0eHhIzct5voecRV3T4 X-Received: by 2002:a62:442:: with SMTP id 63mr17076429pfe.156.1547776118954; Thu, 17 Jan 2019 17:48:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547776118; cv=none; d=google.com; s=arc-20160816; b=GQ6GbPjKoM6nlLqKSQLhn3A3qpScE4CjRfWBfu4tG4H36cT2MagI99Ls5aj8NZthu4 JCfZf1x24wVhhqQUSE95zufIxlkXBe0XA3fbd8lqR5puxN4ZflLuZdgNQ/yMC1n08F9p BaSEtOON+2KOHahjYdrT2C1Q5VCMZoykpcTmIMOXn8rfdzA+eATvH7Zu5fP19EVy2quh dtP78hE4MtCuPaTYX8Bf/6XwUBHSxuNK9M5yBFz/r+EFpLwZ+5gOmwDQGzSiyqzYw4RC CqR4r6/eggo7MLoNWoq//HZHfRFr4aDER6ApX4Qji1HGve58lAL1kS1RMXCM59tlDZyN NUYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Lz6AnJMYxCrhSmDim5KOg2l8OFTIoaJZ8Kmz167VyfY=; b=Hdf3+f3cSrNpKMKiIKLlHk3kRkRpmL8V0Gn7Cdva2M5ujduOchJrtZ5iKusZ4IURXk 2eJj426oR4GWyi78JOOu8imQL6Dzv/ah48kTmjB3ZGWvg+j5lPzjDDZ7SZ9KQ9ypFUYg FxdtDLETll2H6rnjr2ynuPvZNnRU+ZQ6oVGXb7wXfhIaS5Rceii+IP3EK59mLAw5y7L9 cjWv6Ar6cQRas6JCVPyz+CfvVwM+Xcp9q8wXYRk2vxTtUeL77HYlJdm6EHgHMLo560XP aQiOHjsTKVz1glfcHioGQpDEDry8TpSJFjWRuheVeWLE/qbrRgy9y2HCERL2KNjXE+QF ndSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=J+5NQgQ0; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 14si3224200pgo.511.2019.01.17.17.48.18; Thu, 17 Jan 2019 17:48:38 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=J+5NQgQ0; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727062AbfARBpt (ORCPT + 99 others); Thu, 17 Jan 2019 20:45:49 -0500 Received: from mail-it1-f193.google.com ([209.85.166.193]:40204 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726329AbfARBps (ORCPT ); Thu, 17 Jan 2019 20:45:48 -0500 Received: by mail-it1-f193.google.com with SMTP id h193so3858673ita.5; Thu, 17 Jan 2019 17:45:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Lz6AnJMYxCrhSmDim5KOg2l8OFTIoaJZ8Kmz167VyfY=; b=J+5NQgQ0tPDPhszvWLVHFpjg+WC1SlNONqiBpo2RmBQU8Liw05KCbCRMGYmw/Ss4Bo h9J8aQ7e8YiYw6cmOs9nezBc0sBEv+gnrT+sWzdfJVTdXQiFkkhLvpLVu5krBAo4EJ4P /xRv4xutRQjuxpkyG/G52gfhYyp7CBDy7kgQhp5wJPuvsjqxMmVVikVJ9Js41SNx0xlT XM1u3VYkLNnO6su1xLQrb1A6HvyzYBdhYBv4TdtP25GMus+OTF9Klv+wsR7oB0Ea8QRg oz0JwwOrYM/c4puok/AdbAbU03LOlGTx9WAwEBTEHw/t82nwdRJwaSvyTqlqEbJokKcR Xjng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Lz6AnJMYxCrhSmDim5KOg2l8OFTIoaJZ8Kmz167VyfY=; b=KlcPJxQHshulvV4wnOpjo+I08cifiQMFJSovAHMgP6jJaGS7gub4Vfatv06Qm1A1xw 1IgSMYTmGxtSgrg9H0n6OFt5dMVolalpxIm3muFCLnOFBilp7O/yFkhAw5fBdaOw//9w uaLZYWdeiHJka54oEEMNNFzykhntQFMgfh4HiZoh+hToo5rPLIwGw4DTiJVkYOHtYYcy 2+VWZTpMAfW8Pi4xn5fxUDTC6fXjDMAp9CHL8PO4oKqKscnRILIsMHmYb7RTtRXCf53q sAROkIq/LZKICh6OhoRkp8PYUHZst85QZJppd/8k+G2EZziViJnpyV8YCFeJYyslLhTm CtwA== X-Gm-Message-State: AJcUukfnKc6EciB4h1j8nngOqwTkiTi+KZ6VLXn9Z1iwnsl2ee9GAx2C P1hmgsx3OMFnNNAxocMjL4TV8xZMvsWVd0b+dgQ= X-Received: by 2002:a24:b34f:: with SMTP id z15mr9537852iti.61.1547775947990; Thu, 17 Jan 2019 17:45:47 -0800 (PST) MIME-Version: 1.0 References: <1546225404-6775-1-git-send-email-chenhc@lemote.com> In-Reply-To: From: Huacai Chen Date: Fri, 18 Jan 2019 09:52:00 +0800 Message-ID: Subject: Re: [PATCH] genirq/affinity: Assign default affinity to pre/post vectors To: Thomas Gleixner Cc: linux-kernel , Fuxin Zhang , wuzhangjin , stable , Christoph Hellwig , Michael Hernandez Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 17, 2019 at 9:14 AM =E9=99=88=E5=8D=8E=E6=89=8D wrote: > > =E9=99=88=E5=8D=8E=E6=89=8D > =E6=B1=9F=E8=8B=8F=E4=B8=AD=E7=A7=91=E6=A2=A6=E5=85=B0=E7=94=B5=E5=AD=90= =E7=A7=91=E6=8A=80=E6=9C=89=E9=99=90=E5=85=AC=E5=8F=B8/=E8=87=AA=E4=B8=BB= =E5=AE=89=E5=85=A8=E4=BA=8B=E4=B8=9A=E9=83=A8/=E8=BD=AF=E4=BB=B6=E9=83=A8 > =E6=B1=9F=E8=8B=8F=E5=B8=B8=E7=86=9F=E8=99=9E=E5=B1=B1=E9=95=87=E6=A2=A6= =E5=85=B0=E6=9D=91 > > > > ------------------ Original ------------------ > From: "Thomas Gleixner"; > Date: Wed, Jan 16, 2019 05:26 PM > To: "=E9=99=88=E5=8D=8E=E6=89=8D"; > Cc: "linux-kernel"; "Fuxin Zhang"; "wuzhangjin"; "stable"; "Christoph Hellwig"; "Michael Hernandez"; > Subject: Re: [PATCH] genirq/affinity: Assign default affinity to pre/pos= t vectors > > Chen, > > On Wed, 16 Jan 2019, =E9=99=88=E5=8D=8E=E6=89=8D 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 preserv= ed. > > > ------------------ 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/p= ost vectors > > > And please configure your e-mail client to NOT copy the full headers in= to > > 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 ar= e only > > > > > pre/post vectors (when nvecs =3D=3D affd->pre_vectors + affd->pos= t_vectors) > > > > > and return NULL. This case usually happens when nvecs =3D 1 (e.g.= in nvme > > > > > driver when MSI-X is unavailable and fallback to MSI) and will tr= igger > > > > > 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 memor= y > > > > allocation failed. How are you going to duct tape that one? > > > > > > I'm not removing all return NULL of irq_create_affinity_masks(), so t= he > > > memory allocation failure still return NULL. I just handle the case t= hat > > > there are not enough irq vectors. E.g. in nvme driver, the caller may= call > > > irq_create_affinity_masks() with nvecs=3D1,pre_vectors=3D1,post_vecto= rs=3D0. In > > > this case, the only one vector's default affinity assigning is skippe= d. > > > > I did not say that you removed all NULL returns. I said that this funct= ion > > can return NULL for other reasons and then the same situation will happ= en. > > > > If the masks pointer returned is NULL then the calling code or any > > subsequent usage needs to handle it properly. Yes, I understand that th= is > > change makes the warning go away for that particular case, but that's n= ot > > making it any more correct. Hi, Thomas, I don't think "nvecs =3D=3D affd->pre_vectors + affd->post_vectors" is an E= RROR, so it should be different with "return NULL for other reasons" to the calle= r. If the caller fallback from MSI-X to MSI, it is probably "nvecs=3D1,pre_vector= s=3D1, post_vectors=3D0". The caller can work perfectly, if pre/post vectors are f= illed with the default affinity. Huacai > > Thanks, > > > tglx