[alsa-devel] [PATCH 11/39] ALSA: seq: optimize system_info function to new design
Takashi Iwai
tiwai at suse.de
Mon Aug 8 17:18:25 CEST 2016
On Mon, 08 Aug 2016 14:22:47 +0200,
Takashi Sakamoto wrote:
>
> On Aug 8 2016 16:50, Takashi Iwai wrote:
> > On Mon, 08 Aug 2016 09:04:55 +0200,
> > Takashi Iwai wrote:
> >>
> >> On Sun, 07 Aug 2016 11:48:47 +0200,
> >> Takashi Sakamoto wrote:
> >>>
> >>> In former commit, actual operations of each ioctl command get argument
> >>> in kernel space. Copying from/to user space is performed outside of
> >>> the function.
> >>>
> >>> This commit optimizes to the new design.
> >>>
> >>> Signed-off-by: Takashi Sakamoto <o-takashi at sakamocchi.jp>
> >>
> >> While it's OK to split to small patches if you prefer, you don't have
> >> to do so. Basically all the rest are doing the same thing (strip
> >> copy_*_user() and replace to the pointer accesses), and it's rather
> >> boring to read repeated mails.
> >
> > BTW, I'm afraid that the patch series breaks bisection.
> > We need to consider rearranging the changes if we want to keep
> > bisectionability.
>
> As long as it's possible. But in this case, it's difficult. The
> relation between ioctl table and each functions is one to N. If we
> change them in one patch, the size is quite large (and
> alsa-project.org will skip it to deliver.). It's unavoidable.
The standard technique is transitional changes: namely, introduce a
new function table while keeping both old and new tables, move the
entries gradually, and finally clean up the old table.
In your case, try to start cleaning up the user-copy at first. That
is,
- Create a function to do user-copy and call function pointer with a
new function table. It's called from snd_seq_do_ioctl(), and
snd_seq_do_ioctl() processes the old function table as fallback.
- Move each function to the new function.
- After moving all functions, replace snd_seq_do_ioctl() with the new
one you created in the first step.
At this moment, snd_seq_kernel_client_ctl() still calls
snd_seq_do_ioctl(). Now we can clean up the segment workaround.
At best, retrieve a lookup function for obtaining the function pointer
from the given ioctl number. Then both snd_seq_kernel_client_ctl()
and seq_seq_do_ioctl() can call it and delegate to the function.
At last, clean up the compat code.
Takashi
More information about the Alsa-devel
mailing list