Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1923327ybl; Sat, 25 Jan 2020 11:58:55 -0800 (PST) X-Google-Smtp-Source: APXvYqxX9qXXsjcovY24f8RxIpZLYzq1uYDroAvMzafxHze1Z1cdUuGTYCbxD4v1DKqT5N6t5CgK X-Received: by 2002:a9d:6745:: with SMTP id w5mr7451636otm.52.1579982335614; Sat, 25 Jan 2020 11:58:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579982335; cv=none; d=google.com; s=arc-20160816; b=SKAbfdSY/bj55tLMBMTLQrkJVx9Js2sqeRgta7CjL1XQ2z3lxA9jx6QSwo6qq6JwfK vTyRGTtCNnEz2+UMBwDEKNKb0vq8NnkyAzjzXBso83ih4e7d9AAWpNtAM0icGMZVSenn jye5DYBHSMWfJrWu/f8l3uAoqHwRqvNgCp6nnJXb3/RbnUkX+a9yAHeJXQYYe9Xd6s4l PioIXfb5cfk91MBqcOxDbQcT7eA+fX2nm+jwHUa7IztEhlX7CMuiLl9tiMoQHAlIwlfJ PA3pWUm6MyoRCXRizVj7KLH51mEhUmUA9IfpN4yBd6a1usvCsI+F8XKfuZnPaCBVFPW0 udcw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:references:cc:to:from:subject :dkim-signature; bh=rCFExYBqRuTQVgkc1w2zE0sP2/6i9VF6QWac6tDmMtY=; b=0e2b/y6M4XTnfhVAemWvwZYcNk4AQUCGhw4Q+zEVsn/hw03yCY0MmZcfJTYxNSnqhh 9lHTfIDU84XwZ8Iohbcr2aQB4u7GfwIFxYc4phzfSH6lYK+d4N30MWYUI2iuUeIZu/5A 5UV5Qd2qJ2TrziB32NvRLr9koBStI1F12XLSzOL7j4sR35I++Ss/xDkNP9NAEUASN2HQ cjq9P4PQbgZc4DS82G5jJcZBBuM7puAKGd/JIUUAJXpzx/wOxRrJzb9cL4MDOu0E9E+Z ewPjpyplcfyGvBUIBLpGkDoD4WesSFVJRtdQefw8Eq/BKJ4L4KLKT1JyRlTrOa5a3kd7 sxYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=B5vYXqll; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r2si1506502oif.83.2020.01.25.11.58.43; Sat, 25 Jan 2020 11:58:55 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=B5vYXqll; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727278AbgAYT5y (ORCPT + 99 others); Sat, 25 Jan 2020 14:57:54 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:35151 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726729AbgAYT5y (ORCPT ); Sat, 25 Jan 2020 14:57:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579982272; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rCFExYBqRuTQVgkc1w2zE0sP2/6i9VF6QWac6tDmMtY=; b=B5vYXqllSZiA3J+f2Tmkn0heL0SdA2aFsjAl+lg35JiG96m4EW74nj+m6qYHI4rlSePY/f e0wdUj19SxsRLYwr3sjIPNBeUYy9jhUTK/sWZqZnVlru+1aiALNVuqkgJOkjAfNoWCcySp mChFnsCpV/mvaiu5x2CiokGyAbsOupA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-346-40Jl93FAMqitlcDrNK8sMg-1; Sat, 25 Jan 2020 14:57:45 -0500 X-MC-Unique: 40Jl93FAMqitlcDrNK8sMg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 75D3C10054E3; Sat, 25 Jan 2020 19:57:42 +0000 (UTC) Received: from llong.remote.csb (ovpn-121-36.rdu2.redhat.com [10.10.121.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 83F1F60BEC; Sat, 25 Jan 2020 19:57:39 +0000 (UTC) Subject: Re: [PATCH v8 4/5] locking/qspinlock: Introduce starvation avoidance into CNA From: Waiman Long To: Alex Kogan Cc: Peter Zijlstra , linux@armlinux.org.uk, Ingo Molnar , Will Deacon , Arnd Bergmann , linux-arch@vger.kernel.org, linux-arm-kernel , linux-kernel@vger.kernel.org, Thomas Gleixner , Borislav Petkov , hpa@zytor.com, x86@kernel.org, Hanjun Guo , Jan Glauber , Steven Sistare , Daniel Jordan , dave.dice@oracle.com References: <20191230194042.67789-1-alex.kogan@oracle.com> <20191230194042.67789-5-alex.kogan@oracle.com> <20200121132949.GL14914@hirez.programming.kicks-ass.net> <3862F8A1-FF9B-40AD-A88E-2C0BA7AF6F58@oracle.com> <20200124075235.GX14914@hirez.programming.kicks-ass.net> <2c6741c5-d89d-4b2c-cebe-a7c7f6eed884@redhat.com> <48ce49e5-98a7-23cd-09f4-8290a65abbb5@redhat.com> <8D3AFB47-B595-418C-9568-08780DDC58FF@oracle.com> <714892cd-d96f-4d41-ae8b-d7b7642a6e3c@redhat.com> <1669BFDE-A1A5-4ED8-B586-035460BBF68A@oracle.com> <45660873-731a-a810-8c57-1a5a19d266b4@redhat.com> Organization: Red Hat Message-ID: <5ffb74f6-c635-cfc8-ab01-fb990f12a93a@redhat.com> Date: Sat, 25 Jan 2020 14:57:41 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/24/20 1:51 PM, Waiman Long wrote: >> You can use the in_task() macro in include/linux/preempt.h. This is >> just a percpu preempt_count read and test. If in_task() is false, it >> is in a {soft|hard}irq or nmi context. If it is true, you can check >> the rt_task() macro to see if it is an RT task. That will access to >> the current task structure. So it may cost a little bit more if you >> want to handle the RT task the same way. >> > We may not need to do that for softIRQ context. If that is the case, yo= u > can use in_irq() which checks for hardirq and nmi only. Peter, what is > your thought on that? In second thought, we should do that for softIRQ as well. Also, we may want to also check if irqs_disabled() is true as well by calls like spin_lock_irq() or spin_lock_irqsave().=C2=A0 We do not want to unnecessa= rily prolong the irq off period. Cheers, Longman