From: Michael Ellerman <mpe@ellerman•id.au>
To: Alexey Kardashevskiy <aik@ozlabs•ru>,
David Gibson <david@gibson•dropbear.id.au>
Cc: linuxppc-dev@lists•ozlabs.org,
Jonas Pfefferle1 <JPF@zurich•ibm.com>,
Nicholas Piggin <npiggin@gmail•com>
Subject: Re: [PATCH kernel] powerpc/powernv/ioda: Relax max DMA window size check
Date: Mon, 06 Nov 2017 21:45:34 +1100 [thread overview]
Message-ID: <877ev3bs8h.fsf@concordia.ellerman.id.au> (raw)
In-Reply-To: <fd1a289f-6698-0b84-eab8-d4c67290bea8@ozlabs.ru>
Alexey Kardashevskiy <aik@ozlabs•ru> writes:
> On 31/10/17 15:04, Alexey Kardashevskiy wrote:
>> DMA windows can only have a size of power of two on IODA2 hardware and
>> using memory_hotplug_max() to determine the upper limit won't work
>> correcly if it returns not power of two value.
>>
>> This relaxes the check by rounding up the value returned by
>> memory_hotplug_max().
>>
>> It is expected to impact DPDK on machines with non-power-of-two RAM size,
>> mostly. KVM guests are less likely to be affected as usually guests get
>> less than half of hosts RAM.
>
>
> It was pointed out that this check is quite useless anyway as the vm_locked
> memory limit should hit first, and if that is not set or the user got the
> root privilege level, then there are easier ways to crash the host so I am
> thinking of:
>
>
> diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c
> b/arch/powerpc/platforms/powernv/pci-ioda.c
> index 269f119e4b3c..a47e4cf343b2 100644
> --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> @@ -2769,7 +2769,7 @@ static long pnv_pci_ioda2_table_alloc_pages(int nid,
> __u64 bus_offset,
> if (!levels || (levels > POWERNV_IOMMU_MAX_LEVELS))
> return -EINVAL;
>
> - if ((window_size > memory_hotplug_max()) ||
> !is_power_of_2(window_size))
> + if (!is_power_of_2(window_size))
> return -EINVAL;
>
>
>
> Makes sense?
Sounds reasonable.
Execpt where is the vm_locked check? I think it's in the VFIO driver? If
so I guess the only concern is that this code might be called via some
other path that doesn't do that check.
cheers
next prev parent reply other threads:[~2017-11-06 10:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-31 4:04 [PATCH kernel] powerpc/powernv/ioda: Relax max DMA window size check Alexey Kardashevskiy
2017-11-01 6:38 ` Alexey Kardashevskiy
2017-11-06 10:45 ` Michael Ellerman [this message]
2017-11-06 11:51 ` Jonas Pfefferle1
2017-11-07 2:19 ` Alexey Kardashevskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877ev3bs8h.fsf@concordia.ellerman.id.au \
--to=mpe@ellerman$(echo .)id.au \
--cc=JPF@zurich$(echo .)ibm.com \
--cc=aik@ozlabs$(echo .)ru \
--cc=david@gibson$(echo .)dropbear.id.au \
--cc=linuxppc-dev@lists$(echo .)ozlabs.org \
--cc=npiggin@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox