xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	Paul Durrant <paul@xen.org>
Subject: Re: [Xen-devel] [PATCH v7 2/3] AMD/IOMMU: allow callers to request allocate_buffer() to skip its memset()
Date: Fri, 4 Oct 2019 15:33:30 +0200	[thread overview]
Message-ID: <11bbbd61-deec-956d-de78-c42cd2571f8f@suse.com> (raw)
In-Reply-To: <135ac304-2f46-c84a-95ce-e18516f2b36d@citrix.com>

On 04.10.2019 15:26, Andrew Cooper wrote:
> On 26/09/2019 15:29, Jan Beulich wrote:
>> The command ring buffer doesn't need clearing up front in any event.
>> Subsequently we'll also want to avoid clearing the device tables.
>>
>> While playing with functions signatures replace undue use of fixed width
>> types at the same time, and extend this to deallocate_buffer() as well.
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> ---
>> v7: New.
>>
>> --- a/xen/drivers/passthrough/amd/iommu_init.c
>> +++ b/xen/drivers/passthrough/amd/iommu_init.c
>> @@ -994,12 +994,12 @@ static unsigned int __init dt_alloc_size
>>                                               IOMMU_DEV_TABLE_ENTRY_SIZE);
>>  }
>>  
>> -static void __init deallocate_buffer(void *buf, uint32_t sz)
>> +static void __init deallocate_buffer(void *buf, unsigned long sz)
> 
> Probably best to use size_t here, being both shorter, and guaranteed not
> to require modification in the future.

I'd prefer not to without other related code also getting switched
from unsigned long to size_t.

>>  {
>> -    int order = 0;
>>      if ( buf )
>>      {
>> -        order = get_order_from_bytes(sz);
>> +        unsigned int order = get_order_from_bytes(sz);
>> +
>>          __free_amd_iommu_tables(buf, order);
>>      }
>>  }
> 
> How about simply
> 
> if ( buf )
>     __free_amd_iommu_tables(buf, get_order_from_bytes(sz));
> 
> which drops the order variable entirely?

Fine with me; I did actually consider doing so, but then decided
against to stay closer to what the code looked like before.

> Ideally with both of these modifications, Reviewed-by: Andrew Cooper
> <andrew.cooper3@citrix.com>

Thanks.

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-10-04 13:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-26 14:26 [Xen-devel] [PATCH v7 0/3] AMD IOMMU: further improvements Jan Beulich
2019-09-26 14:28 ` [Xen-devel] [PATCH v7 1/3] AMD/IOMMU: allocate one device table per PCI segment Jan Beulich
2019-10-04 13:18   ` Andrew Cooper
2019-10-04 13:30     ` Jan Beulich
2019-10-04 17:28       ` Andrew Cooper
2019-10-07 10:03         ` Jan Beulich
2019-10-07 10:19           ` Jürgen Groß
2019-10-07 10:49             ` Jan Beulich
2019-10-07 11:25               ` Jürgen Groß
2019-10-10  5:57         ` Jan Beulich
2019-10-10  6:12           ` Jürgen Groß
2019-09-26 14:29 ` [Xen-devel] [PATCH v7 2/3] AMD/IOMMU: allow callers to request allocate_buffer() to skip its memset() Jan Beulich
2019-10-04 13:26   ` Andrew Cooper
2019-10-04 13:33     ` Jan Beulich [this message]
2019-09-26 14:29 ` [Xen-devel] [PATCH v7 3/3] AMD/IOMMU: pre-fill all DTEs right after table allocation Jan Beulich
2019-10-04 13:43   ` Andrew Cooper

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=11bbbd61-deec-956d-de78-c42cd2571f8f@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=paul@xen.org \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=xen-devel@lists.xenproject.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).