Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp240262imj; Wed, 13 Feb 2019 07:34:49 -0800 (PST) X-Google-Smtp-Source: AHgI3IYdjcaD8egey20XmpTJXY2dGuGv22DrwTxy11C+58iLn+UwdtlWHREBlOXITwABZzonNSDO X-Received: by 2002:a17:902:b494:: with SMTP id y20mr1149486plr.178.1550072089741; Wed, 13 Feb 2019 07:34:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550072089; cv=none; d=google.com; s=arc-20160816; b=fXOU+3FriBQvgvqcisOUaEwN6z5gpHFLD0T+5ywn5dz8iKUVfCkNtuMRbzwhw1yHDU MgxS9zt+i48zVpE69hK6Hbhb/+feQJAdkBd3TiRR6ZZRMO1D4zuikao8iyMkwzJnJLMc y82U3EEix6oLQKKW5cySy5IXqqSkrkwl+UH3TWV+liEa3nbQGZliROrQ1WOHwGje2oa4 jX9RkiFoTzUGcfTI+1Pf2XA/ZaM2NnTLAfY3Z/IsfWuKJ3R3/FiDqC0MVT7qMI4m5KB2 wvEGwOdu4v51UI1V5o+J9g9ZiKsPTSEek6ex9Kw/aqCpjxF5gT8xo2afpxytGqrqd6B0 WG8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=0NNVrKeBYcr35sdQQq93Qp0EC/jLs3U/Tt4pPs2dzc8=; b=rbDR317nPrwC1G8Uer0z9epvzGCouA4wfafUvIrdaE+UyIcQH06/LwTcBBR9l/3r9w TvBUTyxMTBOnVqctE81JZjUrRe4C4275HzmZKM1Oi9AXW3hCSk2f19UqOutvxVW62UP6 Ma4M8F9PVB1tMqyetOiwzgPcxQLnLg82cKxPT3A/N8V1Yx4jAxCZ3iwZRVNcKMXAPKkI r3tUZkeH2IwMBkaR0g1VfOfc4Jid7HmLNALnKrZkDsFCvC1/7ILimgp9aRmJPE2FPZkw hY5ZhY/l40y9n0/xK0FPFd3QXOiRn23iMpupN54kLTw+X/hBMwBt9IPFVC5Z34hsJymj i7yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ezoRB+tW; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id az1si938247plb.54.2019.02.13.07.34.27; Wed, 13 Feb 2019 07:34:49 -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=@kernel.org header.s=default header.b=ezoRB+tW; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391185AbfBMPEK (ORCPT + 99 others); Wed, 13 Feb 2019 10:04:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:48794 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726317AbfBMPEK (ORCPT ); Wed, 13 Feb 2019 10:04:10 -0500 Received: from localhost (173-25-63-173.client.mchsi.com [173.25.63.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BAF15222C2; Wed, 13 Feb 2019 15:04:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550070249; bh=SqXPcqHxBhu1SvS71VKiziJ8cY0e/F/LaNZdgp1ICas=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ezoRB+tWGweXo0e89b9NmWSVx2ZrybRwPCMokZfaygIC6lxiZwFJnMIS5F8b14+z3 5UClYHGe0FgPwI6OuBKZCcAnHAHrglV3D7mM6VZJCHLA+V0uImITOLsE0SLx2xtv97 Xp71vpCw9Cs2hCagwPO5vRjwJxAlh2RNfqJs62NU= Date: Wed, 13 Feb 2019 09:04:07 -0600 From: Bjorn Helgaas To: Ming Lei Cc: Christoph Hellwig , Thomas Gleixner , Jens Axboe , linux-block@vger.kernel.org, Sagi Grimberg , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Keith Busch Subject: Re: [PATCH V3 1/5] genirq/affinity: don't mark 'affd' as const Message-ID: <20190213150407.GB96272@google.com> References: <20190213105041.13537-1-ming.lei@redhat.com> <20190213105041.13537-2-ming.lei@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190213105041.13537-2-ming.lei@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 13, 2019 at 06:50:37PM +0800, Ming Lei wrote: > Currently all parameters in 'affd' are read-only, so 'affd' is marked > as const in both pci_alloc_irq_vectors_affinity() and irq_create_affinity_masks(). s/all parameters in 'affd'/the contents of '*affd'/ > We have to ask driver to re-caculate set vectors after the whole IRQ > vectors are allocated later, and the result needs to be stored in 'affd'. > Also both the two interfaces are core APIs, which should be trusted. s/re-caculate/recalculate/ s/stored in 'affd'/stored in '*affd'/ s/both the two/both/ This is a little confusing because you're talking about both "IRQ vectors" and these other "set vectors", which I think are different things. I assume the "set vectors" are cpumasks showing the affinity of the IRQ vectors with some CPUs? AFAICT, *this* patch doesn't add anything that writes to *affd. I think the removal of "const" should be in the same patch that makes the removal necessary. > So don't mark 'affd' as const both pci_alloc_irq_vectors_affinity() and > irq_create_affinity_masks(). > > Signed-off-by: Ming Lei > --- > drivers/pci/msi.c | 18 +++++++++--------- > include/linux/interrupt.h | 2 +- > include/linux/pci.h | 4 ++-- > kernel/irq/affinity.c | 2 +- > 4 files changed, 13 insertions(+), 13 deletions(-) > > diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c > index 4c0b47867258..96978459e2a0 100644 > --- a/drivers/pci/msi.c > +++ b/drivers/pci/msi.c > @@ -532,7 +532,7 @@ static int populate_msi_sysfs(struct pci_dev *pdev) > } > > static struct msi_desc * > -msi_setup_entry(struct pci_dev *dev, int nvec, const struct irq_affinity *affd) > +msi_setup_entry(struct pci_dev *dev, int nvec, struct irq_affinity *affd) > { > struct irq_affinity_desc *masks = NULL; > struct msi_desc *entry; > @@ -597,7 +597,7 @@ static int msi_verify_entries(struct pci_dev *dev) > * which could have been allocated. > */ > static int msi_capability_init(struct pci_dev *dev, int nvec, > - const struct irq_affinity *affd) > + struct irq_affinity *affd) > { > struct msi_desc *entry; > int ret; > @@ -669,7 +669,7 @@ static void __iomem *msix_map_region(struct pci_dev *dev, unsigned nr_entries) > > static int msix_setup_entries(struct pci_dev *dev, void __iomem *base, > struct msix_entry *entries, int nvec, > - const struct irq_affinity *affd) > + struct irq_affinity *affd) > { > struct irq_affinity_desc *curmsk, *masks = NULL; > struct msi_desc *entry; > @@ -736,7 +736,7 @@ static void msix_program_entries(struct pci_dev *dev, > * requested MSI-X entries with allocated irqs or non-zero for otherwise. > **/ > static int msix_capability_init(struct pci_dev *dev, struct msix_entry *entries, > - int nvec, const struct irq_affinity *affd) > + int nvec, struct irq_affinity *affd) > { > int ret; > u16 control; > @@ -932,7 +932,7 @@ int pci_msix_vec_count(struct pci_dev *dev) > EXPORT_SYMBOL(pci_msix_vec_count); > > static int __pci_enable_msix(struct pci_dev *dev, struct msix_entry *entries, > - int nvec, const struct irq_affinity *affd) > + int nvec, struct irq_affinity *affd) > { > int nr_entries; > int i, j; > @@ -1018,7 +1018,7 @@ int pci_msi_enabled(void) > EXPORT_SYMBOL(pci_msi_enabled); > > static int __pci_enable_msi_range(struct pci_dev *dev, int minvec, int maxvec, > - const struct irq_affinity *affd) > + struct irq_affinity *affd) > { > int nvec; > int rc; > @@ -1086,7 +1086,7 @@ EXPORT_SYMBOL(pci_enable_msi); > > static int __pci_enable_msix_range(struct pci_dev *dev, > struct msix_entry *entries, int minvec, > - int maxvec, const struct irq_affinity *affd) > + int maxvec, struct irq_affinity *affd) > { > int rc, nvec = maxvec; > > @@ -1165,9 +1165,9 @@ EXPORT_SYMBOL(pci_enable_msix_range); > */ > int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs, > unsigned int max_vecs, unsigned int flags, > - const struct irq_affinity *affd) > + struct irq_affinity *affd) > { > - static const struct irq_affinity msi_default_affd; > + struct irq_affinity msi_default_affd = {0}; > int msix_vecs = -ENOSPC; > int msi_vecs = -ENOSPC; > > diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h > index 7c9434652f36..1ed1014c9684 100644 > --- a/include/linux/interrupt.h > +++ b/include/linux/interrupt.h > @@ -332,7 +332,7 @@ extern int > irq_set_affinity_notifier(unsigned int irq, struct irq_affinity_notify *notify); > > struct irq_affinity_desc * > -irq_create_affinity_masks(int nvec, const struct irq_affinity *affd); > +irq_create_affinity_masks(int nvec, struct irq_affinity *affd); > > int irq_calc_affinity_vectors(int minvec, int maxvec, const struct irq_affinity *affd); > > diff --git a/include/linux/pci.h b/include/linux/pci.h > index 40b327b814aa..4eca42cf611b 100644 > --- a/include/linux/pci.h > +++ b/include/linux/pci.h > @@ -1396,7 +1396,7 @@ static inline int pci_enable_msix_exact(struct pci_dev *dev, > } > int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs, > unsigned int max_vecs, unsigned int flags, > - const struct irq_affinity *affd); > + struct irq_affinity *affd); > > void pci_free_irq_vectors(struct pci_dev *dev); > int pci_irq_vector(struct pci_dev *dev, unsigned int nr); > @@ -1422,7 +1422,7 @@ static inline int pci_enable_msix_exact(struct pci_dev *dev, > static inline int > pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs, > unsigned int max_vecs, unsigned int flags, > - const struct irq_affinity *aff_desc) > + struct irq_affinity *aff_desc) > { > if ((flags & PCI_IRQ_LEGACY) && min_vecs == 1 && dev->irq) > return 1; > diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c > index 118b66d64a53..9200d3b26f7d 100644 > --- a/kernel/irq/affinity.c > +++ b/kernel/irq/affinity.c > @@ -239,7 +239,7 @@ static int irq_build_affinity_masks(const struct irq_affinity *affd, > * Returns the irq_affinity_desc pointer or NULL if allocation failed. > */ > struct irq_affinity_desc * > -irq_create_affinity_masks(int nvecs, const struct irq_affinity *affd) > +irq_create_affinity_masks(int nvecs, struct irq_affinity *affd) > { > int affvecs = nvecs - affd->pre_vectors - affd->post_vectors; > int curvec, usedvecs; > -- > 2.9.5 >