From: Jani Nikula <jani.nikula@intel.com>
To: Matthew Auld <matthew.auld@intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
Anshuman Gupta <anshuman.gupta@intel.com>,
Andi Shyti <andi.shyti@linux.intel.com>,
Nathan Chancellor <nathan@kernel.org>,
stable@vger.kernel.org
Subject: Re: [PATCH v2 1/6] drm/i915/gem: fix bitwise and logical AND mixup
Date: Mon, 30 Sep 2024 17:58:33 +0300 [thread overview]
Message-ID: <87cyklw5ly.fsf@intel.com> (raw)
In-Reply-To: <11901d29-f211-46a9-96ee-cf52558e4eeb@intel.com>
On Mon, 30 Sep 2024, Matthew Auld <matthew.auld@intel.com> wrote:
> On 30/09/2024 14:54, Jani Nikula wrote:
>> On Fri, 27 Sep 2024, Jani Nikula <jani.nikula@intel.com> wrote:
>>> On Thu, 26 Sep 2024, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
>>>> On Wed, Sep 18, 2024 at 08:35:43PM +0300, Jani Nikula wrote:
>>>>> CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND is an int, defaulting to 250. When
>>>>> the wakeref is non-zero, it's either -1 or a dynamically allocated
>>>>> pointer, depending on CONFIG_DRM_I915_DEBUG_RUNTIME_PM. It's likely that
>>>>> the code works by coincidence with the bitwise AND, but with
>>>>> CONFIG_DRM_I915_DEBUG_RUNTIME_PM=y, there's the off chance that the
>>>>> condition evaluates to false, and intel_wakeref_auto() doesn't get
>>>>> called. Switch to the intended logical AND.
>>>>>
>>>>> v2: Use != to avoid clang -Wconstant-logical-operand (Nathan)
>>>>
>>>> oh, this is ugly!
>>>>
>>>> Wouldn't it be better then to use IS_ENABLED() macro?
>>>
>>> It's an int config option, not a bool. (Yes, the name is misleading.)
>>>
>>> IS_ENABLED(CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND) would be the same as
>>> CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND == 1.
>>>
>>> We're actually checking if the int value != 0, so IMO the patch at hand
>>> is fine.
>>
>> Ping, r-b on this one too?
>
> r-b still holds for v2, fwiw.
Thanks for the reviews, pushed the lot to drm-intel-next.
BR,
Jani.
>
>>
>> BR,
>> Jani.
>>
>>>
>>> BR,
>>> Jani.
>>>
>>>
>>>>
>>>>>
>>>>> Fixes: ad74457a6b5a ("drm/i915/dgfx: Release mmap on rpm suspend")
>>>>> Cc: Matthew Auld <matthew.auld@intel.com>
>>>>> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
>>>>> Cc: Anshuman Gupta <anshuman.gupta@intel.com>
>>>>> Cc: Andi Shyti <andi.shyti@linux.intel.com>
>>>>> Cc: Nathan Chancellor <nathan@kernel.org>
>>>>> Cc: <stable@vger.kernel.org> # v6.1+
>>>>> Reviewed-by: Matthew Auld <matthew.auld@intel.com> # v1
>>>>> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> # v1
>>>>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>>>>> ---
>>>>> drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 2 +-
>>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
>>>>> index 5c72462d1f57..b22e2019768f 100644
>>>>> --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
>>>>> +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
>>>>> @@ -1131,7 +1131,7 @@ static vm_fault_t vm_fault_ttm(struct vm_fault *vmf)
>>>>> GEM_WARN_ON(!i915_ttm_cpu_maps_iomem(bo->resource));
>>>>> }
>>>>>
>>>>> - if (wakeref & CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND)
>>>>> + if (wakeref && CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND != 0)
>>>>> intel_wakeref_auto(&to_i915(obj->base.dev)->runtime_pm.userfault_wakeref,
>>>>> msecs_to_jiffies_timeout(CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND));
>>>>>
>>>>> --
>>>>> 2.39.2
>>>>>
>>
--
Jani Nikula, Intel
next prev parent reply other threads:[~2024-09-30 14:58 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-18 17:35 [PATCH v2 0/6] drm/i915: wakeref fixes and improvements Jani Nikula
2024-09-18 17:35 ` [PATCH v2 1/6] drm/i915/gem: fix bitwise and logical AND mixup Jani Nikula
2024-09-26 20:40 ` Rodrigo Vivi
2024-09-27 8:38 ` Jani Nikula
2024-09-30 13:54 ` Jani Nikula
2024-09-30 14:23 ` Matthew Auld
2024-09-30 14:58 ` Jani Nikula [this message]
2024-09-18 17:35 ` [PATCH v2 2/6] drm/i915: use INTEL_WAKEREF_DEF instead of magic -1 for intel_wakeref_t Jani Nikula
2024-09-26 20:45 ` Rodrigo Vivi
2024-09-18 17:35 ` [PATCH v2 3/6] drm/i915/display: return 0 instead of false for disabled power wakeref Jani Nikula
2024-09-26 20:46 ` Rodrigo Vivi
2024-09-18 17:35 ` [PATCH v2 4/6] drm/i915/gt: add a macro for mock gt wakeref special value and use it Jani Nikula
2024-09-26 20:49 ` Rodrigo Vivi
2024-09-18 17:35 ` [PATCH v2 5/6] drm/i915/audio: be explicit about intel_wakeref_t conversions Jani Nikula
2024-09-26 20:49 ` Rodrigo Vivi
2024-09-18 17:35 ` [PATCH v2 6/6] drm/i915: switch intel_wakeref_t underlying type to struct ref_tracker * Jani Nikula
2024-09-26 20:52 ` Rodrigo Vivi
2024-09-18 18:24 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: wakeref fixes and improvements (rev2) Patchwork
2024-09-18 18:24 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-09-18 18:36 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-09-18 21:37 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: wakeref fixes and improvements (rev3) Patchwork
2024-09-18 21:37 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-09-18 21:46 ` ✓ Fi.CI.BAT: success " Patchwork
2024-09-19 9:25 ` ✗ Fi.CI.IGT: failure " 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=87cyklw5ly.fsf@intel.com \
--to=jani.nikula@intel.com \
--cc=andi.shyti@linux.intel.com \
--cc=anshuman.gupta@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.auld@intel.com \
--cc=nathan@kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=stable@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).