Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1932447rwd; Sun, 28 May 2023 05:18:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5nUx+as4draRBRMCpruUJ/xk3x1jx2RginYzXC4a24c+6VSTydVaW7zCYnRPVMHaGh6yjV X-Received: by 2002:a05:6a00:1702:b0:64a:9090:5147 with SMTP id h2-20020a056a00170200b0064a90905147mr11821963pfc.10.1685276298528; Sun, 28 May 2023 05:18:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685276298; cv=none; d=google.com; s=arc-20160816; b=ubCjQGmuhQIKPF4g1YzHj2zYuKHP6l2EYJA4XUfKYW2c6yRGxB/mudizcy1KkqP8wb dvSE+KULu+PmzQfg7XOfAQzpxf7YXHFwGHc7y5s4XNAgSlTaC9hbb+O1BzyC5i7E/kPB X5NFY8Kwosd8jO8SYah77GimL73o4BNCO4Px63RddFAn17zVuHWJNr7vQfHEnXuOlNL4 EnDaKJ8jCh848+rpyJNJgKfMn3njHVpN/+DYUz/ykCgrBQKAd57AMQTF6h2wk1uJLTUZ v9fcOfzJb8ecgm4TNbpTnpWJqxkMbf6y1wL1iIqfZ4/2hsiMWIcpr2pX3T/ByUSshgwU yx3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=NCK4pID7AezwcosN8lYup62mksPJs7beND49b/loKoc=; b=xvXv2G7zPk2r62U6DKfZfdgHZ+kYd1MO1pWO0s51PwoIHsO5UGqAcBOfY8t9kQ8mTT AH8uMSF+AtqF9CP6HA2/hRbSoKQMom6AMcWV3s9Se5lRASmJezmNKmvzd8/iI9j1ZRcW 5tRMdze4uOCpTyMbouhfMF6uEwi+s9R8LFB71GLKgb3VhpFI9E3alKI4Ya8prsWpDI9H GptA1b+tDpbAgITu8HAb+lNCCZB3bBFQsXt/+DzSyWDnWuK2b2h+y9zJkPA41HYqurOh gLNnzc8IoWdLUpzFnlGh/WlM31hsN7+lVJOaRIFVwARMCk38bDhsxvDgXUA3jdvYqih7 8vVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=V9B+QN+h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f65-20020a625144000000b0064f8adc3fa6si3171786pfb.70.2023.05.28.05.18.04; Sun, 28 May 2023 05:18:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=V9B+QN+h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229520AbjE1MIN (ORCPT + 99 others); Sun, 28 May 2023 08:08:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbjE1MIM (ORCPT ); Sun, 28 May 2023 08:08:12 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9D00AF for ; Sun, 28 May 2023 05:08:09 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-51458e3af68so3952956a12.2 for ; Sun, 28 May 2023 05:08:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685275688; x=1687867688; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=NCK4pID7AezwcosN8lYup62mksPJs7beND49b/loKoc=; b=V9B+QN+h2KyJX2igIuG4de2eBjN5rMsv//t46yFXRPIdkNQJyJCJUQGc2MCs6+bxho waj6b39j+TRCyQV17NHg9lGK2x5rt116/+gyktBjwMxo8T7Jy2+ajnGDornF7j5Wp91u oS1XK9Ye8jeFtoET+tMOGpnlLhGjQJROIYwC2RJR2iQIYFR3SDyXXNWa1xK6a9p2LNx1 DdnhXHE/1C2ZrRgjC6vQHFoA4GEduAeJppZzHqtyE4qDtpYzGhvPfOrJJ6T/xt4w+5OH qsv2rz7gC7oATe/idKEerYNzTeziT0wct4uF/9YPHiLjKSmGYSzVTsxcLFJ1v/OMANH5 NUtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685275688; x=1687867688; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NCK4pID7AezwcosN8lYup62mksPJs7beND49b/loKoc=; b=QUzQpcLktSSxeaP2Zv1IjIFHTB06CKXr2sjzBPnbQA+VjtxYliaOQIVYG/AkceahlK eebFJtYjFVpcBoeh/0xmmdCPTO9t2GxFDgf1CzdNRGgkjvLlTj5yIYe0EAvC+sL/qQnX pMRI334jJMEzxSd7zmUflAietDrj9itIMutgzLMx1yNbC37gBTkDUIby6OfO9UcN6Jk6 +hkZ1x21VuRdedFmvMRzYbRV7GEQL8GVChhslfSPjzgUQ+AJDdNIsW8yAEIIa5w7fetf Wke/rZQiXHvjT3THN3/JnC7kIC7uQx5jfoFXqq2/yWFkjZzEOhaWnTUIye2+96Xuy6O6 s5zQ== X-Gm-Message-State: AC+VfDwYNeJDXcRygg4YxRin9LvVZqlIp1euevHQT2mNB2PeG/kI8Btz j/f3xTFxKJh1vF3v+r7umrJA/h/nIue5IqX2qUrZUmiSJP1CTBUx X-Received: by 2002:a17:907:9289:b0:973:8198:bbfb with SMTP id bw9-20020a170907928900b009738198bbfbmr8206431ejc.31.1685275688145; Sun, 28 May 2023 05:08:08 -0700 (PDT) MIME-Version: 1.0 References: <20230527054633.704916-1-chenhuacai@loongson.cn> <20230527054633.704916-2-chenhuacai@loongson.cn> <87pm6llvm6.ffs@tglx> <86fs7gdhid.wl-maz@kernel.org> In-Reply-To: <86fs7gdhid.wl-maz@kernel.org> From: Huacai Chen Date: Sun, 28 May 2023 20:07:56 +0800 Message-ID: Subject: Re: [PATCH 1/2] genirq/msi, platform-msi: Adjust return value of msi_domain_prepare_irqs() To: Marc Zyngier Cc: Thomas Gleixner , Huacai Chen , Bjorn Helgaas , linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn, Xuefeng Li , Jiaxun Yang Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Hi, Marc, On Sun, May 28, 2023 at 3:47=E2=80=AFPM Marc Zyngier wrote= : > > On Sat, 27 May 2023 15:03:29 +0100, > Thomas Gleixner wrote: > > > > On Sat, May 27 2023 at 13:46, Huacai Chen wrote: > > > Adjust the return value semanteme of msi_domain_prepare_irqs(), which > > > allows us to modify the input nvec by overriding the msi_domain_ops:: > > > msi_prepare(). This is necessary for the later patch. > > > > > > Before: > > > 0 on success, others on error. > > > > > > After: > > > =3D 0: Success; > > >> 0: The modified nvec; > > > < 0: Error code. > > > > This explains what the patch does, but provides zero justification for > > this nor any analysis why this is correct for the existing use cases. > > > > That longsoon MSI domain is a PCI MSI domain. PCI/MSI has already a > > mechanism to return the actual possible number of vectors if the > > underlying space is exhausted. > > > > Why is that not sufficient for your problem at hand? > > I've already made that point, but it seems that the argument is > falling on deaf ears. I'm very sorry that I didn't answer your question directly. > > Being able to allocate MSIs is not a guarantee, and is always > opportunistic. If some drivers badly fail because the they don't get > the number of MSIs they need, then they need fixing. Yes, I know allocating MSIs is not a guarantee, and most existing drivers will fallback to use legacy irqs when failed. However, as I replied in an early mail, we want to do some proactive throttling in the loongson-pch-msi irqchip driver, rather than consume msi vectors aggressively. For example, if we have two NICs, we want both of them to get 32 msi vectors; not one exhaust all available vectors, and the other fallback to use legacy irq. I hope I have explained clearly, thanks. Huacai > > I really don't see the point in papering over this at the lowest level > of the stack. > > M. > > -- > Without deviation from the norm, progress is not possible.