From patchwork Mon Sep 30 19:16:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 11167347 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4E4341599 for ; Mon, 30 Sep 2019 19:17:57 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1D79B224D7 for ; Mon, 30 Sep 2019 19:17:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="ExveGWeM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D79B224D7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iF19d-0004zh-4e; Mon, 30 Sep 2019 19:16:17 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iF19b-0004zc-VE for xen-devel@lists.xenproject.org; Mon, 30 Sep 2019 19:16:15 +0000 X-Inumbo-ID: c546a4d8-e3b6-11e9-bf31-bc764e2007e4 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by localhost (Halon) with ESMTPS id c546a4d8-e3b6-11e9-bf31-bc764e2007e4; Mon, 30 Sep 2019 19:16:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1569870974; h=from:to:cc:subject:date:message-id:mime-version; bh=kT5v3qDwEDFIK1RRLCLUYHKPs1WhmHSG4FkUXw03/lc=; b=ExveGWeMz7sgV27yM5VIHkTITip09Hkm8PPJ9em4z+zOfYpZLis2vGGZ HsNJ17Rpb9k0UdDbW/mjm6Ypthg6cZJFsshCvkahksdn+/Eu6eR37Y4qo IKPcRrcOlC9Lr0FKSZbOzcZAH/n34EBb5wqK55YgHziotrino2gNzsM5V Q=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa5.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: MMbKhWUDOiDVTA1uXK2Pv0AOdgvGEhMmArHmap58hex2+IPpR+aBJPwFcGIPhmsP1Nu7om3vqA YpYVhgnigwvuGqeJep7w+ql5+xvKXYAdWryAUqUIUfljwTRKXmuypk5QjKbHba0izbVXDjEE4h qWcvB/kYFm3bCN+pmMHNB2wd8qOereHUJbRAy+ISbqHZUar80BTMF9vc4Rj0uTd8pBeqvWXZYo iwW9Mz/Of8muE0CPhWzOBvW+NtD43SWKJp8EWuQBukp5I6LX3ZkMI+jVlTIBUwFi8nBSs9zwij Fgg= X-SBRS: 2.7 X-MesageID: 6513078 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,568,1559534400"; d="scan'208";a="6513078" From: Andrew Cooper To: Xen-devel Date: Mon, 30 Sep 2019 20:16:10 +0100 Message-ID: <20190930191610.27545-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] xen/typesafe: Force helpers to be always_inline X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Stefano Stabellini , Julien Grall , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Tim Deegan , Jan Beulich , Ian Jackson Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Clang in particular has a habit of out-of-lining these and creating multiple local copies of _mfn() and mfn_x(), etc. Override this behaviour. Adjust bool_t to bool for the *_eq() helpers. Signed-off-by: Andrew Cooper --- CC: George Dunlap CC: Ian Jackson CC: Jan Beulich CC: Konrad Rzeszutek Wilk CC: Stefano Stabellini CC: Tim Deegan CC: Wei Liu CC: Julien Grall CC: Juergen Gross Spotted while looking at the code generation of evalute_nospec() Semi-RFC for-4.13. Nothing (currently un-broken) will break without this, but it is a step on the way to being able to use Clang and Livepatch in combination. --- xen/include/xen/iommu.h | 4 ++-- xen/include/xen/mm.h | 16 ++++++++-------- xen/include/xen/typesafe.h | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h index 974bd3ffe8..c77b8c1a22 100644 --- a/xen/include/xen/iommu.h +++ b/xen/include/xen/iommu.h @@ -42,12 +42,12 @@ TYPE_SAFE(uint64_t, dfn); #undef dfn_x #endif -static inline dfn_t dfn_add(dfn_t dfn, unsigned long i) +static always_inline dfn_t dfn_add(dfn_t dfn, unsigned long i) { return _dfn(dfn_x(dfn) + i); } -static inline bool_t dfn_eq(dfn_t x, dfn_t y) +static always_inline bool dfn_eq(dfn_t x, dfn_t y) { return dfn_x(x) == dfn_x(y); } diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index 8d0ddfb60c..5617ecc607 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -77,22 +77,22 @@ TYPE_SAFE(unsigned long, mfn); #undef mfn_x #endif -static inline mfn_t mfn_add(mfn_t mfn, unsigned long i) +static always_inline mfn_t mfn_add(mfn_t mfn, unsigned long i) { return _mfn(mfn_x(mfn) + i); } -static inline mfn_t mfn_max(mfn_t x, mfn_t y) +static always_inline mfn_t mfn_max(mfn_t x, mfn_t y) { return _mfn(max(mfn_x(x), mfn_x(y))); } -static inline mfn_t mfn_min(mfn_t x, mfn_t y) +static always_inline mfn_t mfn_min(mfn_t x, mfn_t y) { return _mfn(min(mfn_x(x), mfn_x(y))); } -static inline bool_t mfn_eq(mfn_t x, mfn_t y) +static always_inline bool mfn_eq(mfn_t x, mfn_t y) { return mfn_x(x) == mfn_x(y); } @@ -115,22 +115,22 @@ TYPE_SAFE(unsigned long, gfn); #undef gfn_x #endif -static inline gfn_t gfn_add(gfn_t gfn, unsigned long i) +static always_inline gfn_t gfn_add(gfn_t gfn, unsigned long i) { return _gfn(gfn_x(gfn) + i); } -static inline gfn_t gfn_max(gfn_t x, gfn_t y) +static always_inline gfn_t gfn_max(gfn_t x, gfn_t y) { return _gfn(max(gfn_x(x), gfn_x(y))); } -static inline gfn_t gfn_min(gfn_t x, gfn_t y) +static always_inline gfn_t gfn_min(gfn_t x, gfn_t y) { return _gfn(min(gfn_x(x), gfn_x(y))); } -static inline bool_t gfn_eq(gfn_t x, gfn_t y) +static always_inline bool gfn_eq(gfn_t x, gfn_t y) { return gfn_x(x) == gfn_x(y); } diff --git a/xen/include/xen/typesafe.h b/xen/include/xen/typesafe.h index 7ecd3b4a8d..f242500063 100644 --- a/xen/include/xen/typesafe.h +++ b/xen/include/xen/typesafe.h @@ -21,15 +21,15 @@ #define TYPE_SAFE(_type, _name) \ typedef struct { _type _name; } _name##_t; \ - static inline _name##_t _##_name(_type n) { return (_name##_t) { n }; } \ - static inline _type _name##_x(_name##_t n) { return n._name; } + static always_inline _name##_t _##_name(_type n) { return (_name##_t) { n }; } \ + static always_inline _type _name##_x(_name##_t n) { return n._name; } #else #define TYPE_SAFE(_type, _name) \ typedef _type _name##_t; \ - static inline _name##_t _##_name(_type n) { return n; } \ - static inline _type _name##_x(_name##_t n) { return n; } + static always_inline _name##_t _##_name(_type n) { return n; } \ + static always_inline _type _name##_x(_name##_t n) { return n; } #endif