Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6409428rwb; Tue, 22 Nov 2022 13:00:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf5RGUZZxp3PGwp1YfQAURZJujMWxtSOwPQbcV29ILpCQlCGEZDv4uMH/ux8Kl4mZmMW4LaR X-Received: by 2002:a17:902:ce04:b0:174:af35:4b90 with SMTP id k4-20020a170902ce0400b00174af354b90mr5716094plg.8.1669150855590; Tue, 22 Nov 2022 13:00:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669150855; cv=none; d=google.com; s=arc-20160816; b=ynyJZSTHae60SQz0F+7Lvvk4cctSvIZTeMc3N0XGVt4pt/xs6v2gyxZpegKytU9kEw kN+WJlsS/JmCfTA/RYDC6ulk+L7h5ksEes6mvp1NlWI+2iptFZ0kqnkaijzQEhcB1ZWB OhrbOqJScfZjxGlfi4EoVwfrSuhn9ff9MdmONVwAbFrnVT3TpZnXeTAYGbKb7h4vmYwJ 5Q81ynox7OEkhKiktB1O8hA/Ls4dMJ37iPQjNq6iAEtAkknl58d7Csn6p3/ubPEBD1s7 UkeU5QSIdiwv2HlIp1p9a5KOnDu9rQkGny7NkRPf0/SR/eo0IJFaFeXrQSUr3yi/PSIi f47g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=pfc3U0FP2Lnc5z1VrfUAMhH4qSDsY0sFH+bolxBJV2Q=; b=ZwIe+qMzfmgQW0J5pauRHJ/AgQQvi0QbNxC9QGVHpHdjDZq4DuDVZzdIvTM6+dKqxL vLZ7RHe4ICj303FxpsqV2Q8XPTmmmLK4vd+DDm3KoZYfL9O25cQNmz41VkOOyHUrhQxv S79kZgjxECK4vjTlVQ9J3+MHNHLi/6G8RFXXnKZEvEZKvd+F8Qy8OTL3DrSL/TqeKk8R CnZKIs3Q0PYEw6AwQw+LAZlv7jeUTr3Qyr9Foo78jKMYtGKK/JN8h4UvUhPtr91TSjv+ hJ7THzFOSUXm+WdzD5NZvFpUmulca5Uvd6O5Si+WTE/bDXVCkrePg/afKVIEj7fH50Kh /Nlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=hM0+j4i6; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=4vOCJeNn; 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=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a1-20020a631a01000000b004499643a02esi15745526pga.248.2022.11.22.13.00.43; Tue, 22 Nov 2022 13:00:55 -0800 (PST) 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=@linutronix.de header.s=2020 header.b=hM0+j4i6; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=4vOCJeNn; 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=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234667AbiKVUtY (ORCPT + 90 others); Tue, 22 Nov 2022 15:49:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234758AbiKVUtO (ORCPT ); Tue, 22 Nov 2022 15:49:14 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B2AF5FCE; Tue, 22 Nov 2022 12:49:13 -0800 (PST) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1669150152; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pfc3U0FP2Lnc5z1VrfUAMhH4qSDsY0sFH+bolxBJV2Q=; b=hM0+j4i6YHKWujhAPxELP3h3lThk/nXpw7qkuDY/Lb7y3seyF2eocYM9s+sWoQ3bd2DGqm E+qArth+HozHaHY+WvfqqPd36wsdoJVwl1T/54uDaO1Kay7GArLu8lTlOhjonFmjEvkTdD baMPWWWONXa1JktJGSiN7//y2+FpRjAv3lpIF/HxN/owtdToF+pW2vs87IB34GC88BclLq yV3z9P8+ykSxZrXf59Zg+c8mRtNdqO1xG5tnGc6nDPXM9vC9W9vo6EbxVwHXeAUzHK237w xgPEKGPlObiHTpZlHcn/8pI9ovFfgbJDH7/GRcv9L+KE5UUlX8vUsBnf3DpqlA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1669150152; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pfc3U0FP2Lnc5z1VrfUAMhH4qSDsY0sFH+bolxBJV2Q=; b=4vOCJeNnwKKKbqn7++W16tNi2GArm0BUEwdiN1YhXssZZvM8IOLP5YizELO29/tvSeGvvB dNASJi5SwSCkaNDA== To: Jason Gunthorpe Cc: LKML , x86@kernel.org, Joerg Roedel , Will Deacon , linux-pci@vger.kernel.org, Bjorn Helgaas , Lorenzo Pieralisi , Marc Zyngier , Greg Kroah-Hartman , Dave Jiang , Alex Williamson , Kevin Tian , Dan Williams , Logan Gunthorpe , Ashok Raj , Jon Mason , Allen Hubbe , "Ahmed S. Darwish" , Reinette Chatre Subject: Re: [patch 19/33] genirq/msi: Provide msi_desc::msi_data In-Reply-To: References: <20221111133158.196269823@linutronix.de> <20221111135206.346985384@linutronix.de> <871qpzkj9k.ffs@tglx> <87bkp0hzai.ffs@tglx> Date: Tue, 22 Nov 2022 21:49:11 +0100 Message-ID: <87k03mg1fc.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS 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 Jason, On Mon, Nov 21 2022 at 21:52, Jason Gunthorpe wrote: > On Mon, Nov 21, 2022 at 08:40:05PM +0100, Thomas Gleixner wrote: >> When looking at the wire to MSI abomination and also PASID there is no >> real per domain struct. It's plain integer information and I hate to >> store it in a pointer. Especially as the pointer width on 32bit is not >> necessarily sufficient. >> >> Allocating 8 bytes and tracking them to be freed would be an horrible >> idea. > > No, not allocation, just wrap in a stack variable: > > struct foo_bar_domain_data arg = {.pasid = XX}; > > msi_domain_alloc_irq_at(..., &arg); > > Then there is a great big clue right in the code who is supposed to be > consuming that opaque argument. grep the code for foo_bar_domain_data > and you can find the receiving side Agreed for the one or two sane people who actually will create their data struct. The rest will just hand in a random pointer or a casted integer, which is pretty useless for finding the counterpart. >> At least from the two examples I have (IDXD and wire2MSI) the per >> instance union works perfectly fine and I can't see a reason why >> e.g. for your usecase >> >> cookie = { .ptr = myqueue }; >> >> would not work. > > I'm not saying not work, I'm asking about the style choice Sure. The other reason why made this choice is that for many cases it spares a callback to actually convert the pointer into real storage, which is necessary because the data it points to is on stack. Just copying the data into the MSI descriptor solves this nicely without having some extra magic. I guess we're nearing bike shed realm by now :) Let's pick one evil and see how it works out. Coccinelle is there to help us fixing it up when it turns out to be the wrong evil. :) Thanks, tglx