Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1088422ybh; Wed, 22 Jul 2020 23:22:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4LXnLH6FnnUvFmwwUsNhLile/ytU1hG1F1kH/G+ykFztkf+2/adJGqBbLnXVkU0OL1ukw X-Received: by 2002:a05:6402:202a:: with SMTP id ay10mr2897210edb.0.1595485353561; Wed, 22 Jul 2020 23:22:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595485353; cv=none; d=google.com; s=arc-20160816; b=pkquYfJ1MYGvY9xS5cdoSWrOaa6ARyhSDWPrWyZC1VibhDiFKt1JM6VaqmJFMmvBLO AfUGo3BBD1g+Fbot8fTdbc65eTX4YW0liZuo19YmmxthjWAmukhzVR6TpGnhB3v7C36v gVSbqefiDBYqVOQa8c+z/FvSpx0ElFJBKfLdhcIf/Y0/DByY6NYvmqCs74HbfpX33hd8 gVF1N6NQ93nYuv1o67S3flUg6Uykt0PItb7luxXL4CZkP19BjBxuagHqAjrrX2RkCj2N 6fd+EeS1EK9NMdCKZ83MvsIdHmtBRDh8aB7awKX5FeXbR1GXTdP693s1zi5Nc1m3/Ejh xkEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=NmccGowISiofEIh34tVNSq1T6x9AX5ZUAzxKCJSNHX0=; b=aqHeNrq5yOdpVziL/2dO9Ff2krtW4PYTiFMAHy91/flpqPnKy40wsjo0HZqYexuTzD uW33GjGa8uxx7MPuQE4fkKgb8SPJayQzmfsDt66spu/ErhQHr3YWBeNix6EsOCYkZw70 QKq2+JIooaQUTxmeSuJ78suo3nH3fb6ZKnJIAdoHlVCdTMDBkz6VuCOBH/ddWx+QHAZn dcrfKUI+WHq+YMWgjzliJsYu2fVqHww5ZD/UUItuc9O5EPC3mBpg1cX4eN42X6Hi2a7C hpwJUTJPFYdA/Om36azux00bebfIf+zdPwF8XJbyZ52c4OeE96sD05hknVzl1Gy7xOJp Xr0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=b2uWM5w0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oa20si1294377ejb.714.2020.07.22.23.22.10; Wed, 22 Jul 2020 23:22:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=b2uWM5w0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727060AbgGWGV1 (ORCPT + 99 others); Thu, 23 Jul 2020 02:21:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726390AbgGWGV0 (ORCPT ); Thu, 23 Jul 2020 02:21:26 -0400 Received: from mail-ua1-x944.google.com (mail-ua1-x944.google.com [IPv6:2607:f8b0:4864:20::944]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D61BEC0619DC for ; Wed, 22 Jul 2020 23:21:25 -0700 (PDT) Received: by mail-ua1-x944.google.com with SMTP id n4so1440667uae.5 for ; Wed, 22 Jul 2020 23:21:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=NmccGowISiofEIh34tVNSq1T6x9AX5ZUAzxKCJSNHX0=; b=b2uWM5w0BWXHy9/wyNBLvHGrr96J9rx1+GnWbJXRWy1ssaBMyCjUB2RZJtFZdZcZmT v15QIv2IYLtzO1qqrXRk+hrP933/BXm8f87aWfBemViSB03s9U+Q1KkUzwMLK7h72b3c 9WOZMVJplHAkok9IyXhhz5GzW/QRsbWfNuaQj7416eMhKfq7/zgCHM+dKWqhFLVkkj8y CSp7uwOiSwGmrZnKSKQgXG0P/eITv6H64Lsk2CT28zrUS5AcCpx7DBx7wVoQ/3euNPRv y1rXH2a9z8CIlXczstjpCRJOGD3OAFpl/HJ7b/U9Jtd+BnEFBe22lhe1hZF8q3srWmUJ qCjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=NmccGowISiofEIh34tVNSq1T6x9AX5ZUAzxKCJSNHX0=; b=VlweDLIFrwBEsEjIBEeBsx4hrcobX8vtosx+/LbEY8Ynkz6pXUXPrLgLwhSJ4n1ybf tYBd2BjU16cA3fQONBS1EP9m3WxqGFibfb5It364Yy8uUs8fXb7AJrW14RkQNBLvEApC Y8ynW4jIySJ4f8aNN2iqvzhbk6E7Xd3G9Z+gTIESGDq9GomyYnp2yzc6i7T8Upgs3w5u ED29W26pYknmgnOe7u23iDwD57SEXRO4D0UEYPTWlKJDsZHleLhsBRJXnYUU29QGFKf1 rXrx59SE//Q7FkhtXEphpHqpxAEDhtdJsHkNz/yVfmCrCDEcyO2tuCRpezCXrWoTEomV ApHA== X-Gm-Message-State: AOAM530b9IBqFsKwPHm3cZslWBQYawGuZVJxfXOuUVdMXdB4UUcveFas ZT1esb2axNszcu4qm0kwPzKBR+WvSFqx1B1PBVthtQ== X-Received: by 2002:ab0:6353:: with SMTP id f19mr2793756uap.69.1595485284749; Wed, 22 Jul 2020 23:21:24 -0700 (PDT) MIME-Version: 1.0 References: <20200713204300.345975-1-badhri@google.com> <20200714060520.GB657428@kroah.com> <040b4cde-91d4-7776-60b5-8f55b6e75831@roeck-us.net> In-Reply-To: From: Badhri Jagan Sridharan Date: Wed, 22 Jul 2020 23:20:48 -0700 Message-ID: Subject: Re: [PATCH] usb: typec: tcpm: Move to high priority workqueue for processing events To: Guenter Roeck Cc: reg Kroah-Hartman , Heikki Krogerus , USB , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Guenter, Just sent out the patch "usb: typec: tcpm: Migrate workqueue to RT priority for processing events" which uses kthread_create_worker and hrtimer.nAppreciate your guidance !! The commits 38a1222ae4f3 and 1ff688209e2e were spot on as they were trying solve the same problem in a different subsystem. Thanks, Badhri On Tue, Jul 14, 2020 at 10:16 AM Badhri Jagan Sridharan wrote: > > On Mon, Jul 13, 2020 at 11:58 PM Guenter Roeck wrote= : > > > > On 7/13/20 11:05 PM, reg Kroah-Hartman wrote: > > > On Mon, Jul 13, 2020 at 01:43:00PM -0700, Badhri Jagan Sridharan wrot= e: > > >> "tReceiverResponse 15 ms Section 6.6.2 > > >> The receiver of a Message requiring a response Shall respond > > >> within tReceiverResponse in order to ensure that the > > >> sender=E2=80=99s SenderResponseTimer does not expire." > > >> > > >> When the cpu complex is busy running other lower priority > > >> work items, TCPM's work queue sometimes does not get scheduled > > >> on time to meet the above requirement from the spec. > > >> Elevating the TCPM's work queue to higher priority allows > > >> TCPM to meet tReceiverResponse in a busy system. > > >> > > >> Signed-off-by: Badhri Jagan Sridharan > > >> --- > > >> drivers/usb/typec/tcpm/tcpm.c | 2 +- > > >> 1 file changed, 1 insertion(+), 1 deletion(-) > > >> > > >> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/= tcpm.c > > >> index 82b19ebd7838e0..088b6f1fa1ff89 100644 > > >> --- a/drivers/usb/typec/tcpm/tcpm.c > > >> +++ b/drivers/usb/typec/tcpm/tcpm.c > > >> @@ -4747,7 +4747,7 @@ struct tcpm_port *tcpm_register_port(struct de= vice *dev, struct tcpc_dev *tcpc) > > >> mutex_init(&port->lock); > > >> mutex_init(&port->swap_lock); > > >> > > >> - port->wq =3D create_singlethread_workqueue(dev_name(dev)); > > >> + port->wq =3D alloc_ordered_workqueue("%s", WQ_HIGHPRI, dev_name= (dev)); > > > > > > How are you "guaranteeing" that this is really going to change anythi= ng > > > on a highly loaded machine? > > > > > > Yes, it might make things better, but if you have a hard deadline lik= e > > > this, you need to do things a bit differently to always ensure that y= ou > > > meet it. I do not think this change is that fix, do you? > > > > Yes Greg I agree with you, moving to HIGHPRI was making it better but > is not going to > solve the problem always. I was wondering whether are there better > ways of doing this. > > > > > Good point. The worker in drivers/watchdog/ !watchdog_dev.c might be > > useful as a starting point. There may be better examples - this is > > just one I know of which had a similar problem. See commits > > 38a1222ae4f3 and 1ff688209e2e. > > > > Guenter > > Thanks a lot Guenter !! Very useful pointers, will review the > approaches in both the > commits !