Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp833453ybj; Tue, 5 May 2020 08:14:28 -0700 (PDT) X-Google-Smtp-Source: APiQypIuBw08Uag8zFqn5jC28z+oM6zxPWy6JaL0vFUOawd+mL2nYnyxXAn+br83ODp0u7svRhjF X-Received: by 2002:aa7:dac4:: with SMTP id x4mr2986049eds.127.1588691668029; Tue, 05 May 2020 08:14:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588691668; cv=none; d=google.com; s=arc-20160816; b=gIlrWc4FTnPjV0qX/X/qBYmYG342T5W/s6WLczGhkoqGRV/CFIZ3yW4JyroJb65Nqc L9FyhQc3vvmgNQLfV7tzC4ME7K5o9LNOssE8DjsAKRLWEi3QTyKTGar1yfMLoKhEGvky 6omw9pmC+MF9K/q8aKtL4xDy9kl2E4trSne7WEBsJL5SjHCRYehW/ENjVefaiSaQrZzY i/Mc2mFprouh6cjMzhXzdB6I6HcIvl886GEG9KRVdEN7PcCa5CH8haNQO0XJzp04mkyf s3DAaRmQ6Rf9iCqMDsm1MnVJk8tY2LwQU6ZLfyp6lVL4vReAt5uawICnZdmZNga33B4D Lw7w== 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:dkim-signature; bh=w07Ua+y87TcbEUwD5IRm/yZtzU9SpqQzjcOGSdoFspE=; b=bkuBq4T4UE4hslX8P8lEQcpJ5l/5uWJeWEWYfzlo8uPKb2/B9t38+zfKCvjLK3ITBD BqyYbooCQ3OZGPt9gz9VGevIM7MPumTzSCB3G/mFucHk0HzRfNN7/U30Jzzx/FFM8p2v yiAGDF+WJRs2rXceln+KWbswy/HLjUdFzP8QVeuPG9S2KDP95h2oELT6BZBDOXG11zjs DwEpXPS3NjrkwB3fcUnaOk2DYVEMvlUZ3PgySKKjLKsznkF5AJq2hFnlfI/hCP/Q/+o1 hTDQcCugbO+ql1ediUkYrabpD3O9ZX6mUpjTqvaHqtpTMSzajux+ZiCTCYrNEDkvviJ/ tvzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EyaqCaFC; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h4si1278261edv.521.2020.05.05.08.14.01; Tue, 05 May 2020 08:14:28 -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=@kernel.org header.s=default header.b=EyaqCaFC; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729534AbgEEPJW (ORCPT + 99 others); Tue, 5 May 2020 11:09:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:37492 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729320AbgEEPJW (ORCPT ); Tue, 5 May 2020 11:09:22 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (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 3E4DF2078D; Tue, 5 May 2020 15:09:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588691361; bh=wehOs7TzzSRDwsIiBrb11QEbyguhnDAUrPFjehEcsWw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EyaqCaFCUiFGU75ZiQ7lP/igTsu2wIlIHWUSD6+l2UJXUc/h+OJW+8gTjIs0ZICMo Py1MVzr2BsXo41HNEwcnLiGZG8HI3+eUekL+yTwId7gnF4Oz26D6m9Q74+aSJFNItE BmSem2l5jrxSksyLXkKfBJgNDYKiYzBrc4IxcT7Q= Date: Tue, 5 May 2020 16:09:16 +0100 From: Will Deacon To: Daniel Thompson Cc: Catalin Marinas , Douglas Anderson , Jason Wessel , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, patches@linaro.org Subject: Re: [PATCH v2] arm64: cacheflush: Fix KGDB trap detection Message-ID: <20200505150916.GC24239@willie-the-truck> References: <20200504170518.2959478-1-daniel.thompson@linaro.org> <20200504204803.GA5657@willie-the-truck> <20200505141529.2qb35fbqudtac3ys@holly.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200505141529.2qb35fbqudtac3ys@holly.lan> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 05, 2020 at 03:15:29PM +0100, Daniel Thompson wrote: > On Mon, May 04, 2020 at 09:48:04PM +0100, Will Deacon wrote: > > On Mon, May 04, 2020 at 06:05:18PM +0100, Daniel Thompson wrote: > > > diff --git a/arch/arm64/include/asm/cacheflush.h b/arch/arm64/include/asm/cacheflush.h > > > index e6cca3d4acf7..ce50c1f1f1ea 100644 > > > --- a/arch/arm64/include/asm/cacheflush.h > > > +++ b/arch/arm64/include/asm/cacheflush.h > > > @@ -79,7 +79,7 @@ static inline void flush_icache_range(unsigned long start, unsigned long end) > > > * IPI all online CPUs so that they undergo a context synchronization > > > * event and are forced to refetch the new instructions. > > > */ > > > -#ifdef CONFIG_KGDB > > > + > > > /* > > > * KGDB performs cache maintenance with interrupts disabled, so we > > > * will deadlock trying to IPI the secondary CPUs. In theory, we can > > > @@ -89,9 +89,9 @@ static inline void flush_icache_range(unsigned long start, unsigned long end) > > > * the patching operation, so we don't need extra IPIs here anyway. > > > * In which case, add a KGDB-specific bodge and return early. > > > */ > > > - if (kgdb_connected && irqs_disabled()) > > > + if (in_dbg_master()) > > > > Does this imply that irqs are disabled? > > Yes. > > Assuming CONFIG_KGDB is enabled then in_dbg_master() expands to: > > (raw_smp_processor_id() == atomic_read(&kgdb_active)) Aha, so this can drop the raw_ prefix and call smp_processor_id() instead? I can queue the arm64 patch regardless. Cheers, Will