All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benny Sjostrand <gorm@cucumelo.org>
To: tiwai@suse.de, alsa-devel@lists.sourceforge.net
Subject: [PATCH] cs46xx: once again SMP fixes, new aproach
Date: Thu, 22 Aug 2002 23:29:20 +0200	[thread overview]
Message-ID: <3D6557B0.5070007@cucumelo.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 3566 bytes --]

Hi!

This was hard nut break with good solution, with this solution I can 
only find two issues:
1 - for the moment I'm totally convinced that it's a excelent solution -;)
2- as I dont have any SMP machine (yet) I cant test it, untested code is 
 condemned to fail.

I will try to explain my theory, this diagram shows the SCB tree 
structure  in overview:

  FGTaskTree
      ¦
      |
+-----------------+              +-----------------+
| TimingMasterSCB |---next_scb-- |   WriteBackSCB  |--nextSCB ... (misc 
functionality)
+-----------------+              +-----------------+
        |                                |
    sub_list_ptr               (sub tree used for capture)
        |                               ...
+-----------------+  
| CodecOutSCB     |--nullSCB
+-----------------+        
        |
    sub_list_ptr
        |
+-----------------+  
| MasterMixSCB    |--nullSCB
+-----------------+        
        |
    sub_list_ptr
        |
+-----------------+             +-----------------+           
+-----------------+
| SRCTask_SPDIF   |---nextSCB---| SRCTask_SCB0    |--nextSCB--| 
SRCTask_SCB1    |- ... (etc)
+-----------------+             +-----------------+           
+-----------------+
        |                              
|                                    |
    sub_list_ptr                  sub_list_ptr                           
sub_list_ptr
        |                              
|                                      |
+-----------------+              +------------+         
+-----------+       +-----------+         +-----------+
| AsynchFGRxSCB   |              | PCMReader1 |-nextSCB-| 
PCMReader2|       | PCMReader3|-nextSCB-| PCMReader4|-nextSCB- ... (etc)
+-----------------+              +------------+         
+-----------+       +-----------+         +-----------+
        |                              |                      
|                   |                     |
     nullSCB                        nullSCB                  
nullSCB            nullSCB              nullSCB

(i hope you have a wide terminal and fixed font width)

- The pcm_link/unlink only access SCB under it's related SRCTask_SCB*, 
it only touches the nex_scb_ptr, parent_ptr and sub_list_ptr on 
SRCTask.. so it can safely be running paralel with any other 
simultaneous operation on other parts of the tree, and it can be running 
paralell with others pcm_link/unlink related to other SRCTask*.

- In create_pcm_channel the channel is initially created unlinked, which 
mean pcm_link must be called before playback start, invoked by 
playback_trigger. Anyway pcm_unlink was called in playback_open, which 
now can be removed. In this way the pcm_reader SCB will be initially 
floating, with no parent SCB and therefor we dont need any spin_lock in 
create_pcm_channel.

- But, the _same_ PCM stream, playback_trigger cant run before  
playback_open has completed. Which make no sense,  I supose the ALSA PCM 
core prevent a process from doing this to happen.

- In pcm_link the PCMReaderSCB is always linked in after SRCTask* 
sub_list_ptr, then therefor is no need loop searching for the last free 
SCB in sublist.

Conclusion what we got is:
- No mutexes in playback_trigger
- Independent spin_locks for each SRCTask*
- spin_lock only needed in pcm_link/unlink and in cs46xx_dsp_remove_scb.

With fewer and short spin_locks, theorically we manage to have good 
performance on SMP machines -:)

That's all, ... i think ...
Question, suggestion or whatever you got in mind about this is welcome, 
i'll try to be open.

/Benny

[-- Attachment #2: cs46xx_patch --]
[-- Type: application/x-java-vm, Size: 34089 bytes --]

             reply	other threads:[~2002-08-22 21:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-22 21:29 Benny Sjostrand [this message]
2002-08-23  8:31 ` [PATCH] cs46xx: once again SMP fixes, new aproach Takashi Iwai

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=3D6557B0.5070007@cucumelo.org \
    --to=gorm@cucumelo.org \
    --cc=alsa-devel@lists.sourceforge.net \
    --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.