[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/5] common/vmap: Fall back to simple allocator when !HAS_VMAP
- To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
- From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
- Date: Fri, 15 Nov 2024 12:15:49 +0000
- Accept-language: en-GB, en-US
- Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
- Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FtTnIVpOitl2YQjYKKBIUIuxO1v6rdHSIPzyPGhQK/s=; b=hHEqsw64HlWcCJP3bYucMWgqTNlvWkEJd1gBtp6EiEI4T6hPpx0/TDJYI+vgNJHrhsWY7Mv6ayhUWLhpoVBS60KRsjnnJQ8X1zR3Ap3HBiatVbtzckELt1FsSsLyuYxYjQdO9ysCkQJ8aWTi4nJJk1yvbPQ/rxv1jyxPEL1hg+wq3WwU0eYCVSufmIAmZ36j3mJ6u7KWiPz0DrCUM27695+ffLG75hhoqCcStwTn2ctdo4Bt/pUHZCoAeMZokXfI6JJt9hLJU0aiPU6NfVg01LtJ8vVCiKa41xw8mlGTNAKb/Ndw8TK4tyhPu3rxUI9tf6KaOU5CPYHMu6q9Pg6Viw==
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FtTnIVpOitl2YQjYKKBIUIuxO1v6rdHSIPzyPGhQK/s=; b=sEknYNeMNSkSYQoZeL0pHtMlSc2kfL5W7pvU6BH8JBK7z/DYik0hlj72BrRigwT/t3+nTY7BZNkU93EQ//sEEALv/Cqqg/ebXqGoZeYoG3Cl25gjNs7EmoWwutfjHCyHNNZM/PNTfh/bymVQTDxrkBonEXLcELHYurUf5zziHKXarztQoeqZ9khYA54CED613bht+HqckniLUbBhJAOuXJRSVPTr8lp1rwESUvAonbUMnBfsizQOMaD9fP6wspH8p3OFiJ8LIzOxmVf+esCVTKsp6fTjtWtlwA7QGlPkCasLd6mQuf8lddVsYs362J1LIZMK7FpsXvfE1Um2RhO6JA==
- Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=eCUc0At5TJaGd+CPC/4cueqqnL453K+y9HbljTKYP3qUMM19gd57k0MUr9fxTSR53vH0JXCc9kE9/B6iPvQVg3l9le0JljWwoyHO+bgnkpb22yjNt+cb9gvNDzQB7e60o/rh7hDKscSKho8RP1M0nfOMyN8qEcDdWpehJOzzCP/NBjhKBGX5QkHYAVX1wxCvSTVSeWfa4JCSXDQ41shfA37MA+4DV5q1euhsUiOOFCeOcrNvHnBqSlLb+plJTfSW/D6KCt3pYf0FUVvG4j4GNZLf5u7PSfNSicgLgPoQS1awUEsNBWjvTP4X8B080A7tlhbO/gPUBX6DoboryvTnNQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Bhnzlff1UqzKgMQpo1GwhJkfYpC0pqg/uryxHgy3zZwjg4dEwvKcNu9bRmQWe9WNuJqzps1UsPj2lndJ8OZlEg4e9wS0f00056jmeVTscxsjjXM7JUZDJaz+m3IGZLZEpmcq7Ce/qZN9qzobwF8myonwNwfrNyWiQPDYvEbD3Csnr98u3TyxFLwQkY5YGFJdbMfEWGwPfMYnyy1CM+vGcGeKxRD1sl8KcpSNO42RI2AMyWE1VAvYdt8qQd5DBY3YLwlIjOo1ucstl2g9UnkBRkCrjtQo2a+MlbFkqWdy/vQBapOtsCvzl0cgerOhjUnG6zx7hXFq0RenWg7JhpUTAw==
- Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
- Delivery-date: Fri, 15 Nov 2024 12:16:10 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Nodisclaimer: true
- Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Thread-index: AQHbN0xEMVIvN3HbzEuhbXugN/BCZLK4PUmAgAAELwA=
- Thread-topic: [PATCH 1/5] common/vmap: Fall back to simple allocator when !HAS_VMAP
> On 15 Nov 2024, at 12:00, Andrew Cooper <andrew.cooper3@xxxxxxxxxx> wrote:
>
> On 15/11/2024 10:50 am, Luca Fancellu wrote:
>> diff --git a/xen/include/xen/xvmalloc.h b/xen/include/xen/xvmalloc.h
>> index 440d85a284bb..802be6687085 100644
>> --- a/xen/include/xen/xvmalloc.h
>> +++ b/xen/include/xen/xvmalloc.h
>> @@ -40,20 +40,46 @@
>> ((typeof(ptr))_xvrealloc(ptr, offsetof(typeof(*(ptr)), field[nr]), \
>> __alignof__(typeof(*(ptr)))))
>>
>> +#if defined(CONFIG_HAS_VMAP)
>> +
>> /* Free any of the above. */
>> void xvfree(void *va);
>>
>> +/* Underlying functions */
>> +void *_xvmalloc(size_t size, unsigned int align);
>> +void *_xvzalloc(size_t size, unsigned int align);
>> +void *_xvrealloc(void *va, size_t size, unsigned int align);
>> +
>> +#else
>> +
>> +static inline void xvfree(void *va)
>> +{
>> + xfree(va);
>> +}
>> +
>> +void *_xvmalloc(size_t size, unsigned int align)
>> +{
>> + return _xmalloc(size, align);
>> +}
>> +
>> +void *_xvzalloc(size_t size, unsigned int align)
>> +{
>> + return _xzalloc(size, align);
>> +}
>> +
>> +void *_xvrealloc(void *va, size_t size, unsigned int align)
>> +{
>> + return _xrealloc(va, size, align);
>> +}
>> +
>> +#endif
>
> Does this really compile with the wrappers not being static inline ?
>
> That aside, could we not do this using conditional aliases, rather than
> wrapping the functions? It would certainly be shorter, code wise.
Do you mean something like below?
#define xvfree xfree
#define _xvmalloc _xmalloc
[…]
>
> ~Andrew
|