From patchwork Thu Dec 8 16:00:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 9466609 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 32ED2607D3 for ; Thu, 8 Dec 2016 16:02:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FDE028526 for ; Thu, 8 Dec 2016 16:02:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12279285B3; Thu, 8 Dec 2016 16:02:56 +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 9B9C328526 for ; Thu, 8 Dec 2016 16:02:54 +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 1cF17V-0004Qw-0w; Thu, 08 Dec 2016 16:00:29 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cF17T-0004Qo-JI for xen-devel@lists.xenproject.org; Thu, 08 Dec 2016 16:00:27 +0000 Received: from [85.158.137.68] by server-5.bemta-3.messagelabs.com id A0/57-02095-A9389485; Thu, 08 Dec 2016 16:00:26 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrBIsWRWlGSWpSXmKPExsXS6fjDS3dWs2e EwZM5fBbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8a66f+YCyZYVtw79JylgfG6VhcjJ4eQQJ7E 386LbCA2r4CdxPozdxlBbAkBQ4mn768DxTk4WARUJe6ftAIJswmoS7Q9284KEhYRMJA4dzSpi 5GLg1ngKpNE0+KV7CA1wgLuEmsfzWQHqRECGrn5TCZImFPAXuLyrEeMIGFeAUGJvzuEQcLMQB X7dt9lncDIMwshMwtJBsLWknj46xYLhK0tsWzha2aQcmYBaYnl/zggwvYSX96+YUZVAmJ7SZx bvIx5ASPHKkaN4tSistQiXUNjvaSizPSMktzEzBxdQwNjvdzU4uLE9NScxKRiveT83E2MwFBl AIIdjNu2ex5ilORgUhLl3TXBPUKILyk/pTIjsTgjvqg0J7X4EKMGB4fAtl2rLzBKseTl56UqS fB6N3lGCAkWpaanVqRl5gCjCaZUgoNHSYTXFCTNW1yQmFucmQ6ROsWoKCXO6wmSEABJZJTmwb XBIvgSo6yUMC8j0FFCPAWpRbmZJajyrxjFORiVhHnLQabwZOaVwE1/BbSYCWjxvBvuIItLEhF SUg2Mq3X/H0/t2xRwUCbvp8GLxsK/k2UE2+4XXJmetGJ9Pnf3r4NfRV2sUmteSzf2luhoLBFc +FMqJcPMw2x1ztR3myIMK07aZ06urGjUWxKtfePrjZWvb6irC50+cvRw9dV22aSEuvgT+wK/p DWdyZ8o6fNH/LHZrPYdu6+7zedPsOk6H1rr/1JaiaU4I9FQi7moOBEA625dbNsCAAA= X-Env-Sender: JBeulich@suse.com X-Msg-Ref: server-6.tower-31.messagelabs.com!1481212823!48823855!1 X-Originating-IP: [137.65.248.74] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.0.16; banners=-,-,- X-VirusChecked: Checked Received: (qmail 9859 invoked from network); 8 Dec 2016 16:00:25 -0000 Received: from prv-mh.provo.novell.com (HELO prv-mh.provo.novell.com) (137.65.248.74) by server-6.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 8 Dec 2016 16:00:25 -0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Thu, 08 Dec 2016 09:00:23 -0700 Message-Id: <584991A70200007800126E30@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.1 Date: Thu, 08 Dec 2016 09:00:23 -0700 From: "Jan Beulich" To: "xen-devel" References: <584990450200007800126E1A@prv-mh.provo.novell.com> In-Reply-To: <584990450200007800126E1A@prv-mh.provo.novell.com> Mime-Version: 1.0 Cc: Stefano Stabellini , Wei Liu , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall Subject: [Xen-devel] [PATCH 1/3] make tlbflush_filter()'s first parameter a pointer 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 This brings it in line with most other functions dealing with CPU masks. Convert both implementations to inline functions at once. Signed-off-by: Jan Beulich make tlbflush_filter()'s first parameter a pointer This brings it in line with most other functions dealing with CPU masks. Convert both implementations to inline functions at once. Signed-off-by: Jan Beulich --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -2514,7 +2514,7 @@ static int __get_page_type(struct page_i cpumask_copy(&mask, d->domain_dirty_cpumask); /* Don't flush if the timestamp is old enough */ - tlbflush_filter(mask, page->tlbflush_timestamp); + tlbflush_filter(&mask, page->tlbflush_timestamp); if ( unlikely(!cpumask_empty(&mask)) && /* Shadow mode: track only writable pages. */ --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -1471,7 +1471,7 @@ mfn_t shadow_alloc(struct domain *d, /* Before we overwrite the old contents of this page, * we need to be sure that no TLB holds a pointer to it. */ cpumask_copy(&mask, d->domain_dirty_cpumask); - tlbflush_filter(mask, sp->tlbflush_timestamp); + tlbflush_filter(&mask, sp->tlbflush_timestamp); if ( unlikely(!cpumask_empty(&mask)) ) { perfc_incr(shadow_alloc_tlbflush); --- a/xen/include/asm-arm/flushtlb.h +++ b/xen/include/asm-arm/flushtlb.h @@ -8,9 +8,7 @@ * TLB since @page_timestamp. */ /* XXX lazy implementation just doesn't clear anything.... */ -#define tlbflush_filter(mask, page_timestamp) \ -do { \ -} while ( 0 ) +static inline void tlbflush_filter(cpumask_t *mask, uint32_t page_timestamp) {} #define tlbflush_current_time() (0) --- a/xen/include/asm-x86/flushtlb.h +++ b/xen/include/asm-x86/flushtlb.h @@ -50,13 +50,14 @@ static inline int NEED_FLUSH(u32 cpu_sta * Filter the given set of CPUs, removing those that definitely flushed their * TLB since @page_timestamp. */ -#define tlbflush_filter(mask, page_timestamp) \ -do { \ - unsigned int cpu; \ - for_each_cpu ( cpu, &(mask) ) \ - if ( !NEED_FLUSH(per_cpu(tlbflush_time, cpu), page_timestamp) ) \ - cpumask_clear_cpu(cpu, &(mask)); \ -} while ( 0 ) +static inline void tlbflush_filter(cpumask_t *mask, uint32_t page_timestamp) +{ + unsigned int cpu; + + for_each_cpu ( cpu, mask ) + if ( !NEED_FLUSH(per_cpu(tlbflush_time, cpu), page_timestamp) ) + cpumask_clear_cpu(cpu, mask); +} void new_tlbflush_clock_period(void); --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -588,9 +588,10 @@ static inline void accumulate_tlbflush(b static inline void filtered_flush_tlb_mask(uint32_t tlbflush_timestamp) { - cpumask_t mask = cpu_online_map; + cpumask_t mask; - tlbflush_filter(mask, tlbflush_timestamp); + cpumask_copy(&mask, &cpu_online_map); + tlbflush_filter(&mask, tlbflush_timestamp); if ( !cpumask_empty(&mask) ) { perfc_incr(need_flush_tlb_flush); Reviewed-by: Andrew Cooper Reviewed-by: Wei Liu Acked-by: Julien Grall --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -2514,7 +2514,7 @@ static int __get_page_type(struct page_i cpumask_copy(&mask, d->domain_dirty_cpumask); /* Don't flush if the timestamp is old enough */ - tlbflush_filter(mask, page->tlbflush_timestamp); + tlbflush_filter(&mask, page->tlbflush_timestamp); if ( unlikely(!cpumask_empty(&mask)) && /* Shadow mode: track only writable pages. */ --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -1471,7 +1471,7 @@ mfn_t shadow_alloc(struct domain *d, /* Before we overwrite the old contents of this page, * we need to be sure that no TLB holds a pointer to it. */ cpumask_copy(&mask, d->domain_dirty_cpumask); - tlbflush_filter(mask, sp->tlbflush_timestamp); + tlbflush_filter(&mask, sp->tlbflush_timestamp); if ( unlikely(!cpumask_empty(&mask)) ) { perfc_incr(shadow_alloc_tlbflush); --- a/xen/include/asm-arm/flushtlb.h +++ b/xen/include/asm-arm/flushtlb.h @@ -8,9 +8,7 @@ * TLB since @page_timestamp. */ /* XXX lazy implementation just doesn't clear anything.... */ -#define tlbflush_filter(mask, page_timestamp) \ -do { \ -} while ( 0 ) +static inline void tlbflush_filter(cpumask_t *mask, uint32_t page_timestamp) {} #define tlbflush_current_time() (0) --- a/xen/include/asm-x86/flushtlb.h +++ b/xen/include/asm-x86/flushtlb.h @@ -50,13 +50,14 @@ static inline int NEED_FLUSH(u32 cpu_sta * Filter the given set of CPUs, removing those that definitely flushed their * TLB since @page_timestamp. */ -#define tlbflush_filter(mask, page_timestamp) \ -do { \ - unsigned int cpu; \ - for_each_cpu ( cpu, &(mask) ) \ - if ( !NEED_FLUSH(per_cpu(tlbflush_time, cpu), page_timestamp) ) \ - cpumask_clear_cpu(cpu, &(mask)); \ -} while ( 0 ) +static inline void tlbflush_filter(cpumask_t *mask, uint32_t page_timestamp) +{ + unsigned int cpu; + + for_each_cpu ( cpu, mask ) + if ( !NEED_FLUSH(per_cpu(tlbflush_time, cpu), page_timestamp) ) + cpumask_clear_cpu(cpu, mask); +} void new_tlbflush_clock_period(void); --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -588,9 +588,10 @@ static inline void accumulate_tlbflush(b static inline void filtered_flush_tlb_mask(uint32_t tlbflush_timestamp) { - cpumask_t mask = cpu_online_map; + cpumask_t mask; - tlbflush_filter(mask, tlbflush_timestamp); + cpumask_copy(&mask, &cpu_online_map); + tlbflush_filter(&mask, tlbflush_timestamp); if ( !cpumask_empty(&mask) ) { perfc_incr(need_flush_tlb_flush);