Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp27753imu; Tue, 22 Jan 2019 13:09:36 -0800 (PST) X-Google-Smtp-Source: ALg8bN7+vsRTXGVuhLUv8uFk6cxBznJ9glChG8DPcYOmmYtzauBzwWE4teMj44jNuedxygxSLnui X-Received: by 2002:a63:5f89:: with SMTP id t131mr33990629pgb.26.1548191376671; Tue, 22 Jan 2019 13:09:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548191376; cv=none; d=google.com; s=arc-20160816; b=Aer+5dwIdyFOBK3PgL46zX2NtCG8LD9pSgSR2maqW6c11GfsuI9/u0jZRddgnvdz41 26uKrbk4agQ1ccOBpjNakw2zYdVOjJhLoNhgkoLPQukT7RFurdk7lB7f4o2kUmPPkaPB exRXW/zSivjhtNJCeAjwOWbeKJScWnflAEBuT62xbqT7PeeGBws9qOdtdmTt/KCxAhiN HBIUW2UlHdyj7UFuYwoaR8ht9u0iPu3J9lkdIfIdfLSWDgrskuzNQcxxpaEMDa2/8Jyo sk1vp5L3NRQeGgajvlJfpqpe5hwLpxN+0BgQ4uB3XVESRYGUWqKXGcBWvxp6zKdEroAD y+JQ== 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=seZ7Wgv3m1Rp68qBAKhSKmxMCk/gkYty/G5UdcVGzSw=; b=aYeZvIp0+2rbYcIjyzlwbVfCXDAJrGt/bIQD8vsto4ZG7/cRqxayatwZ0yOuMf2iem DaGYfa/5NEzOF6HMkA9tpslyQ0lyKVVByjyvyg0TFQRVXGmEzUqnrhV0gwlPK4a3fKde xBAsqNKK7F+/Agnc7JM94yALwZ9K/zpJuhzKcUfhMdH/brqnBCiOJPL83X4V0awDJrfj Lewc0vPBXjqRpVuhNBIcIh2XwDgUsVm0jgzkZliHPQvyKDfXxBRbLdN/B2va/H2IUbWR SapRvLPHMW/LYAs1kdcJuVX8au+iXlEFTuBdPUdALexhLHeWPEhdBSDIEMoKrriMW2Az VXKw== 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 k33si17690327pld.374.2019.01.22.13.08.52; Tue, 22 Jan 2019 13:09:36 -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 S1726765AbfAVVFA (ORCPT + 99 others); Tue, 22 Jan 2019 16:05:00 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:60753 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725971AbfAVVFA (ORCPT ); Tue, 22 Jan 2019 16:05:00 -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 1gm3Dv-0008WA-UN; Tue, 22 Jan 2019 22:04:44 +0100 Date: Tue, 22 Jan 2019 22:04:43 +0100 (CET) From: Thomas Gleixner To: Huacai Chen cc: linux-kernel , Fuxin Zhang , wuzhangjin , Christoph Hellwig , Michael Hernandez , Jens Axboe , Bjorn Helgaas , Keith Busch , Ming Lei , linux-block@vger.kernel.org, linux-nvme@lists.infradead.org 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: text/plain; charset=US-ASCII 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 Chen, On Fri, 18 Jan 2019, Huacai Chen wrote: > > > 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. > > Hi, Thomas, > > I don't think "nvecs == affd->pre_vectors + affd->post_vectors" is an ERROR, > so it should be different with "return NULL for other reasons" to the caller. If > the caller fallback from MSI-X to MSI, it is probably "nvecs=1,pre_vectors=1, > post_vectors=0". The caller can work perfectly, if pre/post vectors are filled > with the default affinity. This is not about 'works'. This is about correctness. So again: The semantics of that function is, that it returns NULL on error. The reason for this NULL return is entirely irrelevant for the moment. If the calling code or any subsequent code proceeds as if nothing happened and later complains about it being NULL, then that logic at the calling or subsequent code is broken. And just making one particular error case not return NULL does not make it less broken because the function still can return NULL. So that proposed 'fix' is sunshine programming at best. Now for the change you are proposing. It's semantically wrong in the face of multiqueue devices. You are trying to make exactly one particular corner case "work" by some dubious definition of work: nvecs=1,pre_vectors=1,post_vectors=0 If pre + post != 1 then this still returns NULL and the same wreckage happens again. The point is that if there are not enough vectors to have at least one queue vector aside of pre and post then the whole queue management logic does not make any sense. This needs to be fixed elsewhere and not duct tape in the core logic with the argument 'works for me'. Thanks, tglx