public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vinicius Costa Gomes <vinicius.gomes@intel.com>
To: Nathan Lynch <nathan.lynch@amd.com>,
	Vinod Koul <vkoul@kernel.org>,
	dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: dave.jiang@intel.com, kristen.c.accardi@intel.com,
	kernel test robot <oliver.sang@intel.com>
Subject: Re: [PATCH v1] dmaengine: dmatest: Fix dmatest waiting less when interrupted
Date: Thu, 13 Mar 2025 09:36:11 -0700	[thread overview]
Message-ID: <87wmcslwg4.fsf@intel.com> (raw)
In-Reply-To: <874izx10nx.fsf@AUSNATLYNCH.amd.com>

Nathan Lynch <nathan.lynch@amd.com> writes:

> Hi Vinicius,
>
> Vinicius Costa Gomes <vinicius.gomes@intel.com> writes:
>> Nathan Lynch <nathan.lynch@amd.com> writes:
>>> Vinicius Costa Gomes <vinicius.gomes@intel.com> writes:
>>>> Change the "wait for operation finish" logic to take interrupts into
>>>> account.
>>>>
>>>> When using dmatest with idxd DMA engine, it's possible that during
>>>> longer tests, the interrupt notifying the finish of an operation
>>>> happens during wait_event_freezable_timeout(), which causes dmatest to
>>>> cleanup all the resources, some of which might still be in use.
>>>>
>>>> This fix ensures that the wait logic correctly handles interrupts,
>>>> preventing premature cleanup of resources.
>>>>
>>>> Reported-by: kernel test robot <oliver.sang@intel.com>
>>>> Closes: https://lore.kernel.org/oe-lkp/202502171134.8c403348-lkp@intel.com
>>>
>>> Given the report at the URL above I'm struggling to follow the rationale
>>> for this change. It looks like a use-after-free in idxd while
>>> resetting/unbinding the device, and I can't see how changing whether
>>> dmatest threads perform freezeable waits would change this.
>>>
>>
>> I think that the short version is that the reproducition script triggers
>> different problems on different platforms/configurations.
>>
>> The solution I proposed fixes a problem I was seeing on a SPR system, on
>> a GNR system (that I was only able to get later) I see something more similar
>> to this particular splat (currently working on the fix).
>>
>> Seeing this question, I realize that I should have added a note to the
>> commit detailing this.
>>
>> So I am planning on proposing two (this and another) fixes for the same
>> report, hoping that it's not that confusing/unusual.
>
> I'm still confused... why is wait_event_freezable_timeout() the wrong
> API for dmatest to use, and how could changing it to
> wait_event_timeout() cause it to "take interrupts into account" that it
> didn't before?
>

My understanding (and testing) is that wait_event_timeout() will block
for the duration even in the face of interrupts, 'freezable' will not.

> AFAIK the only change made here is that dmatest threads effectively
> become unfreezeable, which is contrary to prior authors' intentions:
>
> commit 981ed70d8e4f ("dmatest: make dmatest threads freezable")
> commit adfa543e7314 ("dmatest: don't use set_freezable_with_signal()")
>

Cheers,
-- 
Vinicius

  reply	other threads:[~2025-03-13 16:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-05 23:00 [PATCH v1] dmaengine: dmatest: Fix dmatest waiting less when interrupted Vinicius Costa Gomes
2025-03-05 23:14 ` Dave Jiang
2025-03-10 21:06 ` Vinod Koul
2025-03-12 18:58 ` Nathan Lynch
2025-03-12 22:13   ` Vinicius Costa Gomes
2025-03-13 14:10     ` Nathan Lynch
2025-03-13 16:36       ` Vinicius Costa Gomes [this message]
2025-03-13 21:21         ` Nathan Lynch
2025-03-13 23:29           ` Vinicius Costa Gomes
2025-03-14 21:35             ` Nathan Lynch
2025-03-14 22:24               ` Vinicius Costa Gomes
2025-04-02 13:45                 ` Nathan Lynch
2025-04-03  3:44                   ` Vinicius Costa Gomes
2025-04-03 16:24                     ` Nathan Lynch

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=87wmcslwg4.fsf@intel.com \
    --to=vinicius.gomes@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=kristen.c.accardi@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathan.lynch@amd.com \
    --cc=oliver.sang@intel.com \
    --cc=vkoul@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