lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6153f44c-841a-4eea-a51b-5a68c84faf47@gmail.com>
Date: Sat, 13 Apr 2024 18:59:16 +0800
From: Robert Hoo <robert.hoo.linux@...il.com>
To: Jacob Pan <jacob.jun.pan@...ux.intel.com>
Cc: LKML <linux-kernel@...r.kernel.org>, X86 Kernel <x86@...nel.org>,
 Peter Zijlstra <peterz@...radead.org>, iommu@...ts.linux.dev,
 Thomas Gleixner <tglx@...utronix.de>, Lu Baolu <baolu.lu@...ux.intel.com>,
 kvm@...r.kernel.org, Dave Hansen <dave.hansen@...el.com>,
 Joerg Roedel <joro@...tes.org>, "H. Peter Anvin" <hpa@...or.com>,
 Borislav Petkov <bp@...en8.de>, Ingo Molnar <mingo@...hat.com>,
 Paul Luse <paul.e.luse@...el.com>, Dan Williams <dan.j.williams@...el.com>,
 Jens Axboe <axboe@...nel.dk>, Raj Ashok <ashok.raj@...el.com>,
 "Tian, Kevin" <kevin.tian@...el.com>, maz@...nel.org, seanjc@...gle.com,
 Robin Murphy <robin.murphy@....com>, jim.harris@...sung.com,
 a.manzanares@...sung.com, Bjorn Helgaas <helgaas@...nel.org>,
 guang.zeng@...el.com
Subject: Re: [PATCH v2 11/13] iommu/vt-d: Make posted MSI an opt-in cmdline
 option

On 4/9/2024 7:33 AM, Jacob Pan wrote:
> Hi Robert,
> 
> On Sat, 6 Apr 2024 12:31:14 +0800, Robert Hoo <robert.hoo.linux@...il.com>
> wrote:
> 
>> On 4/6/2024 6:31 AM, Jacob Pan wrote:
>>> Add a command line opt-in option for posted MSI if
>>> CONFIG_X86_POSTED_MSI=y.
>>>
>>> Also introduce a helper function for testing if posted MSI is supported
>>> on the platform.
>>>
>>> Signed-off-by: Jacob Pan <jacob.jun.pan@...ux.intel.com>
>>> ---
>>>    Documentation/admin-guide/kernel-parameters.txt |  1 +
>>>    arch/x86/include/asm/irq_remapping.h            | 11 +++++++++++
>>>    drivers/iommu/irq_remapping.c                   | 13 ++++++++++++-
>>>    3 files changed, 24 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/Documentation/admin-guide/kernel-parameters.txt
>>> b/Documentation/admin-guide/kernel-parameters.txt index
>>> bb884c14b2f6..e5fd02423c4c 100644 ---
>>> a/Documentation/admin-guide/kernel-parameters.txt +++
>>> b/Documentation/admin-guide/kernel-parameters.txt @@ -2251,6 +2251,7 @@
>>>    			no_x2apic_optout
>>>    				BIOS x2APIC opt-out request will be
>>> ignored nopost	disable Interrupt Posting
>>> +			posted_msi enable MSIs delivered as posted
>>> interrupts
>>>    	iomem=		Disable strict checking of access to
>>> MMIO memory strict	regions from userspace.
>>> diff --git a/arch/x86/include/asm/irq_remapping.h
>>> b/arch/x86/include/asm/irq_remapping.h index 7a2ed154a5e1..e46bde61029b
>>> 100644 --- a/arch/x86/include/asm/irq_remapping.h
>>> +++ b/arch/x86/include/asm/irq_remapping.h
>>> @@ -50,6 +50,17 @@ static inline struct irq_domain
>>> *arch_get_ir_parent_domain(void) return x86_vector_domain;
>>>    }
>>>    
>>> +#ifdef CONFIG_X86_POSTED_MSI
>>> +extern int enable_posted_msi;
>>> +
>>> +static inline bool posted_msi_supported(void)
>>> +{
>>> +	return enable_posted_msi && irq_remapping_cap(IRQ_POSTING_CAP);
>>> +}
>>
>> Out of this patch set's scope, but, dropping into irq_remappping_cap(),
>> I'd like to bring this change for discussion:
>>
>> diff --git a/drivers/iommu/irq_remapping.c b/drivers/iommu/irq_remapping.c
>> index 4047ac396728..ef2de9034897 100644
>> --- a/drivers/iommu/irq_remapping.c
>> +++ b/drivers/iommu/irq_remapping.c
>> @@ -98,7 +98,7 @@ void set_irq_remapping_broken(void)
>>
>>    bool irq_remapping_cap(enum irq_remap_cap cap)
>>    {
>> -       if (!remap_ops || disable_irq_post)
>> +       if (!remap_ops || disable_irq_remap)
>>                   return false;
>>
>>           return (remap_ops->capability & (1 << cap));
>>
>>
>> 1. irq_remapping_cap() is to exam some cap, though at present it has only
>> 1 cap, i.e. IRQ_POSTING_CAP, simply return false just because of
>> disable_irq_post isn't good. Instead, IRQ_REMAP is the foundation of all
>> remapping caps. 2. disable_irq_post is used by Intel iommu code only,
>> here irq_remapping_cap() is common code. e.g. AMD iommu code doesn't use
>> it to judge set cap of irq_post or not.
> I agree, posting should be treated as a sub-capability of remapping.
> IRQ_POSTING_CAP is only set when remapping is on.
> 
> We need to delete this such that posting is always off when remapping is
> off.
> 
> --- a/drivers/iommu/intel/irq_remapping.c
> +++ b/drivers/iommu/intel/irq_remapping.c
> @@ -1038,11 +1038,7 @@ static void disable_irq_remapping(void)
>                  iommu_disable_irq_remapping(iommu);
>          }
>   
> -       /*
> -        * Clear Posted-Interrupts capability.
> -        */
> -       if (!disable_irq_post)
> -               intel_irq_remap_ops.capability &= ~(1 << IRQ_POSTING_CAP);
> +       intel_irq_remap_ops.capability &= ~(1 << IRQ_POSTING_CAP);
>   }
> 
Right.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ