All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: kevin.tian@intel.com, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org, pasic@linux.ibm.com,
	iommu@lists.linux-foundation.org, sebastien.boeuf@intel.com,
	will@kernel.org, jasowang@redhat.com
Subject: Re: [PATCH v2 4/5] iommu/virtio: Pass end address to viommu_add_mapping()
Date: Mon, 29 Nov 2021 15:42:56 +0000	[thread overview]
Message-ID: <YaT1ACdwq1n4YBug@myrica> (raw)
In-Reply-To: <20211127180742-mutt-send-email-mst@kernel.org>

On Sat, Nov 27, 2021 at 06:09:56PM -0500, Michael S. Tsirkin wrote:
> > > -static int viommu_add_mapping(struct viommu_domain *vdomain, unsigned long iova,
> > > -			      phys_addr_t paddr, size_t size, u32 flags)
> > > +static int viommu_add_mapping(struct viommu_domain *vdomain, u64 iova, u64 end,
> > > +			      phys_addr_t paddr, u32 flags)
> > >  {
> > >  	unsigned long irqflags;
> > >  	struct viommu_mapping *mapping;
> 
> I am worried that API changes like that will cause subtle
> bugs since types of arguments change but not their
> number. If we forgot to update some callers it will all be messed up.
> 
> How about passing struct Range instead?

I gave struct range a try but it looks messier overall since it would only
be used to pass arguments. I think the update is safe enough because there
is one caller for viommu_add_mapping() and two for viommu_del_mappings(),
at the moment.

Thanks,
Jean

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

WARNING: multiple messages have this Message-ID (diff)
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: joro@8bytes.org, linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org, pasic@linux.ibm.com,
	Eric Auger <eric.auger@redhat.com>,
	iommu@lists.linux-foundation.org, sebastien.boeuf@intel.com,
	will@kernel.org
Subject: Re: [PATCH v2 4/5] iommu/virtio: Pass end address to viommu_add_mapping()
Date: Mon, 29 Nov 2021 15:42:56 +0000	[thread overview]
Message-ID: <YaT1ACdwq1n4YBug@myrica> (raw)
In-Reply-To: <20211127180742-mutt-send-email-mst@kernel.org>

On Sat, Nov 27, 2021 at 06:09:56PM -0500, Michael S. Tsirkin wrote:
> > > -static int viommu_add_mapping(struct viommu_domain *vdomain, unsigned long iova,
> > > -			      phys_addr_t paddr, size_t size, u32 flags)
> > > +static int viommu_add_mapping(struct viommu_domain *vdomain, u64 iova, u64 end,
> > > +			      phys_addr_t paddr, u32 flags)
> > >  {
> > >  	unsigned long irqflags;
> > >  	struct viommu_mapping *mapping;
> 
> I am worried that API changes like that will cause subtle
> bugs since types of arguments change but not their
> number. If we forgot to update some callers it will all be messed up.
> 
> How about passing struct Range instead?

I gave struct range a try but it looks messier overall since it would only
be used to pass arguments. I think the update is safe enough because there
is one caller for viommu_add_mapping() and two for viommu_del_mappings(),
at the moment.

Thanks,
Jean

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

WARNING: multiple messages have this Message-ID (diff)
From: Jean-Philippe Brucker <jean-philippe@linaro.org>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Eric Auger <eric.auger@redhat.com>,
	joro@8bytes.org, will@kernel.org, jasowang@redhat.com,
	virtualization@lists.linux-foundation.org,
	iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
	sebastien.boeuf@intel.com, kevin.tian@intel.com,
	pasic@linux.ibm.com
Subject: Re: [PATCH v2 4/5] iommu/virtio: Pass end address to viommu_add_mapping()
Date: Mon, 29 Nov 2021 15:42:56 +0000	[thread overview]
Message-ID: <YaT1ACdwq1n4YBug@myrica> (raw)
In-Reply-To: <20211127180742-mutt-send-email-mst@kernel.org>

On Sat, Nov 27, 2021 at 06:09:56PM -0500, Michael S. Tsirkin wrote:
> > > -static int viommu_add_mapping(struct viommu_domain *vdomain, unsigned long iova,
> > > -			      phys_addr_t paddr, size_t size, u32 flags)
> > > +static int viommu_add_mapping(struct viommu_domain *vdomain, u64 iova, u64 end,
> > > +			      phys_addr_t paddr, u32 flags)
> > >  {
> > >  	unsigned long irqflags;
> > >  	struct viommu_mapping *mapping;
> 
> I am worried that API changes like that will cause subtle
> bugs since types of arguments change but not their
> number. If we forgot to update some callers it will all be messed up.
> 
> How about passing struct Range instead?

I gave struct range a try but it looks messier overall since it would only
be used to pass arguments. I think the update is safe enough because there
is one caller for viommu_add_mapping() and two for viommu_del_mappings(),
at the moment.

Thanks,
Jean


  reply	other threads:[~2021-11-29 15:43 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-23 15:52 [PATCH v2 0/5] iommu/virtio: Add identity domains Jean-Philippe Brucker
2021-11-23 15:52 ` Jean-Philippe Brucker
2021-11-23 15:52 ` Jean-Philippe Brucker
2021-11-23 15:52 ` [PATCH v2 1/5] iommu/virtio: Add definitions for VIRTIO_IOMMU_F_BYPASS_CONFIG Jean-Philippe Brucker
2021-11-23 15:52   ` Jean-Philippe Brucker
2021-11-23 15:52   ` Jean-Philippe Brucker
2021-11-27  7:59   ` Eric Auger
2021-11-27  7:59     ` Eric Auger
2021-11-27  7:59     ` Eric Auger
2021-11-29 15:33     ` Jean-Philippe Brucker
2021-11-29 15:33       ` Jean-Philippe Brucker
2021-11-29 15:33       ` Jean-Philippe Brucker
2021-11-23 15:52 ` [PATCH v2 2/5] iommu/virtio: Support bypass domains Jean-Philippe Brucker
2021-11-23 15:52   ` Jean-Philippe Brucker
2021-11-23 15:52   ` Jean-Philippe Brucker
2021-11-27 16:18   ` Eric Auger
2021-11-27 16:18     ` Eric Auger
2021-11-27 16:18     ` Eric Auger
2021-11-29 15:36     ` Jean-Philippe Brucker
2021-11-29 15:36       ` Jean-Philippe Brucker
2021-11-29 15:36       ` Jean-Philippe Brucker
2021-11-23 15:53 ` [PATCH v2 3/5] iommu/virtio: Sort reserved regions Jean-Philippe Brucker
2021-11-23 15:53   ` Jean-Philippe Brucker
2021-11-23 15:53   ` Jean-Philippe Brucker
2021-11-27 17:09   ` Eric Auger
2021-11-27 17:09     ` Eric Auger
2021-11-27 17:09     ` Eric Auger
2021-11-23 15:53 ` [PATCH v2 4/5] iommu/virtio: Pass end address to viommu_add_mapping() Jean-Philippe Brucker
2021-11-23 15:53   ` Jean-Philippe Brucker
2021-11-23 15:53   ` Jean-Philippe Brucker
2021-11-27 17:09   ` Eric Auger
2021-11-27 17:09     ` Eric Auger
2021-11-27 17:09     ` Eric Auger
2021-11-27 23:09     ` Michael S. Tsirkin
2021-11-27 23:09       ` Michael S. Tsirkin
2021-11-27 23:09       ` Michael S. Tsirkin
2021-11-29 15:42       ` Jean-Philippe Brucker [this message]
2021-11-29 15:42         ` Jean-Philippe Brucker
2021-11-29 15:42         ` Jean-Philippe Brucker
2021-11-23 15:53 ` [PATCH v2 5/5] iommu/virtio: Support identity-mapped domains Jean-Philippe Brucker
2021-11-23 15:53   ` Jean-Philippe Brucker
2021-11-23 15:53   ` Jean-Philippe Brucker
2021-11-27 17:09   ` Eric Auger
2021-11-27 17:09     ` Eric Auger
2021-11-27 17:09     ` Eric Auger
2021-11-29 15:44     ` Jean-Philippe Brucker
2021-11-29 15:44       ` Jean-Philippe Brucker
2021-11-29 15:44       ` Jean-Philippe Brucker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YaT1ACdwq1n4YBug@myrica \
    --to=jean-philippe@linaro.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jasowang@redhat.com \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=pasic@linux.ibm.com \
    --cc=sebastien.boeuf@intel.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.