[Xen-devel] [PATCH] x86/mem_sharing: Fix RANDCONFIG build

Andrew Cooper posted 1 patch 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/xen tags/patchew/20200107134943.21063-1-andrew.cooper3@citrix.com
xen/arch/x86/mm/mem_sharing.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

[Xen-devel] [PATCH] x86/mem_sharing: Fix RANDCONFIG build

Posted by Andrew Cooper 1 week ago
Travis reports: https://travis-ci.org/andyhhp/xen/jobs/633751811

  mem_sharing.c:361:13: error: 'rmap_has_entries' defined but not used [-Werror=unused-function]
   static bool rmap_has_entries(const struct page_info *page)
               ^
  cc1: all warnings being treated as errors

This happens in a release build (disables MEM_SHARING_AUDIT) when
CONFIG_MEM_SHARING is enabled.

Mark the helper as maybe_unused.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Tamas K Lengyel <tamas@tklengyel.com>

The alternative is to delete the helper and opencode it for its one caller.
---
 xen/arch/x86/mm/mem_sharing.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c
index ddf1f0f9f9..0a1550ffd2 100644
--- a/xen/arch/x86/mm/mem_sharing.c
+++ b/xen/arch/x86/mm/mem_sharing.c
@@ -358,7 +358,7 @@ static bool rmap_has_one_entry(const struct page_info *page)
 }
 
 /* Returns true if the rmap has any entries. O(1) complexity. */
-static bool rmap_has_entries(const struct page_info *page)
+static bool __maybe_unused rmap_has_entries(const struct page_info *page)
 {
     return rmap_count(page) != 0;
 }
-- 
2.11.0


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

Re: [Xen-devel] [PATCH] x86/mem_sharing: Fix RANDCONFIG build

Posted by Tamas K Lengyel 1 week ago
On Tue, Jan 7, 2020 at 6:49 AM Andrew Cooper <andrew.cooper3@citrix.com> wrote:
>
> Travis reports: https://travis-ci.org/andyhhp/xen/jobs/633751811
>
>   mem_sharing.c:361:13: error: 'rmap_has_entries' defined but not used [-Werror=unused-function]
>    static bool rmap_has_entries(const struct page_info *page)
>                ^
>   cc1: all warnings being treated as errors
>
> This happens in a release build (disables MEM_SHARING_AUDIT) when
> CONFIG_MEM_SHARING is enabled.

My bad, seemed to have missed this somehow.

>
> Mark the helper as maybe_unused.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Tamas K Lengyel <tamas@tklengyel.com>
>
> The alternative is to delete the helper and opencode it for its one caller.

IMHO that would be better, no reason to keep this trivial check as a
separate function for one caller. Same stands for the
rmap_has_one_entry function as well (feel free to bunch that in too
but I could also do that separately).

Thanks,
Tamas

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