From: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Mikko Perttunen <cyndis-/1wQRMveznE@public.gmane.org>,
Mikko Perttunen
<mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection
Date: Sat, 19 Aug 2017 14:11:09 +0300 [thread overview]
Message-ID: <ed7f2987-062a-fa53-6243-bd81a600e96e@gmail.com> (raw)
In-Reply-To: <6979443e-ad2b-1da6-f71c-61913242f257-/1wQRMveznE@public.gmane.org>
On 19.08.2017 13:35, Mikko Perttunen wrote:
> On 08/19/2017 01:09 PM, Dmitry Osipenko wrote:
>> On 19.08.2017 11:10, Mikko Perttunen wrote:
>> [snip]
>>>>> + host1x_hw_syncpt_set_protection(host, true);
>>>>
>>>> Is it really okay to force the protection? Maybe protection should be enabled
>>>> with a respect to CONFIG_TEGRA_HOST1X_FIREWALL? In that case we would have to
>>>> avoid software jobs validation for Tegra124+.
>>>
>>> I don't quite get your comment. The hardware syncpt protection layer being
>>> enabled should never hurt - it doesn't mess with any valid jobs. It's also only
>>> on Tegra186 so I'm not sure where the Tegra124 comes from.
>>
>> Right, it's the gather filter on T124+, my bad. This raises several questions.
>>
>> 1) Why we have CONFIG_TEGRA_HOST1X_FIREWALL? Should it be always enforced or we
>> actually want to be a bit more flexible and allow to disable it. Imagine that
>> you are making a custom application and want to utilize channels in a
>> different way.
>
> I think it should be up to the user to decide whether they want the firewall or
> not. It's clearly the most useful on the older chips - especially Tegra20 due to
> lack of IOMMU. The performance penalty is too great to force it on always.
>
Of course there is some overhead but is not that great. Usually command buffer
contains just a dozen of commands. It should be an interesting challenge to
optimize its performance though.
> The programming model should always be considered the same - the rules of what
> you are allowed to do are the same whether the firewall, or any
> hardware-implemented protection features, are on or not.
>
Well, okay.
>>
>> 2) Since syncpoint protection is a T186 feature, what about previous
>> generations? Should we validate syncpoints in software for them? We have
>> 'syncpoint validation' patch staged in grate's kernel
>> https://github.com/grate-driver/linux/commit/c8b6c82173f2ee9fead23380e8330b8099e7d5e7
>>
>> (I'll start sending out this and other patches after a bit more thorough
>> testing.) Improperly used syncpoints potentially could allow one program to
>> damage others.
>
> Yes, I think the firewall should have this feature for older generations. We
> could disable the check on Tegra186, as you point towards in question 4.
>
>>
>> 3) What exactly does gather filter? Could you list all the commands that it
>> filters out, please?
>
> According to the Tegra186 TRM (section 16.8.32), SETCLASS, SETSTRMID and EXTEND
> are filtered.
>
Okay, then what about SETSTRMID command, I don't see its disassembly in the
host1x gather debug dump. Is it accidentally missed?
>>
>> 4) What about T30/T114 that do not have gather filter? Should we validate those
>> commands for them in a software firewall?
>
> Yes, the firewall should validate that.
>
>>
>> So maybe we should implement several layers of validation in the SW firewall.
>> Like all layers for T20 (memory boundaries validation etc), software gather
>> filter for T30/114 and software syncpoint validation for T30/114/124/210.
>>
>
> That seems like a good idea.
Alright, factoring out firewall from job.c probably should be the first step.
--
Dmitry
WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Osipenko <digetx@gmail.com>
To: Mikko Perttunen <cyndis@kapsi.fi>,
Mikko Perttunen <mperttunen@nvidia.com>,
thierry.reding@gmail.com, jonathanh@nvidia.com
Cc: dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection
Date: Sat, 19 Aug 2017 14:11:09 +0300 [thread overview]
Message-ID: <ed7f2987-062a-fa53-6243-bd81a600e96e@gmail.com> (raw)
In-Reply-To: <6979443e-ad2b-1da6-f71c-61913242f257@kapsi.fi>
On 19.08.2017 13:35, Mikko Perttunen wrote:
> On 08/19/2017 01:09 PM, Dmitry Osipenko wrote:
>> On 19.08.2017 11:10, Mikko Perttunen wrote:
>> [snip]
>>>>> + host1x_hw_syncpt_set_protection(host, true);
>>>>
>>>> Is it really okay to force the protection? Maybe protection should be enabled
>>>> with a respect to CONFIG_TEGRA_HOST1X_FIREWALL? In that case we would have to
>>>> avoid software jobs validation for Tegra124+.
>>>
>>> I don't quite get your comment. The hardware syncpt protection layer being
>>> enabled should never hurt - it doesn't mess with any valid jobs. It's also only
>>> on Tegra186 so I'm not sure where the Tegra124 comes from.
>>
>> Right, it's the gather filter on T124+, my bad. This raises several questions.
>>
>> 1) Why we have CONFIG_TEGRA_HOST1X_FIREWALL? Should it be always enforced or we
>> actually want to be a bit more flexible and allow to disable it. Imagine that
>> you are making a custom application and want to utilize channels in a
>> different way.
>
> I think it should be up to the user to decide whether they want the firewall or
> not. It's clearly the most useful on the older chips - especially Tegra20 due to
> lack of IOMMU. The performance penalty is too great to force it on always.
>
Of course there is some overhead but is not that great. Usually command buffer
contains just a dozen of commands. It should be an interesting challenge to
optimize its performance though.
> The programming model should always be considered the same - the rules of what
> you are allowed to do are the same whether the firewall, or any
> hardware-implemented protection features, are on or not.
>
Well, okay.
>>
>> 2) Since syncpoint protection is a T186 feature, what about previous
>> generations? Should we validate syncpoints in software for them? We have
>> 'syncpoint validation' patch staged in grate's kernel
>> https://github.com/grate-driver/linux/commit/c8b6c82173f2ee9fead23380e8330b8099e7d5e7
>>
>> (I'll start sending out this and other patches after a bit more thorough
>> testing.) Improperly used syncpoints potentially could allow one program to
>> damage others.
>
> Yes, I think the firewall should have this feature for older generations. We
> could disable the check on Tegra186, as you point towards in question 4.
>
>>
>> 3) What exactly does gather filter? Could you list all the commands that it
>> filters out, please?
>
> According to the Tegra186 TRM (section 16.8.32), SETCLASS, SETSTRMID and EXTEND
> are filtered.
>
Okay, then what about SETSTRMID command, I don't see its disassembly in the
host1x gather debug dump. Is it accidentally missed?
>>
>> 4) What about T30/T114 that do not have gather filter? Should we validate those
>> commands for them in a software firewall?
>
> Yes, the firewall should validate that.
>
>>
>> So maybe we should implement several layers of validation in the SW firewall.
>> Like all layers for T20 (memory boundaries validation etc), software gather
>> filter for T30/114 and software syncpoint validation for T30/114/124/210.
>>
>
> That seems like a good idea.
Alright, factoring out firewall from job.c probably should be the first step.
--
Dmitry
next prev parent reply other threads:[~2017-08-19 11:11 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-18 16:15 [PATCH 0/4] Miscellaneous improvements to Host1x and TegraDRM Mikko Perttunen
2017-08-18 16:15 ` Mikko Perttunen
2017-08-18 16:15 ` [PATCH 1/4] gpu: host1x: Enable Tegra186 syncpoint protection Mikko Perttunen
[not found] ` <20170818161553.27597-2-mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2017-08-18 22:36 ` Dmitry Osipenko
2017-08-18 22:36 ` Dmitry Osipenko
[not found] ` <d6d10aec-3d2a-99b3-a23d-41147478f412-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-19 8:10 ` Mikko Perttunen
2017-08-19 8:10 ` Mikko Perttunen
[not found] ` <5ff98485-e8ac-75e0-ca8f-3887f8593ec4-/1wQRMveznE@public.gmane.org>
2017-08-19 10:09 ` Dmitry Osipenko
2017-08-19 10:09 ` Dmitry Osipenko
2017-08-19 10:35 ` Mikko Perttunen
[not found] ` <6979443e-ad2b-1da6-f71c-61913242f257-/1wQRMveznE@public.gmane.org>
2017-08-19 11:11 ` Dmitry Osipenko [this message]
2017-08-19 11:11 ` Dmitry Osipenko
[not found] ` <ed7f2987-062a-fa53-6243-bd81a600e96e-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-19 11:32 ` Mikko Perttunen
2017-08-19 11:32 ` Mikko Perttunen
[not found] ` <72fc513b-2626-fd86-1b98-5d2f8e89dc5f-/1wQRMveznE@public.gmane.org>
2017-08-19 11:51 ` Dmitry Osipenko
2017-08-19 11:51 ` Dmitry Osipenko
2017-08-19 12:02 ` Dmitry Osipenko
2017-08-19 12:02 ` Dmitry Osipenko
2017-08-20 16:18 ` Dmitry Osipenko
2017-08-20 16:18 ` Dmitry Osipenko
2017-08-20 16:59 ` Dmitry Osipenko
2017-08-20 16:59 ` Dmitry Osipenko
2017-08-20 18:13 ` Dmitry Osipenko
2017-08-20 18:13 ` Dmitry Osipenko
2017-08-18 16:15 ` [PATCH 2/4] gpu: host1x: Enable gather filter Mikko Perttunen
2017-08-18 16:15 ` Mikko Perttunen
[not found] ` <20170818161553.27597-3-mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2017-08-19 10:42 ` Dmitry Osipenko
2017-08-19 10:42 ` Dmitry Osipenko
[not found] ` <ae084d08-89d0-ced0-c040-78500aa8e5d5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-19 10:46 ` Mikko Perttunen
2017-08-19 10:46 ` Mikko Perttunen
[not found] ` <64de3b3b-7c9e-54e9-49f4-d89b3d2c5f21-/1wQRMveznE@public.gmane.org>
2017-08-19 12:05 ` Dmitry Osipenko
2017-08-19 12:05 ` Dmitry Osipenko
2017-08-20 16:24 ` Dmitry Osipenko
2017-08-20 16:24 ` Dmitry Osipenko
[not found] ` <78e11be6-1e4f-18e0-cdc0-13db4bf57bf6-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-20 16:44 ` Dmitry Osipenko
2017-08-20 16:44 ` Dmitry Osipenko
2017-08-20 16:59 ` Dmitry Osipenko
[not found] ` <f42a2854-d70c-ef40-7d45-ec14f581c337-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-21 17:27 ` Mikko Perttunen
2017-08-21 17:27 ` Mikko Perttunen
2017-08-21 17:28 ` Mikko Perttunen
2017-08-18 16:15 ` [PATCH 3/4] gpu: host1x: Improve debug disassembly formatting Mikko Perttunen
2017-08-18 16:15 ` Mikko Perttunen
2017-08-18 21:54 ` Dmitry Osipenko
2017-08-18 16:15 ` [PATCH 4/4] drm/tegra: Use u64_to_user_ptr helper Mikko Perttunen
[not found] ` <20170818161553.27597-5-mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2017-08-18 22:05 ` Dmitry Osipenko
2017-08-18 22:05 ` Dmitry Osipenko
[not found] ` <f16347d6-991e-4d61-eb55-cca24bcf5625-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-19 8:06 ` Mikko Perttunen
2017-08-19 8:06 ` Mikko Perttunen
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=ed7f2987-062a-fa53-6243-bd81a600e96e@gmail.com \
--to=digetx-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=cyndis-/1wQRMveznE@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mperttunen-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.