[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 0/8] assorted replacement of x[mz]alloc_bytes()


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Wed, 21 Apr 2021 16:23:02 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=C0Z+6q665DSM7p7B7c7DBYWlWBKriWgml0xUqZcLMkM=; b=KBNmHYw8tYspGRczNDqJp2oHHSFKhfqgw5rb7+njeoSwnQT8sn1x7VTOrJG78Eeml5QlvQ35Ii7WbZXvJGr2ovn+eGZm4YYnNjl6zgPSyGtl73dcoZrRl60Uyt20fRuB/kr8MDH/EJR/zPTSB3XGvJwyJFWmFFPLs6s2AkG4TKeGMAVWW553jH89qZVGhXAQ8Q4lr9qGkbfdiHaAckRf3/NI5YucuHZ97P5UfE1loimoKenC8Un7PquFFETzgoUvAi/oeKjVB6qx9V8Fs6u8lUioDk69Zpx4uJqUn7ejgwCTSMcu8eC3evVhjFKK2omOX7Gehbteuj8b6KZB5LsXwA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eOvI5ztNmGyhaDy8Xaf58IIg1WVIilh9TJcS+OHWuLnrZP3qVehI1QngDl4gVc6jWcUPOFyuT/Rm8IzCTz9Mx9ep8ViwyJOSKW/zg2PJkWrKNd/IvUEYawgWqVt6ju+atiGAdBTWW/SzKqaW8cjdQpYO88+vYRstf/XdmYLqQ1+5TRVPRPiGMkxUoyzp4yGUPWxYLbSuk1QK45CUaWa4ED8EqNqihl9YxGJFrXGSeXXSErA7+hY/8CFaw6bmtaJ5uTFIKs69Tt6JHSD/f/8ULxM0YmuJpd8/rStlCkYlI8j2CHO6NW7utHcaQs/nSZ/7cl3Qhv7MOKyTZ0gOKlDCBQ==
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 21 Apr 2021 15:23:16 +0000
  • Ironport-hdrordr: A9a23:0H2OSK/HtzGyp941vK5uk+EKdb1zdoIgy1knxilNYDRIb82VkN 2vlvwH1RnyzA0cQm0khMroAsS9aFnXnKQU3aA6O7C+UA76/Fa5NY0K1/qH/xTMOQ3bstRc26 BpbrRkBLTLZ2RSoM7m7GCDfOoI78KA9MmT69v261dIYUVUZ7p77wF/Yzzrd3FeYAVdH5I2GN 69y6N81lmdUE8aZMi6GXUJNtKrz7H2vanrfAIcAFof4BSO5AnC1JfBDxOa0h0COgk/o4sKzG 6tqW3Ez5Tmid6X4Fv212jf75NZ8eGRt+drNYi3peU+bhnpggasTox9V7OFpyBdmpDS1H8a1O Pijj1lE8Nv627AXmzdm2qT5yDQlAwAxlWn6ViEjWDtqcb0LQhKdfZptMZiXTbyr28D1esMt5 5j7iaimLd8SS7kpmDb4ePFUhl7/3DE2kYKoKoooFF0FbcFZKQ5l/14wGplVK0uMQjd844dHO xnHKjnlYxrWGLfVXzfs2V1qebcJ0gbL1ODSkgGjMSfzyJbqnB/11cZ38wShB47heoAd6U=
  • Ironport-sdr: qFjFUPecEcMj/jmEThx17ss4P6SN8YocqHiq6JNEMZnc0FTpGgpT1CE8A73WOP5dqYDO7qjbEh wJ5FTAWUdAG26DUuZ0CdbUs+fto2fU4zX9zwbdetUfjKxKygriZPC+VJOKxXoDRY7gL/5vDsGr U8YnQDFOxca/D3CXLayM891iMz3v5vQFGGmdcBBOvut2pMvrMBaE13VJupcGISbOUJvYq2Md2b HOVfudCa7Yco1SUmTSTwGyV4nzTg6aHwfFmJwMexRK+jUMfzxNN18wHleB2Kcsun/pAIZB5OOH T/0=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.