xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <jbeulich@suse.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "George Dunlap" <george.dunlap@citrix.com>,
	"Ian Jackson" <iwj@xenproject.org>,
	"Julien Grall" <julien@xen.org>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [PATCH v2 0/8] assorted replacement of x[mz]alloc_bytes()
Date: Wed, 21 Apr 2021 16:23:02 +0100	[thread overview]
Message-ID: <40d373eb-d7c2-27f9-df20-a7fecbe519a5@citrix.com> (raw)
In-Reply-To: <091b4b91-712f-3526-78d1-80d31faf8e41@suse.com>

On 21/04/2021 15:54, Jan Beulich wrote:
> In the long run I think we want to do away with these type-unsafe
> interfaces, the more that they also request (typically) excess
> alignment. This series of entirely independent patches is
> eliminating the instances where it's relatively clear that they're
> not just "blob" allocations.
>
> v2 only has commit messages extended.
>
> 1: x86/MCE: avoid effectively open-coding xmalloc_array()
> 2: x86/HVM: avoid effectively open-coding xmalloc_array()
> 3: x86/oprofile: avoid effectively open-coding xmalloc_array()
> 4: x86/IRQ: avoid over-alignment in alloc_pirq_struct()
> 5: EFI/runtime: avoid effectively open-coding xmalloc_array()
> 6: kexec: avoid effectively open-coding xzalloc_flex_struct()
> 7: video/lfb: avoid effectively open-coding xzalloc_array()
> 8: Arm/optee: don't open-code xzalloc_flex_struct()

I'm tempted to nack this, but for now will go with a firm -2 to the
whole series.

It is unreasonable, at an API level, for *lloc_bytes(...) to not be
interchangeable *alloc_array(char, ...), and the former is the clearer
way of writing code.

The alignment details are internal properties, dubious at best, and
totally unreasonable for maintainer to know or care about as far as the
API is concerned.  There is also no type safety to be gained by making
the transformation.

If you want to improve the alignment, fix the allocator and the
behind-the-scenes semantics.  Don't make every callsite more complicated
to follow, and definitely don't introduce perf problems from cacheline
sharing in the name of typesafey.

~Andrew



  parent reply	other threads:[~2021-04-21 15:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-21 14:54 [PATCH v2 0/8] assorted replacement of x[mz]alloc_bytes() Jan Beulich
2021-04-21 14:56 ` [PATCH v2 1/8] x86/MCE: avoid effectively open-coding xmalloc_array() Jan Beulich
2021-04-21 14:56 ` [PATCH v2 2/8] x86/HVM: " Jan Beulich
2021-04-21 14:57 ` [PATCH v2 3/8] x86/oprofile: " Jan Beulich
2021-04-21 14:57 ` [PATCH v2 4/8] x86/IRQ: avoid over-alignment in alloc_pirq_struct() Jan Beulich
2021-04-21 14:58 ` [PATCH v2 5/8] EFI/runtime: avoid effectively open-coding x{m,z}alloc_array() Jan Beulich
2021-04-21 14:58 ` [PATCH v2 6/8] kexec: avoid effectively open-coding xzalloc_flex_struct() Jan Beulich
2021-04-21 14:59 ` [PATCH v2 7/8] video/lfb: avoid effectively open-coding xzalloc_array() Jan Beulich
2021-04-21 14:59 ` [PATCH v2 8/8] Arm/optee: don't open-code xzalloc_flex_struct() Jan Beulich
2021-05-03 13:53   ` Ping: " Jan Beulich
2021-05-04 23:49     ` Volodymyr Babchuk
2021-04-21 15:23 ` Andrew Cooper [this message]
2021-04-21 15:32   ` [PATCH v2 0/8] assorted replacement of x[mz]alloc_bytes() Jan Beulich
2021-04-23  9:44   ` Jan Beulich

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=40d373eb-d7c2-27f9-df20-a7fecbe519a5@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=iwj@xenproject.org \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --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).