Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1727511ybi; Thu, 20 Jun 2019 02:44:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqwGKjUaIB/e6u+v8Wco00L94nryjQS0xtxAbA0jLj5+ydBHX9NinSt3r6+B2D8sUHlqjmdM X-Received: by 2002:a17:90a:24e4:: with SMTP id i91mr2266025pje.9.1561023892309; Thu, 20 Jun 2019 02:44:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561023892; cv=none; d=google.com; s=arc-20160816; b=QGbJnhxQK5lwZxAsTY0sUenMnypWzPv+3zjecScrZd/gue1yN+mR0NqeFQqWKAOzLM pKs8M29zuBHb9MR2+SyEsP0Sg9MYXJlxwoeQOlCKHAXNNw87YMDsb6oX2O7TvJRNt7+H 91dsDwocNWMBg9c/mM6t3zJIWUwBfR7SmG+OCDcLXhVMscXjaRGWIjuFT3OSzLAdQGbq /xDe1toevd7ZNzEwpvC1EWOpwGbYy2kDB6hJZLdapGHEDdNLZcbN1DafZwCShli62X7A 3peCyx19xzJbK0nlmCvEiK6zuLBBs/mavcTjUXVAi/QzxmFo5AoSFgHdEi37qSnBF42a Sdsw== 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:from:references:cc:to:subject; bh=pRe9SiMhcaOPj6O7o5H0Hshnl8lhYbDEa4SSYWYqUks=; b=JID+Ap3tT3wYAYabYsPoXTccMWLEyHiM7skelzHjTu5BLQta3W2hhbMZOGepi6vvAC OUyP5pv2xhNaMFDWzHvmXnZ+fm+YuIVjViT8X3T78cgTKVEMEporNkamYsxlzHLFrNDU eYRa6gpG5NN1wtW8EOwSd9nJ9eYzdsEKe3zX0RelKaWeSNjta8Tu88oeHPYyR34e1eQs M/5dhSVcBbMZgJJEGVQYlWJzTmbj7uWEcO41SJEWetv+tSZMmgNzugAuFIeg+7u26jFd AqO5WGEn8EHagN8Rz2T1LhN+3QFPzoltfzwiUmYEzKu9bYLDbBLu5qxBTCSwsnsJ2DPm 9jfg== 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 l8si5438783pgk.528.2019.06.20.02.44.36; Thu, 20 Jun 2019 02:44:52 -0700 (PDT) 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 S1726435AbfFTJo0 (ORCPT + 99 others); Thu, 20 Jun 2019 05:44:26 -0400 Received: from foss.arm.com ([217.140.110.172]:56642 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726071AbfFTJoZ (ORCPT ); Thu, 20 Jun 2019 05:44:25 -0400 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 F4104360; Thu, 20 Jun 2019 02:44:24 -0700 (PDT) Received: from [10.1.197.45] (e112298-lin.cambridge.arm.com [10.1.197.45]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F063E3F246; Thu, 20 Jun 2019 02:44:23 -0700 (PDT) Subject: Re: [PATCH] genirq: Remove warning on preemptible in prepare_percpu_nmi() To: Lecopzer Chen , linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Thomas Gleixner , Peter Zijlstra , Ingo Molnar , Marc Zyngier , YJ Chiang References: <20190620091233.22731-1-lecopzer.chen@mediatek.com> From: Julien Thierry Message-ID: <6b1dfe9b-90b4-2782-9444-b6afd2b8791b@arm.com> Date: Thu, 20 Jun 2019 10:44:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190620091233.22731-1-lecopzer.chen@mediatek.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Lecopzer, On 20/06/2019 10:12, Lecopzer Chen wrote: > prepare_percpu_nmi() acquires lock first by irq_get_desc_lock(), > no matter whether preempt enabled or not, acquiring lock forces preempt off. > > This simplifies the usage of prepare_percpu_nmi() and we don't need to > acquire extra lock or explicitly call preempt_[disable,enable](). > This allows wrong usage of prepare_percpu_nmi(). If you are not calling it from a preemptible context, you could start the call on a CPU, get preempted and setup the NMI on a completely different CPU than the one you started on. This check is for sanity checking, and if you end up calling prepare_percpu_nmi() from non-preemptible context then your intentions are unclear, unless you are fine with the possibility of "preparing an NMI on a random CPU". Also you would have no way to know that that CPU (since you could run on a random CPU) doesn't already have that IRQ line set for NMI delivery. So, I don't think removing those simplifies much, it just silences calls to it that could go wrong. Cheers, -- Julien Thierry