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=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 84533C55ABD for ; Fri, 13 Nov 2020 17:31:42 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 349012078D for ; Fri, 13 Nov 2020 17:31:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="xQ0Zbe0F" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 349012078D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=0W5pTPN3Ie7dTt0iTscM3QY0Mzls3f0BvqV+wBeTZvg=; b=xQ0Zbe0FTymf1FziW6jFcCLHs lUPHeaD6HlPnM/cT4Gn6c6nnNCxqF/2nmxdLuz6QTFickkaTIYoT3vrtKu/zicrhfKmokeHnCURvv 2Tq8k64Yx461MqP6aTWyLbuNcSJEn7maScH6HzcuM4Ey/yElWcf59afvzKFB2Ovnb9alAIfQwiR1t 3W8CBlYJ0O7u1LmVOTxP13HVaDxbeRMDvhGABpG8stZnYz7LjB3dGRhTzJCaiQRICBT+HVgZBJwST 2/FpKvrciUycg+2O7tCh+kV3ugkro4zTV1v09ZsFa0efzmZBhvzJqy7uoOFyCNlpd9f7uSMoisLXQ Zl2VsVLxQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdcu0-00055d-9C; Fri, 13 Nov 2020 17:30:24 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kdcty-000559-8K for linux-arm-kernel@lists.infradead.org; Fri, 13 Nov 2020 17:30:23 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 970751042; Fri, 13 Nov 2020 09:30:21 -0800 (PST) Received: from C02TD0UTHF1T.local (unknown [10.57.53.36]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 07F403F718; Fri, 13 Nov 2020 09:30:14 -0800 (PST) Date: Fri, 13 Nov 2020 17:30:12 +0000 From: Mark Rutland To: Ionela Voinescu Subject: Re: [PATCH] arm64: abort counter_read_on_cpu() when irqs_disabled() Message-ID: <20201113173012.GD44988@C02TD0UTHF1T.local> References: <20201106125334.21570-1-ionela.voinescu@arm.com> <20201113155328.4194-1-ionela.voinescu@arm.com> <20201113160234.GB44988@C02TD0UTHF1T.local> <20201113165843.GA6973@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201113165843.GA6973@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201113_123022_347500_66FF24F3 X-CRM114-Status: GOOD ( 18.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: catalin.marinas@arm.com, linux-kernel@vger.kernel.org, sudeep.holla@arm.com, will@kernel.org, morten.rasmussen@arm.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Nov 13, 2020 at 04:58:43PM +0000, Ionela Voinescu wrote: > On Friday 13 Nov 2020 at 16:02:34 (+0000), Mark Rutland wrote: > > On Fri, Nov 13, 2020 at 03:53:28PM +0000, Ionela Voinescu wrote: > > > Given that smp_call_function_single() can deadlock when interrupts are > > > disabled, abort the SMP call if irqs_disabled(). This scenario is > > > currently not possible given the function's uses, but safeguard this for > > > potential future uses. > > > > Sorry to contradict earlier feedback, but I think this is preferable > > as-is, since smp_call_function_single() will > > WARN_ON_ONCE(irqs_disabled())), but this will silently mask any dodgy > > usage. > > Probably it only contradicts the chosen implementation. > > > > > If we want a separate check here, I reckon we should wrap it with a > > WARN_ON_ONCE(), and only relax that if/when we have a legitimate case > > for calling this with IRQs disabled. > > > > That's fair. I'll replace the condition below with: > > if (!cpu_has_amu_feat(cpu)) > return -EOPNOTSUPP; > > if (WARN_ON_ONCE(irqs_disabled()) > return -EPERM; That'd be great, thanks! With that, feel free to add: Acked-by: Mark Rutland Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel