Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp234462lqh; Mon, 6 May 2024 18:16:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUkuuk0pc2TI9pojKL2snt8FAarMIP/KWm4eQvr27f0pxb9RFlRlHWHPR4+aTqIp4mqMzGRmbe0l8I8eVuSdMHagstRfR9ViLAlalr/GQ== X-Google-Smtp-Source: AGHT+IFmYgLiJdfI7m5QBiYw7nUXIRJj45VNNCe+pQssAVDqXAvdRLqY/y4Nq+gYVvMWkTib0Euk X-Received: by 2002:a05:6512:619:b0:51d:605e:f0ce with SMTP id b25-20020a056512061900b0051d605ef0cemr8565508lfe.50.1715044581305; Mon, 06 May 2024 18:16:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715044581; cv=pass; d=google.com; s=arc-20160816; b=kyG89ZWXaag3bQw6DHg3H/4UisgVwMQMatKrQYhkRMcmXZNYCqpowi0GzPgq8vSWuq tqbtZKZzbFLUdRbGXRtb32jB5kpH07Drlc3qtXv4yY5EQOkEbc/m2bsPKRwnqZyCwssD iOflgjX8mqETaxZxm7oBmORPvEq9mvDPy0kXXcf2nK0FXMRKpql7Lwa3T7Yp5z37Vjrn xDSyBJJkLYZbnagKy4Aw63XqY7hQHHfp3X95mvE6/nGwalIDUGIYSVszhkrLfaSucw+R XUOwCqVhdz4DGNGDmKVEqZnaLpKbshRthUNlvVUvDfethg0ZY3h4Ggaaf//dyMcahI/u 188g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=wkhQ4oUvqWERjwnCsPQ4jZ+H+eBCqAL0R4bvU9DsomY=; fh=0lz/aKQe52PRv4nb1E8kpzDsCn7RqKY2nm7XDwxV3/E=; b=bQVrVxRMUBtZOyp71oF1J6s4BJCV/SPXxcOZCw1JRtHqty9aEnXJW/Hf88GbC6n/CD vnc07YkJSUoCNevCOH3knQCVM7sYCs5/YgQ0zbIlneMVA6GBmtZBzxV7T8ATTqm4mnY2 7UEGv4h3bYbUzksv1BR1YUBwxEBfetfgbSnIwyGnXQMQ129BcDS5t14uCJSVJtq95KO9 Wi5aY47bADvSf/Z5W3//y1svc6b+86u5dGLuddeH/GNrWvCDWLG1KSgX7e3BpaIwemHx FPzqNNtO7q0kgwLOmAG3wsi8OR3VYnKWfcVtNh/22WqkMxxezhMhaU1TdE33DLbdApsT fD0w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-170537-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170537-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id r9-20020a1709067fc900b00a59ad2fe7b6si3131015ejs.81.2024.05.06.18.16.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 18:16:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170537-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-170537-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170537-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id F17081F23D1A for ; Tue, 7 May 2024 01:16:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 202531877; Tue, 7 May 2024 01:16:15 +0000 (UTC) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68842110A for ; Tue, 7 May 2024 01:16:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715044574; cv=none; b=a5SkMVlSVUVSbF9pNlN/Ky9M1XtBqyrAZyV0LobxqRcYMZOmqAb4f8OlVatgV3U//S/USnaOuZpRSGuhFV/YDhbiDKFg9ll/tV042OKygGedfFytxX09I6agNGiBE83IJ5Ejzb94iDBicmf0fZI98TW6kJdmuU0PXAPqplmKbv0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715044574; c=relaxed/simple; bh=0NLuhG0ZDhEPB66NrG5+IpAgYJnuXOYTJ2EM8WwxC9Y=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=MdZWLgYwmZLyamd0fh/IsKmUPdQB/RSav/EsqwYS+CvkzxTchxjpFROZWL5bxgkoc67vxxPKlQz7lOlryRAeJTArM5bFZVprx+tDeZ7MA4D1r0B/Cp9yFtHH9uCKRNog2H2isC6SG9uoXFG9L2kQ58TYPfCg4HpccM/d1AnyCIY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4VYKxv5lqhzXnp8 for ; Tue, 7 May 2024 09:12:19 +0800 (CST) Received: from kwepemi500008.china.huawei.com (unknown [7.221.188.139]) by mail.maildlp.com (Postfix) with ESMTPS id 640F214038F for ; Tue, 7 May 2024 09:16:08 +0800 (CST) Received: from [10.67.109.254] (10.67.109.254) by kwepemi500008.china.huawei.com (7.221.188.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 7 May 2024 09:16:07 +0800 Message-ID: Date: Tue, 7 May 2024 09:16:07 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.2.0 Subject: Re: [PATCH] genirq: Simplify the check for __irq_get_desc_lock() Content-Language: en-US To: Thomas Gleixner , References: <20240506125057.307586-1-ruanjinjie@huawei.com> <87seyurfk7.ffs@tglx> From: Jinjie Ruan In-Reply-To: <87seyurfk7.ffs@tglx> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemi500008.china.huawei.com (7.221.188.139) On 2024/5/7 1:55, Thomas Gleixner wrote: > On Mon, May 06 2024 at 20:50, Jinjie Ruan wrote: > >> If it set "_IRQ_DESC_PERCPU" in "check" but the desc is not percpu, or if >> the desc is percpu but it not set "_IRQ_DESC_PERCPU" in "check", it both >> return NULL, so simplify the check in __irq_get_desc_lock() with "!=". > > What is exactly simplified here? > >> Signed-off-by: Jinjie Ruan >> --- >> kernel/irq/irqdesc.c | 6 +----- >> 1 file changed, 1 insertion(+), 5 deletions(-) >> >> diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c >> index 88ac3652fcf2..6c52deb134b9 100644 >> --- a/kernel/irq/irqdesc.c >> +++ b/kernel/irq/irqdesc.c >> @@ -882,11 +882,7 @@ __irq_get_desc_lock(unsigned int irq, unsigned long *flags, bool bus, >> >> if (desc) { >> if (check & _IRQ_DESC_CHECK) { >> - if ((check & _IRQ_DESC_PERCPU) && >> - !irq_settings_is_per_cpu_devid(desc)) >> - return NULL; >> - >> - if (!(check & _IRQ_DESC_PERCPU) && >> + if (!!(check & _IRQ_DESC_PERCPU) != >> irq_settings_is_per_cpu_devid(desc)) >> return NULL; > > The existing code is readable and obvious. This is not. Thank you for your review. The existing code is indeed clear, but it seems that both judgments are checking whether the percpu flags are consistent. > > Thanks, > > tglx