From: Jani Nikula <jani.nikula@linux.intel.com>
To: Matthew Auld <matthew.auld@intel.com>, intel-xe@lists.freedesktop.org
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Subject: Re: [Intel-xe] [PATCH v7 1/2] drm/xe/buddy: add visible tracking
Date: Tue, 21 Mar 2023 13:32:59 +0200 [thread overview]
Message-ID: <87a6068hlg.fsf@intel.com> (raw)
In-Reply-To: <7923b33a-a1dc-8893-2340-d1393d754c25@intel.com>
On Tue, 21 Mar 2023, Matthew Auld <matthew.auld@intel.com> wrote:
> On 21/03/2023 11:15, Jani Nikula wrote:
>> On Tue, 21 Mar 2023, Matthew Auld <matthew.auld@intel.com> wrote:
>>> + XE_BUG_ON(min_page_size < mm->chunk_size);
>>> + XE_BUG_ON(min_page_size > SZ_2G); /* FIXME: sg limit */
>>> + XE_BUG_ON(size > SZ_2G &&
>>> + (vres->base.placement & TTM_PL_FLAG_CONTIGUOUS));
>>> + XE_BUG_ON(!IS_ALIGNED(size, min_page_size));
>>
>> Hijacking the thread, sorry. ;)
>>
>> If we are supposed to not replicate i915-ism, why do we have
>> XE_BUG_ON()?
>>
>> I think it's an anti-pattern.
>>
>> Currently XE_BUG_ON() is just BUG_ON(), which should not be used for any
>> reason. Not even CI. The plan in i915 is to migrate all of them to
>> WARN_ON()'s and use panic_on_warn in CI.
>>
>> The other thing is that having BUG_ON() in the name gives you the false
>> impression that it's sufficient for input (or any precondition)
>> validation. In i915 it gets conditionally built for CI only. So we catch
>> errors in CI but not in actual production use. You just plunge on.
>>
>> Part of it is just naming. The BUG_ON() association is pretty strong for
>> any kernel developers. If it were called XE_ASSERT() it would have an
>> association with assert() that does what XE_BUG_ON() actually is: code
>> is only generated for debug builds.
>>
>> In i915 it has become habitual to sprinkle GEM_BUG_ON() all over the
>> place, just in case, belt and suspenders. IMO there's not enough
>> discretion about what can and can't actually happen, and what can and
>> can't happen in CI vs. production.
>
> Fair enough. The above probably should have just been WARN_ON(), along
> with returning a proper error. Will fix, and keep in mind for the future.
I'll emphasize that this was not about your patch in particular (see the
"hijack" part) but a more general observation about Xe adding
XE_BUG_ON().
BR,
Jani.
--
Jani Nikula, Intel Open Source Graphics Center
next prev parent reply other threads:[~2023-03-21 11:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-21 10:45 [Intel-xe] [PATCH v7 0/2] Some small-bar prep patches Matthew Auld
2023-03-21 10:45 ` [Intel-xe] [PATCH v7 1/2] drm/xe/buddy: add visible tracking Matthew Auld
2023-03-21 11:15 ` Jani Nikula
2023-03-21 11:24 ` Matthew Auld
2023-03-21 11:32 ` Jani Nikula [this message]
2023-03-21 10:45 ` [Intel-xe] [PATCH v7 2/2] drm/xe/buddy: add compatible and intersects hooks Matthew Auld
2023-03-21 10:48 ` [Intel-xe] ✓ CI.Patch_applied: success for Some small-bar prep patches (rev7) Patchwork
2023-03-21 10:49 ` [Intel-xe] ✓ CI.KUnit: " Patchwork
2023-03-21 10:53 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-03-21 11:05 ` [Intel-xe] ○ CI.BAT: info " Patchwork
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=87a6068hlg.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=matthew.auld@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox