[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2.1 8/7] x86/IOMMU: Use altcall, and __initconst_cf_clobber


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • Date: Tue, 22 Feb 2022 11:02:01 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kniru7UUq5sbp91+M9o0hzmiMH/8Lnx9Ms8q/C2jHjI=; b=PZ+sa4LFKQb2z3nXeofuZ/vcnK0g/KtQWUQ6Qt5Bmk8lqUNOj5bK/k3QhN2Z5wcg8rzbaiKQmaCm722nrbtInRa0oLvZ1ZE7bIbiDYvwn+MiS5XCXGegZUsdIns15Drecu4V95HxnFpp+CnC/chP0uPsutK5wjBseBNCvLsP4wEAqzYXDgY+y57H7baW5ltrcnZSO07GMQwxIjDuQtRKsnQvAXrNQ2KybL2+KyOE6g6UlmzAWwrlvKWSheOjHkKMGq76mBY/4NzOop5Su308chofixt9kQs191cfa3alGzHbjsJdxfbi6oWVlR0DC/mo8y2qBRsWO373GI9WMOLOtA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fSI3nZYTiQeYs9Rifchpm5/IC8B3fG6bp1zkKEyd/3CJ+uOvoC8J27Ftkze7kvjXufIipmbuqL9IoxoB6NIWZ/OvyuiulOepjCtQLzGiRA3ey5Pm82pV9kCSS1gDZhCdtsWiNKhkCNX02oyGOSqGQ0zDxi9tyOXJoc1+50nDAAmz3nt+HRZpwz+5euPO/f46ntZCZvzXP/PnzGNexoaUy5ha/k51JQxuHvXOPGnHpoaqQbWU+TQsoDp+c/Gs36DL2qKo5YR5466q+00F0qLrXKa+TruEknCZQb0fLVrEGa7BQ2abPGf9bnFQXjukY4/OpFcLnc+okPNJ9K604AFyTg==
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 22 Feb 2022 11:02:13 +0000
  • Ironport-data: A9a23:3XDAaqrNupuwWC0cUSQXmLroRlZeBmIKZRIvgKrLsJaIsI4StFCzt garIBmGbKyOZWX9e9xzaoqw8B9XvceEy9VjTldp+3swRHgVpJuZCYyVIHmrMnLJJKUvbq7GA +byyDXkBJppJpMJjk71atANlVEliefQAOCU5NfsYkidfyc9IMsaoU8ly75RbrJA24DjWVvX4 4mq+aUzBXf+s9JKGjNMg068gEsHUMTa4Fv0aXRnOJinFHeH/5UkJMp3yZOZdhMUcaENdgKOf M7RzanRw4/s10xF5uVJMFrMWhZirrb6ZWBig5fNMkSoqkAqSicais7XOBeAAKv+Zvrgc91Zk b1wWZKMpQgBO7DXw9ZaCh5jSjB8Hv1l/4XfHWiYmJnGp6HGWyOEL/RGCUg3OcsT+/ptAHEI/ vsdQNwPRknd3aTsmuv9E7QywJR4RCXoFNp3VnVI5DfVF/s5B7vERL3H/4Rw1zYsnMFeW/3ZY qL1bBIxMkWeO0QQYT/7DroArLyGiXjZIwRKi27Oh6kTw2Hhwzxuhe2F3N39JYXRGJQ9clyjj nLL+SH1Dw8XMPSbyCGZ6TS8i+nXhyT5VYkOUrqi+ZZCn1m71mEVThoMWjOTo/O0l0q/UNJ3M FEP92wlqq1ayaCwZoCjBVvi+ifC50NCHYoLewEn1O2T4q/J+F2rQTEDdWdQav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DsFb0BOXjKt5nriY9Frt2CadgN1t8/iZ 7BWFRXuSo7fF/vE9SH2NlR/hXEUAyGLELQIwFllu9EU5HHNcjW2He4OSMTeuOb0oAiPvE=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHYJ011tWngdwKc2UG3RuxDqKou56yfTukAgAAXlACAAAIiAA==
  • Thread-topic: [PATCH v2.1 8/7] x86/IOMMU: Use altcall, and __initconst_cf_clobber

On 22/02/2022 10:54, Andrew Cooper wrote:
> On 22/02/2022 09:29, Jan Beulich wrote:
>> On 21.02.2022 19:03, Andrew Cooper wrote:
>>> Most IOMMU hooks are already altcall for performance reasons.  Convert the
>>> rest of them so we can harden all the hooks in Control Flow Integrity
>>> configurations.  This necessitates the use of iommu_{v,}call() in debug 
>>> builds
>>> too.
>>>
>>> Move the root iommu_ops from __read_mostly to __ro_after_init now that the
>>> latter exists.  There is no need for a forward declaration of vtd_ops any
>>> more, meaning that __initconst_cf_clobber can be used for VTD and AMD.
>> The connection between the forward declaration and the annotation addition
>> isn't really clear to me.
>>
>>> --- a/xen/arch/x86/include/asm/iommu.h
>>> +++ b/xen/arch/x86/include/asm/iommu.h
>>> @@ -72,7 +72,6 @@ struct arch_iommu
>>>  
>>>  extern struct iommu_ops iommu_ops;
>>>  
>>> -#ifdef NDEBUG
>>>  # include <asm/alternative.h>
>>>  # define iommu_call(ops, fn, args...) ({      \
>>>      (void)(ops);                              \
>>> @@ -83,7 +82,6 @@ extern struct iommu_ops iommu_ops;
>>>      (void)(ops);                              \
>>>      alternative_vcall(iommu_ops.fn, ## args); \
>>>  })
>>> -#endif
>>>  
>>>  static inline const struct iommu_ops *iommu_get_ops(void)
>>>  {
>>> @@ -106,7 +104,7 @@ int iommu_setup_hpet_msi(struct msi_desc *);
>>>  static inline int iommu_adjust_irq_affinities(void)
>>>  {
>>>      return iommu_ops.adjust_irq_affinities
>>> -           ? iommu_ops.adjust_irq_affinities()
>>> +           ? iommu_call(iommu_ops, adjust_irq_affinities)
>> While this (and other instances below) is x86-only code, where - with
>> the removal of the #ifdef above - we now know the first argument is
>> always ignored, I think it would still better be of the correct type
>> (&iommu_ops). Perhaps the "(void)(ops)" in the macro definitions would
>> better become "ASSERT((ops) == &iommu_ops)", which would check both
>> type (compile time) and value (runtime).
> I'm happy to fold that change if you want.  It ought to optimise out
> completely for being

Bah - sent too early.  "for being tautological."

~Andrew

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.