All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: "Alexander.Deucher@amd.com" <Alexander.Deucher@amd.com>,
	alsa-devel@alsa-project.org,
	Sergei Miroshnichenko <s.miroshnichenko@yadro.com>,
	"Christian.Koenig@amd.com" <Christian.Koenig@amd.com>
Subject: Re: Adding movable PCIe BARs support in snd_hda_intel
Date: Wed, 24 Mar 2021 11:43:02 -0400	[thread overview]
Message-ID: <f97a59cb-869e-3e0f-305d-6d4a673f49c3@amd.com> (raw)
In-Reply-To: <s5heeg4oak7.wl-tiwai@suse.de>

I merged the patches, since it looks like my branch
is older I didn't have chip->init_failed member and
also seems there was a typo on ur side as there
is no flush_work_sync, only flush_work which waits
synchronously anyway.

Everything works fine when testing with maplyer running concurrently
to PCI rescan cycle.

Can you be more specific what are those get/put calls,
I am thinking about some waitqueue to wait on in rescan_prepare
after setting snd_hdac_bus_freeze,
on wakeup it checks that a counter dropped back to zero.
Not sure on which entity to hang this counter ?

Andrey

On 2021-03-24 11:06 a.m., Takashi Iwai wrote:
> On Wed, 24 Mar 2021 15:53:33 +0100,
> Andrey Grodzovsky wrote:
>>
>> Appreciate you investing the effort in helping on this.
>> I will start to merge it now as it doesn't apply cleanly on my branch.
>>
>> If I understand correctly your main HW access prevention mechanism during
>> the PCI prepare-rescan period is by bailing out on IOCTLs with the check
>> of power state == SNDRV_CTL_POWER_D0 or waiting when a user process closes
>> it's device file descriptor in patches 2 and 5. For command submission
>> prevention you use the freeze flag from patch 6.
>> If I haven't missed anything I don't see how those all protect when
>> new device is plugged while any of those operations are already in
>> flight. What prevents concurrent HW access from an IOCTL already
>> running
>> and HW suspend and MMIO unampping in rescan_preapre which starts after
>> IOCTL began ?
> 
> The call of snd_pcm_suspend_all() is the key.  That puts all PCM
> streams in the stopped and suspended state.  And the codec devices as
> well as the controller device will be put into the suspended state.
> So, for the PCM side, this should be fine with it, I guess.
> 
> However, after sending the patches, I noticed that they won't suffice
> for the pending control calls.  For the control get/put callbacks that
> have been pending before setting the power_state=D3hot, they would
> still kick off the runtime PM and bad things may happen.  Due to that,
> the bus.frozen flag won't work reliably, I'm afraid.
> 
> So, in that part, we need the code to sync the execution of the
> pending get/put calls in addition.  Maybe refcounting the control
> ioctls that are involved with get/put calls
> (SNDRV_CTL_IOCTL_ELEM_READ, _WRITE, maybe with _TLV_READ, too) and
> wait for those ioctls finishing before actually starting the codec
> suspend procedure.
> 
> 
> Takashi
> 

  reply	other threads:[~2021-03-24 15:44 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-19 21:22 Adding movable PCIe BARs support in snd_hda_intel Andrey Grodzovsky
2021-03-23 11:23 ` Andrey Grodzovsky
2021-03-23 11:39   ` Takashi Iwai
2021-03-23 14:22     ` Andrey Grodzovsky
2021-03-23 14:54       ` Takashi Iwai
2021-03-23 16:11         ` Andrey Grodzovsky
2021-03-23 16:50           ` Takashi Iwai
2021-03-23 17:08             ` Andrey Grodzovsky
2021-03-23 17:29               ` Takashi Iwai
2021-03-23 18:25                 ` Andrey Grodzovsky
2021-03-24 10:00                   ` Takashi Iwai
2021-03-24 14:53                     ` Andrey Grodzovsky
2021-03-24 15:06                       ` Takashi Iwai
2021-03-24 15:43                         ` Andrey Grodzovsky [this message]
2021-03-24 20:36                           ` Takashi Iwai
2021-03-24 21:43                             ` Andrey Grodzovsky
2021-03-25  6:58                               ` Takashi Iwai
2021-03-25 16:13                                 ` Andrey Grodzovsky
2021-03-25 16:38                                   ` Takashi Iwai
2021-03-26 21:27                                     ` Andrey Grodzovsky
2021-03-27  8:17                                       ` Takashi Iwai
2021-03-29 14:47                                         ` Andrey Grodzovsky
2021-03-29 14:52                                           ` Takashi Iwai
2021-03-29 14:57                                             ` Andrey Grodzovsky
2021-03-24 23:36                             ` [PATCH v2 1/8] ALSA: hda: Re-add dropped snd_poewr_change_state() kernel test robot
2021-03-24 23:36                               ` kernel test robot
2021-03-24 23:57                             ` kernel test robot
2021-03-24 23:57                               ` kernel test robot

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=f97a59cb-869e-3e0f-305d-6d4a673f49c3@amd.com \
    --to=andrey.grodzovsky@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=s.miroshnichenko@yadro.com \
    --cc=tiwai@suse.de \
    /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.