Received: by 10.223.176.46 with SMTP id f43csp2161847wra; Sun, 21 Jan 2018 12:49:00 -0800 (PST) X-Google-Smtp-Source: AH8x227P0wo9zdorq0w/At86H+NRhBxs2vo+nctGUrEn45tTgr+Ie44nqTQMFUz7y4WOTHhU8V+t X-Received: by 10.99.180.67 with SMTP id n3mr4675752pgu.169.1516567739979; Sun, 21 Jan 2018 12:48:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516567739; cv=none; d=google.com; s=arc-20160816; b=v6qfL9U1vcdEUQpBof/VVS0NcW8VMruuTn81Hk9kyDwy9Wcte6Px93TiVamTTScL+f 4E+W9tfk3yllawqqaKaZYbSGmRyHuH5zCyx91OByom4SHqM5UG7FX27C/sCFFWbFKv95 6DCHeAyTdzEsi0bTX3aQVfwfkgjVtSiktxX/b7YXRyvDfpWTLaG3GPXb4agaqblA9Ekd /BP27lxe1vTqpBiQGyPruL4tWG3sYTmibTrjMaiM+58HMiKcA6jwHa0BM7yMGU3KhsTE 0Z5dArqpBcJq3mnMu0ysgerlHHn7z+GOOXt79HuwWR1Tu3PKD3mjDBqVV17JNydwlOoF wz0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:arc-authentication-results; bh=mrQ3EJ+Fe7g7kePPPEPX5pTujl+OeTE4yob0qXwqguc=; b=lJY7Kw7amqcSLmQB9BGnbRRxSFqUCnMZlTzXT87p6cJMYgkytVFY3U9ckENSQ04i2n +gFcYmjkxZ4oHv3ORPEMi6wLsHR+xWZWJbJ9ydVXFoeuTSpZF0RJzzljwzblOlsiiCxr KnZOdTNk56hBjB6jWfwIMlVDYnG1iEWDnKpiceDEijZkwCK/gcGYdoq06r3jWvgUxZF1 jJ/z0m2+g0uSOX+5oFieEhShDGGaoMjiqYACYCVsTZOG5jVUr4b1wuJzAajkVL/1tYGf alDag6d9E0tzQY+x87C8uL1vtfDtOs6/+Wwu/8zodLckA5xYVMK204grNgtHzNBkb9nm JnmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l36-v6si420438plg.7.2018.01.21.12.48.44; Sun, 21 Jan 2018 12:48:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751121AbeAUUsS (ORCPT + 99 others); Sun, 21 Jan 2018 15:48:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:58080 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751076AbeAUUsR (ORCPT ); Sun, 21 Jan 2018 15:48:17 -0500 Received: from localhost (i16-les03-th2-31-37-47-191.sfr.lns.abo.bbox.fr [31.37.47.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8868D20835; Sun, 21 Jan 2018 20:48:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8868D20835 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=frederic@kernel.org Date: Sun, 21 Jan 2018 21:48:14 +0100 From: Frederic Weisbecker To: Pavan Kondeti Cc: LKML , Levin Alexander , Peter Zijlstra , Mauro Carvalho Chehab , Linus Torvalds , Hannes Frederic Sowa , "Paul E . McKenney" , Wanpeng Li , Dmitry Safonov , Thomas Gleixner , Andrew Morton , Paolo Abeni , Radu Rendec , Ingo Molnar , Stanislaw Gruszka , Rik van Riel , Eric Dumazet , David Miller Subject: Re: [RFC PATCH 2/4] softirq: Per vector deferment to workqueue Message-ID: <20180121204812.GC2879@lerouge> References: <1516376774-24076-1-git-send-email-frederic@kernel.org> <1516376774-24076-3-git-send-email-frederic@kernel.org> <20180120084139.GA8395@codeaurora.org> <20180121161114.GA2879@lerouge> <20180121175040.GA30677@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180121175040.GA30677@codeaurora.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 21, 2018 at 11:20:40PM +0530, Pavan Kondeti wrote: > On Sun, Jan 21, 2018 at 05:11:17PM +0100, Frederic Weisbecker wrote: > > On Sat, Jan 20, 2018 at 02:11:39PM +0530, Pavan Kondeti wrote: > > > > Hi Pavan, > > > > > > > I have couple questions/comments. > > > > > > (1) Since the work is queued on a bounded per-cpu worker, we may run > > > into a deadlock if a TASKLET is killed from another work running on > > > the same bounded per-cpu worker. > > > > > > For example, > > > > > > (1) Schedule a TASKLET on CPU#0 from IRQ. > > > (2) Another IRQ comes on the same CPU and we queue a work to kill > > > the TASKLET. > > > (3) The TASKLET vector is deferred to workqueue. > > > (4) We run the TASKLET kill work and wait for the TASKLET to finish, > > > which won't happen. > > > > > > We can fix this by queueing the TASKLET kill work on an unbounded > > > workqueue so that this runs in parallel with TASKLET vector work. > > > > > > Just wanted to know if we have to be aware of this *condition*. > > > > But IIRC the workqueues have several workers per CPU so the tasklet to > > be killed can run while the tasklet killer yields. > > > AFAIK, the work items queued via schedule_work_on() goes to the system_wq > which is bounded to a CPU with concurrency restrictions. If any work > item (in this case tasklet kill) is getting executed on this bounded > worker, the next items have to wait. The forward progress happens only > when the current work is finished or enters sleep. Workqueues have multiple workers to handle the pending works, unless they are __WQ_ORDERED. The worker manager in a pool is supposed to create workers on-demand when necessary to make sure that no work is blocking the others. Thanks. > > This also makes me wonder what happens if a CPU hogging work gets executed > on the system_wq while softirq work is pending? The softirq work gets > starved which won't happen now with ksoftirqd design. Ideally the CPU > hogging work should not be queued on the system_wq and instead should > be queued on CPU intenstive workqueue (WQ_CPU_INTENSIVE) to exempt > from concurrency management. May be we need some special workqueue > which is bounded but not subjected to concurrency management. > > -- > Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. > Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project. >