Received: by 2002:ab2:6f44:0:b0:1fd:c486:4f03 with SMTP id l4csp203674lqq; Wed, 12 Jun 2024 23:51:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXuPT1WaKMwP5Oo42ttg7cqSYn2bpzXNYFBm8mqnoNvYMvynoJ+3EuQ37JJNxQXmOGul6l+PG2V1w4sKbaHNpGdf3Ys4u3+JTx5sgk+ZA== X-Google-Smtp-Source: AGHT+IFVaa3RgijaeoYzsqY3E4NbTnwuODuVKqWA+qy7hur0jsSpzd0pxgfCwq2hxOAGPeQxQ6aN X-Received: by 2002:a05:620a:472a:b0:795:6078:9634 with SMTP id af79cd13be357-797f60404ddmr425295185a.43.1718261479960; Wed, 12 Jun 2024 23:51:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718261479; cv=pass; d=google.com; s=arc-20160816; b=fNCvRYZ5qmHLbU9y0hjzeanhqDRiyBpzoi6WBKT6+PFnaRzGG82N3QjFJLJvA3eHtA IvuywoeDFw5tP4A3d4RbPReSN6gmhSBwWugjIWOb4akZtWc/DYjZPgn5SWUhl50wsjYv lHO/g1tnPwjIjH4hkXl2zgqMZyOIufMWqIwWbhHHLUM1HZCTzUDs1NC6ZckDYnFtsYYs m6NL9aWFoBSwVarP92wKm9vT8ExA4517mvOqXlXE36MjSwYlmFPF6riLOTuPlsB2e0cV lmSJWaqP1sYkPqkz7xxCKNS7yQ+e50n40YC8x5nURsy1xs66WblANeVt9x2UQIbv37Ec 5drg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature; bh=dCYSl6m4zIwH4JbW6vfy7hbe96U8QsTjiiAI04n+hHg=; fh=rNsqoiNiY4uQm5aK22XwNOba4iS7zqJA7zzPSUNJytY=; b=lt5G307ihReFPUPc1wvYVS8FdOojIri3+K9EmxD1FNiCO3KLl+Fi4uZBs4QORms6g+ EwEqXD+1x/SD3G92J9Tkzf7IZHNtTWgchYkzofx0uJ0qsCeZR037pmXLAwKw73ZLeeEn gCfd6JHxa+BJn7+0D4Hqeh0UY0pmM5a/+RRKS5xF1mM5jnH7VRkS1LF70XHeE9RgVFCU eR9yoELzlUnKYO/nVB4XFcdJVniLh6pgd7szrDYH3e280mq3peKCyXypF/rB5Wdk93BZ oBw50jos+/SzynZq3abGd9VdM4NgvATy6wLhoDWAVs8KmyPfRfS+on0uAJ7F7b8VaMj1 Dy0Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JoAzxBX4; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-212655-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212655-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-798ac088130si74315285a.716.2024.06.12.23.51.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 23:51:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-212655-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JoAzxBX4; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-212655-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212655-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 8CF151C22B79 for ; Thu, 13 Jun 2024 06:51:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 98A10137C24; Thu, 13 Jun 2024 06:51:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JoAzxBX4" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 2073C2119 for ; Thu, 13 Jun 2024 06:51:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718261472; cv=none; b=doSr0gaZ+n46a7NbUfUimYnuxMxz7xs0UnAKwZv1IYoA1suBFQLDMWnKrQ8r9oTZuu/0hwTIkkLYog9dAK4uFHN7tYWeDvZ8Ap/8J+mpeG0gtdcb2/BzN9vl3TmRppVN3oVuSi8alIEDnAqV15labcyhOtr8jRcuBIDqWtoySnU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718261472; c=relaxed/simple; bh=dCYSl6m4zIwH4JbW6vfy7hbe96U8QsTjiiAI04n+hHg=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=bLiPcetmGuv0Sd3Mrltb1X8BvSLUq2z1nCzu7VY6Yyo5EGx5hKdP++/IG7W4NNhezhWwGHXHAMz7S51DvKFAMy+1ii625+b3Q70sd6XkI7inLEBVnHkOLJdaT1SPpKnP7k7e0N2UZpnd0g2oFU2JQN1zEI3pXvnmGpwFe2FmXiE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=JoAzxBX4; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718261469; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dCYSl6m4zIwH4JbW6vfy7hbe96U8QsTjiiAI04n+hHg=; b=JoAzxBX4Odb5UwJnY/3oa9O1NqoGR0Cvz9GfsftU9UyZFUE6KvVXbf9wqAWK1vhGsIKOGW /ogb1ONJDGOxIM84H5pkWdUAHkxDVIRdi9CWjEzX1VwpE317DMYhWgPw41/somJZu+/8gH 0nwD+rT1p8wbzZS3w8lM8HF+OMdDkJg= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-362-cmtoofamPw-4RMyS56pkcQ-1; Thu, 13 Jun 2024 02:51:05 -0400 X-MC-Unique: cmtoofamPw-4RMyS56pkcQ-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-354f30004c8so100850f8f.3 for ; Wed, 12 Jun 2024 23:51:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718261464; x=1718866264; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=dCYSl6m4zIwH4JbW6vfy7hbe96U8QsTjiiAI04n+hHg=; b=osfdxALkJRsqEhkVueQvtIQfZGXoiHnj0PptG5jmNtrlBQi/P2+p3bJDKZmAhiP5SM oduI5H2dSsJW/lcJrDXWyMLczO+fCqR5WOUNS1HT6WMcAum76jIw/mJ++X9/OAzNXNvq P3UUT5FYw64lO24dXE5PEm8YQMRmJhvs4OyG/Y5QE2RQDcUwNIqzjVYfgrmtX8WRfcvs hW5BftlQB4DE8NpUpjZurauzX5N3f0VEf6AIjQZ5Ut9GeewQLZyFZFG6Fex7FAKckA19 Nma5TxbgM/9vABjSSa0A1rvH1cjRiXCEtkgVleuSkzRJ8uv9x9UZ6//xfq6pCQR8fwYS A2Kw== X-Forwarded-Encrypted: i=1; AJvYcCWvsG1/wtrJfI12uFoOVIDFCiM9ql2uo7NGtFexr/Mp9IW10NniB/fmiF6DZQngi7kaCWUZJwKEofBhsUk=@vger.kernel.org X-Gm-Message-State: AOJu0Yzad2/lsvpgTJ+sB7YwVO+Vx/fE3mlfPHsTS9oseW2KI5+Y+gy4 iCqqzN4av8aIbV5gSMRLJtgaaJ4Myhnumh2xEi+8nkV0Ou6oRePnCquFwmtAlKkBaBJdEDFDG/y +pysZ/5dtTZ6FHUhq0eT76Tn3Gn/c48Lftwg8kK3WS6vncIYUXfq3gtNLADuCzw== X-Received: by 2002:a05:600c:511c:b0:421:7f30:7ccb with SMTP id 5b1f17b1804b1-422863a85d2mr28530815e9.1.1718261464148; Wed, 12 Jun 2024 23:51:04 -0700 (PDT) X-Received: by 2002:a05:600c:511c:b0:421:7f30:7ccb with SMTP id 5b1f17b1804b1-422863a85d2mr28530655e9.1.1718261463751; Wed, 12 Jun 2024 23:51:03 -0700 (PDT) Received: from pstanner-thinkpadt14sgen1.remote.csb (nat-pool-muc-t.redhat.com. [149.14.88.26]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-422874de607sm49767315e9.34.2024.06.12.23.51.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 23:51:03 -0700 (PDT) Message-ID: Subject: Re: [PATCH v8 03/13] PCI: Reimplement plural devres functions From: Philipp Stanner To: Bjorn Helgaas Cc: Hans de Goede , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Bjorn Helgaas , Sam Ravnborg , dakr@redhat.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Date: Thu, 13 Jun 2024 08:51:02 +0200 In-Reply-To: <20240612204235.GA1037175@bhelgaas> References: <20240612204235.GA1037175@bhelgaas> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Wed, 2024-06-12 at 15:42 -0500, Bjorn Helgaas wrote: > On Wed, Jun 12, 2024 at 10:51:40AM +0200, Philipp Stanner wrote: > > On Tue, 2024-06-11 at 16:44 -0500, Bjorn Helgaas wrote: > > > I'm trying to merge these into pci/next, but I'm having a hard > > > time > > > writing the merge commit log.=C2=A0 I want a one-sentence description > > > of > > > each patch that tells me what the benefit of the patch is.=C2=A0 > > > Usually > > > the subject line is a good start. > > >=20 > > > "Reimplement plural devres functions" is kind of vague and > > > doesn't > > > quite motivate this patch, and I'm having a hard time extracting > > > the > > > relevant details from the commit log below. > >=20 > > I would say that the summary would be something along the lines: > > "Set ground layer for devres simplification and extension" > >=20 > > because this patch simplifies the existing functions and adds > > infrastructure that can later be used to deprecate the bloated > > existing > > functions, remove the hybrid mechanism and add pcim_iomap_range(). >=20 > I think something concrete like "Add partial-BAR devres support" > would > give people a hint about what to look for. Okay, will do. >=20 > This patch contains quite a bit more than that, and if it were > possible, it might be nice to split the rest to a different patch, > but > I'm not sure it's even possible=C2=A0 I tried and got screamed at by the build chain because of dead code. So I don't really think they can be split more, unfortunately. In possibly following series's to PCI I'll pay attention to design things as atomically as possible from the start. > and I just want to get this series out > the door. That's actually something you and I have in common. I have been working on the preparations for this since November last year ^^' >=20 > If the commit log includes the partial-BAR idea and the specific > functions added, I think that will hold together.=C2=A0 And then it makes > sense for why the "plural" functions would be implemented on top of > the "singular" ones. >=20 > > > > Implement a set of singular functions=20 > > >=20 > > > What is this set of functions?=C2=A0 My guess is below. > > >=20 > > > > that use devres as it's intended and > > > > use those singular functions to reimplement the plural > > > > functions. > > >=20 > > > What does "as it's intended" mean?=C2=A0 Too nebulous to fit here. > >=20 > > Well, the idea behind devres is that you allocate a device resource > > _for each_ object you want to be freed / deinitialized > > automatically. > > One devres object per driver / subsystem object, one devres > > callback > > per cleanup job for the driver / subsystem. > >=20 > > What PCI devres did instead was to use just ONE devres object _for > > everything_ and then it had to implement all sorts of checks to > > check > > which sub-resource this master resource is actually about: > >=20 > > (from devres.c) > > static void pcim_release(struct device *gendev, void *res) > > { > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0struct pci_dev *dev =3D= to_pci_dev(gendev); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0struct pci_devres *this= =3D res; > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0int i; > >=20 > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0for (i =3D 0; i < DEVIC= E_COUNT_RESOURCE; i++) > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0if (this->region_mask & (1 << i)) > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= pci_release_region(dev, i); > >=20 > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (this->mwi) > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0pci_clear_mwi(dev); > >=20 > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (this->restore_intx) > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0pci_intx(dev, this->orig_intx); > >=20 > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (this->enabled && !t= his->pinned) > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0pci_disable_device(dev); > > } > >=20 > >=20 > > So one could dare to say that devres was partially re-implemented > > on > > top of devres. > >=20 > > The for-loop and the if-conditions constitute that "re- > > implementation". > > No one has any clue why it has been done that way, because it > > provides > > 0 upsides and would have been far easier to implement by just > > letting > > devres do its job. > >=20 > > Would you like to see the above details in the commit message? >=20 > No.=C2=A0 Just remove the "use devres as it's intended" since that's not > needed to motivate this patch.=C2=A0 I think we need fewer and > more-specific words. ACK. I will rework it Thank you Bjorn for your time and effort, P. >=20 > Bjorn >=20