Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp190409lfo; Tue, 17 May 2022 21:50:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9vJBF4q4f+e2Erd+LhTKD5ZDXNAZvrdeiVxOS4uvPpt0R8YcusOWsk/BTZpGZOADMYLnW X-Received: by 2002:a17:90b:1649:b0:1dc:890e:2407 with SMTP id il9-20020a17090b164900b001dc890e2407mr40125293pjb.113.1652849421679; Tue, 17 May 2022 21:50:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652849421; cv=none; d=google.com; s=arc-20160816; b=HWKC/bbr+NmQq9Hr7RLZ6fANyAhqQUYa6+q4lmoj33qPJx5xWWeOHQ9mEGvNiHeKPx n3bLZykmSqNIzJwSFo+HCJY0IDFt0rOeUPnFIJZH0FLROte22hpb/6c6f1aLqiJZOzGw JHyzOKUPF4fd5QojTJt+EkothDbwnraW+IM3EyZObT5Ze5jnaLpc6KG1tKBlR6X3xtee ZRbrqZ2IWMNF2AysDS6jwgkX4g3BacmzxAxy12eAvDXox+nwvi00Nh5to856lsPvz9oE frxCkcwZyd7zSApGiQLcI9WJP1F/cZR0FhpG8N6rl5msvyLeS0mVSdqVUBXz0j3KtRa1 FTzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:newsgroups:cc:to:content-language:subject:user-agent :mime-version:date:message-id; bh=PwK+GIoJ/RVHATwWw1P99NeaTRjr4QBhG+OHR4L0yQk=; b=tt/NxqkJ59F1CY81eHcjf1upoyfgY503CzF/egBow0FqRxt2yPVWS31uW4Ryt/t33o 0SHXW263JXQtB33TfkU7d/ywf5ukVfJ8X4/Cob5hlT3kQQLXrcw4EPgJ98JJahUEFcAD 4kW0TkXElLEopNxZMsjz3uKaAKzfa+uhAwAOzR8lHctFYtCTwgh2oPsBRDJMjX8oVSMD sAEdqQDhlEw3ZuOjIJXc5uD7kXLwC/GZzZsuq1qSyPv5B0quGIGNVewTirxBnvZ4EQy6 W/cpLqhmuvQizrvg7F7kXtLJ5T8//X4W2X7CdwMDDXxsKrSFuSU5JJTZCrpB6AdhqrRb W2PQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id t2-20020a170902e84200b001617cb83c70si1592064plg.407.2022.05.17.21.50.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 21:50:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 498DD132776; Tue, 17 May 2022 21:01:07 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351826AbiEQUMg (ORCPT + 99 others); Tue, 17 May 2022 16:12:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350965AbiEQUMd (ORCPT ); Tue, 17 May 2022 16:12:33 -0400 Received: from smtp.smtpout.orange.fr (smtp08.smtpout.orange.fr [80.12.242.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60DFD3EF0A for ; Tue, 17 May 2022 13:12:31 -0700 (PDT) Received: from [192.168.1.18] ([86.243.180.246]) by smtp.orange.fr with ESMTPA id r3YRnwureghzAr3YRn1yRW; Tue, 17 May 2022 22:12:29 +0200 X-ME-Helo: [192.168.1.18] X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Tue, 17 May 2022 22:12:29 +0200 X-ME-IP: 86.243.180.246 Message-ID: Date: Tue, 17 May 2022 22:12:26 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH 2/2] octeon_ep: Fix irq releasing in the error handling path of octep_request_irqs() Content-Language: en-US To: Paolo Abeni , Dan Carpenter Cc: Veerasenareddy Burru , Abhijit Ayarekar , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Satananda Burla , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, netdev@vger.kernel.org Newsgroups: gmane.linux.kernel.janitors,gmane.linux.kernel,gmane.linux.network References: <20220517052859.GN4009@kadam> From: Christophe JAILLET In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 17/05/2022 à 10:35, Paolo Abeni a écrit : > On Tue, 2022-05-17 at 08:28 +0300, Dan Carpenter wrote: >> On Sun, May 15, 2022 at 05:56:45PM +0200, Christophe JAILLET wrote: >>> For the error handling to work as expected, the index in the >>> 'oct->msix_entries' array must be tweaked because, when the irq are >>> requested there is: >>> msix_entry = &oct->msix_entries[i + num_non_ioq_msix]; >>> >>> So in the error handling path, 'i + num_non_ioq_msix' should be used >>> instead of 'i'. >>> >>> The 2nd argument of free_irq() also needs to be adjusted. >>> >>> Fixes: 37d79d059606 ("octeon_ep: add Tx/Rx processing and interrupt support") >>> Signed-off-by: Christophe JAILLET >>> --- >>> I think that the wording above is awful, but I'm sure you get it. >>> Feel free to rephrase everything to have it more readable. >>> --- >>> drivers/net/ethernet/marvell/octeon_ep/octep_main.c | 4 +++- >>> 1 file changed, 3 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c >>> index 6b60a03574a0..4dcae805422b 100644 >>> --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c >>> +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c >>> @@ -257,10 +257,12 @@ static int octep_request_irqs(struct octep_device *oct) >>> >>> return 0; >>> ioq_irq_err: >>> + i += num_non_ioq_msix; >>> while (i > num_non_ioq_msix) { >> >> This makes my mind hurt so badly. Can we not just have two variables >> for the two different loops instead of re-using i? >> >>> --i; >>> irq_set_affinity_hint(oct->msix_entries[i].vector, NULL); >>> - free_irq(oct->msix_entries[i].vector, oct->ioq_vector[i]); >>> + free_irq(oct->msix_entries[i].vector, >>> + oct->ioq_vector[i - num_non_ioq_msix]); >>> } >> >> ioq_irq_err: >> while (--j >= 0) { >> ioq_vector = oct->ioq_vector[j]; >> msix_entry = &oct->msix_entries[j + num_non_ioq_msix]; >> >> irq_set_affinity_hint(msix_entry->vector, NULL); >> free_irq(msix_entry->vector, ioq_vector); >> } >> >> regards, >> dan carpenter > > I agree the above would be more readable. @Christophe: could you please > refactor the code as per Dan's suggestion? Will do. I was sure that Dan would comment on this unusual pattern :) CJ > > Thanks! > > Paolo > >