From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F9E6C433DB for ; Mon, 11 Jan 2021 08:29:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29533221ED for ; Mon, 11 Jan 2021 08:29:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727868AbhAKI3M (ORCPT ); Mon, 11 Jan 2021 03:29:12 -0500 Received: from mx2.suse.de ([195.135.220.15]:44316 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727623AbhAKI3L (ORCPT ); Mon, 11 Jan 2021 03:29:11 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 044A4AD18; Mon, 11 Jan 2021 08:28:30 +0000 (UTC) Date: Mon, 11 Jan 2021 09:28:29 +0100 Message-ID: From: Takashi Iwai To: Davidlohr Bueso Cc: balbi@kernel.org, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: Re: [PATCH] usb/gadget: f_midi: Replace tasklet with work In-Reply-To: <20210111042855.73289-1-dave@stgolabs.net> References: <20210111042855.73289-1-dave@stgolabs.net> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 11 Jan 2021 05:28:55 +0100, Davidlohr Bueso wrote: > > Currently a tasklet is used to transmit input substream buffer > data. However, tasklets have long been deprecated as being too > heavy on the system by running in irq context - and this is not > a performance critical path. If a higher priority process wants > to run, it must wait for the tasklet to finish before doing so. > > Deferring work to a workqueue and executing in process context > should be fine considering the callback already does > f_midi_do_transmit() under the transmit_lock and thus changes in > semantics are ok regarding concurrency - tasklets being serialized > against itself. > > Cc: Takashi Iwai > Signed-off-by: Davidlohr Bueso The patch looks good to me. Reviewed-by: Takashi Iwai BTW, now I found that the driver doesn't have the cancel call for tasklet or work at the unbind. Practically seen it's no big problem, but its lack is a bait for syzbot. We may need to just call cancel_work_sync() somewhere, probably at f_midi_drop_out_substreams() or f_midi_disable(), but it can be in another patch. thanks, Takashi