All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dongli Zhang <dongli.zhang@oracle.com>
To: JBeulich@suse.com
Cc: sstabellini@kernel.org, wei.liu2@citrix.com,
	George.Dunlap@eu.citrix.com, tim@xen.org,
	dario.faggioli@citrix.com, ian.jackson@eu.citrix.com,
	xen-devel@lists.xen.org, david.vrabel@citrix.com,
	andrew.cooper3@citrix.com
Subject: Re: [PATCH v4 1/2] xen: replace complicated tlbflush check with an inline function
Date: Wed, 14 Sep 2016 15:36:31 -0700 (PDT)	[thread overview]
Message-ID: <5839332c-24ee-49b1-a345-680ecf42552c@default> (raw)

> I don't think you should pass this into the function ...
> 
> > +{
> > +    return page->u.free.need_tlbflush &&
> > +           page->tlbflush_timestamp <= tlbflush_current_time &&
> 
> ... and use tlbflush_current_time() here instead.

I rewrite the inline function in xen/include/xen/mm.h to:

+#include <asm/flushtlb.h>
+
+static inline bool accumulate_tlbflush(bool need_tlbflush,
+                                       const struct page_info *page,
+                                       uint32_t tlbflush_timestamp)
+{
+    return page->u.free.need_tlbflush &&
+           page->tlbflush_timestamp <= tlbflush_current_time() &&
+           (!need_tlbflush ||
+            page->tlbflush_timestamp > tlbflush_timestamp);
+}

However, to use tlbflush_current_time and "asm/flushtlb.h" would lead
to the following compiling error:

>>>>>>>>>>>>>>>>>>>>>>>>>>>
In file included from /home/zhang/test/mainline-xen/xen/include/asm/flushtlb.h:14:0,
                 from suspend.c:13:
/home/zhang/test/mainline-xen/xen/include/xen/mm.h: In function ‘accumulate_tlbflush’:
/home/zhang/test/mainline-xen/xen/include/xen/mm.h:577:12: error: implicit declaration of function ‘tlbflush_current_time’ [-Werror=implicit-function-declaration]
            page->tlbflush_timestamp <= tlbflush_current_time() &&
            ^
/home/zhang/test/mainline-xen/xen/include/xen/mm.h:577:12: error: nested extern declaration of ‘tlbflush_current_time’ [-Werror=nested-externs]
cc1: all warnings being treated as errors
make[4]: *** [suspend.o] Error 1
>>>>>>>>>>>>>>>>>>>>>>>>>>>

I can workaround the issue by removing "#include <asm/flushtlb.h>" from
xen/arch/x86/acpi/suspend.c and then everything works fine.


Can I just rewrite the inline function to a #define macro? This minimizes the
changes to the code.

+#define accumulate_tlbflush(need_tlbflush, page, tlbflush_timestamp) \
+    (page)->u.free.need_tlbflush &&                                  \
+    (page)->tlbflush_timestamp <= tlbflush_current_time() &&         \
+    (!need_tlbflush ||                                               \
+     (page)->tlbflush_timestamp > tlbflush_timestamp)

Thank you very much!

Dongli Zhang

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

             reply	other threads:[~2016-09-14 22:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-14 22:36 Dongli Zhang [this message]
2016-09-15  6:04 ` [PATCH v4 1/2] xen: replace complicated tlbflush check with an inline function Jan Beulich
  -- strict thread matches above, loose matches on Subject: below --
2016-09-15  6:47 Dongli Zhang
2016-09-15  6:59 ` Jan Beulich
2016-09-12  8:16 Dongli Zhang
2016-09-14 16:16 ` 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=5839332c-24ee-49b1-a345-680ecf42552c@default \
    --to=dongli.zhang@oracle.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dario.faggioli@citrix.com \
    --cc=david.vrabel@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.