Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp286732pxb; Thu, 19 Nov 2020 00:47:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJxYf7lfMvVb8DM62dgOlzDONQRJyZr71ry6ArkeX25D3WEel4S+tt/YCxjztrqVA4vimEHz X-Received: by 2002:a17:906:2ddb:: with SMTP id h27mr27209483eji.213.1605775672898; Thu, 19 Nov 2020 00:47:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605775672; cv=none; d=google.com; s=arc-20160816; b=KdkjsCapahCESE4eeiQUFI9937VDLAV7kID+M+Kk+LzAM6/ku2RJrEQ/vUIr5TiEDR Br99ncTp5K/H5oQN9pdXVtUUCgjBLt/lbkiI91oJnUbm0h3vpzJ9u7BXsPAg50TBLF30 lFqR9UFB6+/5bBjzkxSv6YjfaG3U8bdaMZ3mtrTvUGgvcTpwxq5oOdrFUkFHsipooQBt /YJmFm7LDLwczvjTcBH1QL8mv3PK6OHiGePznfCX1PzA54sBM4ST2W261YgF2eYz6DYQ lFTSAW6FHq6F5bebGFBEzDozLB4bMkGxlrfMgNBuLvOswDOB0e1d8gokDA/Qd3g1rdao 2p4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=M65Nr89H6jn9qE3jR9cANNOid4PKTb2N84Vbgzk+3RY=; b=m1mtYLnCk7uxM5eAP+THZl/hOkhrRLX3ud5lrW0SmM4eTeQN6M9fo2wHq1UAyi5M8Q iO/uMYA/XosmRJf83MZqVGmy+xdCPBX97g7BLENvweKBhhWplVWVYb+lXAEkSC9j5blT T5lTRuk+WkeVHdHmEs3DSy2Q22HXoUDsqeF4jstcCbozl3gZFGf27RPhqkmeIswX3M/C wGPsjo6e4Uu/eAX0XsBJoyhGYDyVc7w+UU6X5BT1tc3ttkE7HGQ19GR9wJ8SpJPM8Yza PtcFf357YnXyyOXiQKrsJo2l86ACN6snlka0OaOaDwDU3IAPjbF4HigiI9Kl5ivpx1LU viDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Eb+ZsPcz; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q26si17952976ejb.105.2020.11.19.00.47.29; Thu, 19 Nov 2020 00:47:52 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=Eb+ZsPcz; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726073AbgKSIni (ORCPT + 99 others); Thu, 19 Nov 2020 03:43:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:52736 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725648AbgKSIni (ORCPT ); Thu, 19 Nov 2020 03:43:38 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BB0B121D40; Thu, 19 Nov 2020 08:43:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1605775417; bh=GP7AYcVUPOh23WPA8GgN0PDVztnolsPIrPEVVI5te+I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Eb+ZsPczYI4/ZTWJ1/Q2AcUm8GHpqDQx/GL0DRroxJ21DxSCs8FvI3bsNRDpe9l5d ZTolWybz/IOaLH16nVKrHQzGTDeq3Jt2pL0jNxBraTqf8n7w3H0500ZidhWubBaboI PMwX/cQlnkKaWH1Bklkfy2ZxglvurV7Uyp0NH4us= Date: Thu, 19 Nov 2020 09:44:21 +0100 From: Greg Kroah-Hartman To: Sebastian Andrzej Siewior Cc: linux-kernel@vger.kernel.org, Thomas Gleixner , Cliff Whickman , Arnd Bergmann , Robin Holt , Steve Wahl , Dimitri Sivanich , Russ Anderson Subject: Re: [PATCH] misc/sgi-xp: Replace in_interrupt() usage Message-ID: References: <20201119081354.836813-1-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201119081354.836813-1-bigeasy@linutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 19, 2020 at 09:13:54AM +0100, Sebastian Andrzej Siewior wrote: > From: Thomas Gleixner > > The usage of in_interrupt() in xpc_partition_disengaged() is clearly > intended to avoid canceling the timeout timer when the function is invoked > from the timer callback. > > While in_interrupt() is deprecated and ill defined as it does not provide > what the name suggests it catches the intended case. > > Add an argument to xpc_partition_disengaged() which is true if called > from timer and otherwise false. > Use del_timer_sync() instead of del_singleshot_timer_sync() which is the > same thing. > > Note: This does not prevent reentrancy into the function as the function > has no concurrency control and timer callback and regular task context > callers can happen concurrently on different CPUs or the timer can > interrupt the task context before it is able to cancel it. > > While the only driver which is providing the arch_xpc_ops callbacks > (xpc_uv) seems not to have a reentrancy problem and the only negative > effect would be a double dev_info() entry in dmesg, the whole mechanism is > conceptually broken. > > But that's not subject of this cleanup endeavour and left as an exercise to > the folks who might have interest to make that code fully correct. > > [bigeasy: Add the argument, use del_timer_sync().] > > Signed-off-by: Thomas Gleixner > Signed-off-by: Sebastian Andrzej Siewior > Cc: Greg Kroah-Hartman > Cc: Cliff Whickman > Cc: Arnd Bergmann > Cc: Robin Holt > Cc: Steve Wahl > Cc: Dimitri Sivanich > Cc: Russ Anderson > --- > drivers/misc/sgi-xp/xpc.h | 2 +- > drivers/misc/sgi-xp/xpc_main.c | 8 ++++---- > drivers/misc/sgi-xp/xpc_partition.c | 9 ++++----- > 3 files changed, 9 insertions(+), 10 deletions(-) > > diff --git a/drivers/misc/sgi-xp/xpc.h b/drivers/misc/sgi-xp/xpc.h > index 71db60edff655..bbcf10ca3ab7f 100644 > --- a/drivers/misc/sgi-xp/xpc.h > +++ b/drivers/misc/sgi-xp/xpc.h > @@ -633,7 +633,7 @@ extern void *xpc_kmalloc_cacheline_aligned(size_t, gfp_t, void **); > extern int xpc_setup_rsvd_page(void); > extern void xpc_teardown_rsvd_page(void); > extern int xpc_identify_activate_IRQ_sender(void); > -extern int xpc_partition_disengaged(struct xpc_partition *); > +extern int xpc_partition_disengaged(struct xpc_partition *, bool from_timer); These types of "flags" for functions are horrible as they do not describe what is happening when you read the places the function is called. Instead, make it part of the function name itself: xpc_partition_disengaged_from_timer() and then handle it that way, by using a shared static function with the flag. Otherwise this type of change just does not age well at all. thanks, greg k-h