Re: [Xen-devel] [RFC 07/11] Add kernel helper functions

2018-02-08 Thread Sameer Goel

On 1/2/2018 2:28 AM, manish.ja...@linaro.org wrote:
> From: Manish Jaggi 
>
> Add kalloc kfree functions from linux kernel.
>
> Signed-off-by: Manish Jaggi 
> ---
>  xen/include/xen/kernel.h | 10 ++
>  1 file changed, 10 insertions(+)
>
> diff --git a/xen/include/xen/kernel.h b/xen/include/xen/kernel.h
> index 548b64da9f..78517f6caa 100644
> --- a/xen/include/xen/kernel.h
> +++ b/xen/include/xen/kernel.h
> @@ -7,6 +7,16 @@
>  
>  #include 
>  
You might want to swap 06 and 07. Once you do that I can remove the following 
defines from kernel.h
> +/* Xen: Define compatibility functions */
> +#define FW_BUG "[Firmware Bug]: "
> +#define pr_err(fmt, ...) printk(XENLOG_ERR fmt, ## __VA_ARGS__)
> +#define pr_warn(fmt, ...) printk(XENLOG_WARNING fmt, ## __VA_ARGS__)
> +
> +/* Alias to Xen allocation helpers */
> +#define kfree xfree
> +#define kmalloc(size, flags)_xmalloc(size, sizeof(void *))
> +#define kzalloc(size, flags)_xzalloc(size, sizeof(void *))
> +
>  /*
>   * min()/max() macros that also do
>   * strict type-checking.. See the


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

Re: [Xen-devel] [RFC 07/11] Add kernel helper functions

2018-01-19 Thread Jan Beulich
>>> On 18.01.18 at 19:55,  wrote:
> On 02/01/18 09:28, manish.ja...@linaro.org wrote:
>> From: Manish Jaggi 
>> 
>> Add kalloc kfree functions from linux kernel.
> 
> This does not description all the functions you added. But I am really 
> not convinced this is the right place to do that.
> 
> This file is included in many places that should not use kmalloc & co 
> but instead Xen version.
> 
> If you still want to add it in an header, I think it would make sense to 
> create a header that will contain linuxism. So it get included only 
> where it is needed.

Indeed - if we want such helpers at all, they should be made as
invisible to any unrelated code as possible. Since Linux sources
can't normally be imported verbatim anyway, it may be best to
have such helpers near the to of affected .c files, restricted to
just the helpers that are actually needed in each individual file.
Only if this results in meaningful duplication I would consider it
reasonable to introduce a helper header.

Jan


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

Re: [Xen-devel] [RFC 07/11] Add kernel helper functions

2018-01-18 Thread Julien Grall

Hi Manish,

Please use scripts/get_maitainers.pl to CC relevant maintainers.

On 02/01/18 09:28, manish.ja...@linaro.org wrote:

From: Manish Jaggi 

Add kalloc kfree functions from linux kernel.


This does not description all the functions you added. But I am really 
not convinced this is the right place to do that.


This file is included in many places that should not use kmalloc & co 
but instead Xen version.


If you still want to add it in an header, I think it would make sense to 
create a header that will contain linuxism. So it get included only 
where it is needed.




Signed-off-by: Manish Jaggi 
---
  xen/include/xen/kernel.h | 10 ++
  1 file changed, 10 insertions(+)

diff --git a/xen/include/xen/kernel.h b/xen/include/xen/kernel.h
index 548b64da9f..78517f6caa 100644
--- a/xen/include/xen/kernel.h
+++ b/xen/include/xen/kernel.h
@@ -7,6 +7,16 @@
  
  #include 
  
+/* Xen: Define compatibility functions */

+#define FW_BUG "[Firmware Bug]: "
+#define pr_err(fmt, ...) printk(XENLOG_ERR fmt, ## __VA_ARGS__)
+#define pr_warn(fmt, ...) printk(XENLOG_WARNING fmt, ## __VA_ARGS__)
+
+/* Alias to Xen allocation helpers */
+#define kfree xfree
+#define kmalloc(size, flags)_xmalloc(size, sizeof(void *))
+#define kzalloc(size, flags)_xzalloc(size, sizeof(void *))
+
  /*
   * min()/max() macros that also do
   * strict type-checking.. See the



Cheers,

--
Julien Grall

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

[Xen-devel] [RFC 07/11] Add kernel helper functions

2018-01-02 Thread manish . jaggi
From: Manish Jaggi 

Add kalloc kfree functions from linux kernel.

Signed-off-by: Manish Jaggi 
---
 xen/include/xen/kernel.h | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/xen/include/xen/kernel.h b/xen/include/xen/kernel.h
index 548b64da9f..78517f6caa 100644
--- a/xen/include/xen/kernel.h
+++ b/xen/include/xen/kernel.h
@@ -7,6 +7,16 @@
 
 #include 
 
+/* Xen: Define compatibility functions */
+#define FW_BUG "[Firmware Bug]: "
+#define pr_err(fmt, ...) printk(XENLOG_ERR fmt, ## __VA_ARGS__)
+#define pr_warn(fmt, ...) printk(XENLOG_WARNING fmt, ## __VA_ARGS__)
+
+/* Alias to Xen allocation helpers */
+#define kfree xfree
+#define kmalloc(size, flags)_xmalloc(size, sizeof(void *))
+#define kzalloc(size, flags)_xzalloc(size, sizeof(void *))
+
 /*
  * min()/max() macros that also do
  * strict type-checking.. See the
-- 
2.14.1


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