From patchwork Thu Sep 15 06:47:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dongli Zhang X-Patchwork-Id: 9332851 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AA7E66077F for ; Thu, 15 Sep 2016 06:49:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92E532930E for ; Thu, 15 Sep 2016 06:49:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 87AEB29312; Thu, 15 Sep 2016 06:49:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F2EEF2930E for ; Thu, 15 Sep 2016 06:49:43 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkQSO-0001C7-9l; Thu, 15 Sep 2016 06:47:36 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkQSN-0001By-99 for xen-devel@lists.xen.org; Thu, 15 Sep 2016 06:47:35 +0000 Received: from [85.158.139.211] by server-14.bemta-5.messagelabs.com id 5D/8D-11508-6044AD75; Thu, 15 Sep 2016 06:47:34 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrMIsWRWlGSWpSXmKPExsXSO6nOVZfV5Va 4wZRuY4slHxezODB6HN39mymAMYo1My8pvyKBNePQw7ksBYtlKtZ/2sHUwHhfrIuRi0NIYCKT xNYpv5ggnN+MEv1Pt7NAOBsYJZau+QfkcHLwCghKnJz5BMq2krj3aR2YzSKgLfH8/S9WEJtNQ Edi2oFTYHERAQmJzY1LGUFsZoGVTBKn3hiD2MICMRKbXjWB1UgIKEn829oNZHMA1ahLrJ8nBF GuLbFs4WtmiLC0xPJ/HBDVhhKfNy5lnsDIPwvJQbMQmmchaZ6F0LyAkWUVo3pxalFZapGupV5 SUWZ6RkluYmaOrqGBqV5uanFxYnpqTmJSsV5yfu4mRmBgMgDBDsa1rc6HGCU5mJREeafa3woX 4kvKT6nMSCzOiC8qzUktPsQow8GhJMHL6AyUEyxKTU+tSMvMAcYITFqCg0dJhNcEJM1bXJCYW 5yZDpE6xagoJc573wkoIQCSyCjNg2uDxeUlRlkpYV5GoEOEeApSi3IzS1DlXzGKczAqCfOeB5 nCk5lXAjf9FdBiJqDFW9ZcB1lckoiQkmpgNOIWsf9wTLnO5XTGLGYu9wL3pZEBRX9Zy6NcJIy mvpS54nv2wFdNk6TvvW6iIVuEFjtKxj5v2K/wSXafj5CG6aE/CdHRfw4FssY9/nqrLtyC9Xjd gtyaOfy/DC73L5c9tuOYUGCdSuV9jQfOMz3vT9v4VyA/95tp2vba6wdElbwUj6xUW/9ciaU4I 9FQi7moOBEAqoFW3cYCAAA= X-Env-Sender: dongli.zhang@oracle.com X-Msg-Ref: server-10.tower-206.messagelabs.com!1473922052!42481510!1 X-Originating-IP: [141.146.126.69] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTQxLjE0Ni4xMjYuNjkgPT4gMjc3MjE4\n X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 56994 invoked from network); 15 Sep 2016 06:47:33 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-10.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 15 Sep 2016 06:47:33 -0000 Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u8F6lRno032731 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Sep 2016 06:47:27 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.13.8) with ESMTP id u8F6lR12018913 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 15 Sep 2016 06:47:27 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id u8F6lQur003390; Thu, 15 Sep 2016 06:47:26 GMT MIME-Version: 1.0 Message-ID: <03fcb067-90e8-4f24-850a-3240d474a446@default> Date: Wed, 14 Sep 2016 23:47:25 -0700 (PDT) From: Dongli Zhang To: X-Mailer: Zimbra on Oracle Beehive Content-Disposition: inline X-Source-IP: userv0022.oracle.com [156.151.31.74] 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: [Xen-devel] [PATCH v4 1/2] xen: replace complicated tlbflush check with an inline function X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP > > I rewrite the inline function in xen/include/xen/mm.h to: > > > > +#include > > + > > +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 " from > > xen/arch/x86/acpi/suspend.c and then everything works fine. > Removing? You should _add_ asm/tlbflush.h inclusion to xen/mm.h. As mentioned in previous email, there was a compiling error from suspend.c:13 even after asm/tlbflush.h is added to xen/mm.h The compiling error is bypassed if I remove the include of asm/flushtlb.h from suspend.c. The following patch can make the inline function work while avoiding compiling error. Since asm/flushtlb.h depends on get_order_from_bytes in xen/mm.h, it is included after get_order_from_bytes in xen/mm.h. If removing asm/flushtlb.h in suspend.c is not preferred, the other two options I have are (1) use #define macro (2) pass tlbflush_current_time() as an arg in accumulate_tlbflush. Thank you very much! Dongli Zhang diff --git a/xen/arch/x86/acpi/suspend.c b/xen/arch/x86/acpi/suspend.c index 1d8344c..d5c67ee 100644 --- a/xen/arch/x86/acpi/suspend.c +++ b/xen/arch/x86/acpi/suspend.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index 58bc0b8..03bcbc3 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -567,4 +567,16 @@ int prepare_ring_for_helper(struct domain *d, unsigned long gmfn, struct page_info **_page, void **_va); void destroy_ring_for_helper(void **_va, struct page_info *page); +#include + +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); +} + #endif /* __XEN_MM_H__ */