From patchwork Tue Feb 6 10:56:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Pagani X-Patchwork-Id: 19992 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1457170dyb; Tue, 6 Feb 2024 02:57:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IHtiMjqeIeXpGxRC7B5GVTKqsB8Tva6QO0m15HHW+eDaJPlLy12fwpajURTIPOZWwz/IUn7 X-Received: by 2002:a05:6902:2509:b0:dc6:dc58:8785 with SMTP id dt9-20020a056902250900b00dc6dc588785mr1249364ybb.62.1707217044596; Tue, 06 Feb 2024 02:57:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707217044; cv=pass; d=google.com; s=arc-20160816; b=p4RmXjcllEV1ETin7vSFswusczEkw/reiYvouwZZ45Eop3Xe6rS5OkdItcZQEH1Dd9 ppZWNORb9JYBLEvGL9bqahXcueLj/skg1zvM9a3EIpxnXRQpcggy7JsTcLRN4fNByyCo Cx7W5obNjQhuLfkdnrq6nmpMHNiRqjaljxHPR6f/MI2TWL9OqIXznPCJxLcGDNI/eW7I vQXQOfVPtv812rXTDV0rOD+ena7ZhZ+qzDoq48LUKktpPfSyBfB8qiyOC/8uRokmn6AB LDcTrBOVkKyAAo8lykqKd8UmStoMsy6z7pkLSoBxZ2wJcQVGD+dCMJj+6gdJA7+3OoiG JTBg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=NOcDAAfRrdOruM3vQufk8xXSJsuXJBYipbiUl5Fyob4=; fh=P1wW6UVlV8Rs3CFFgV58Ty2jF4KUMSrTu3dRK5Qabqw=; b=BB+OOYDaZSXoE61NWWUISfQxiyJ99ksVxPtRgtkVWMp1uHuA4TuOG+gXMcKXo+DHfM m2e7jpHjmtfLYnqJO7NQPrH9w0zI7IECiw95JnLxgn2vHbpWeACIETl28I72f8wJPpIf YfBZQsJAe4yotK4LEF9Mq18KIk45azsqDiwqjeTV7U6z1kvIUGQEDrZP2mQtx7NMlicQ nTIYJLPpNyihZ9tho19LZ5h75d79k6ke0MbQij+DyB5iuO+90UNml5tWNvREB7cdvHcs HdVeyV04r9FKVM9BZZCnb4vnsLtKeNlyNJg4e2fxeaXPHgoFg3Tw0arUQzTvSrkbCOmM VWsw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RVjKdDIs; 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-54723-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54723-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=1; AJvYcCVnd4Y4+R7qe9XzGToV54mwymRnin0VrmGVMaAAgGUenWuBonpsSjAWbJUHfBph8Lmx1++SEQhaWA5Xaaf6Hg6JNrjJMg== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ge5-20020a05621427c500b0068924025481si2267844qvb.216.2024.02.06.02.57.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 02:57:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54723-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RVjKdDIs; 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-54723-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54723-ouuuleilei=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 5E10D1C230C1 for ; Tue, 6 Feb 2024 10:57:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C9E0912EBE2; Tue, 6 Feb 2024 10:56:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RVjKdDIs" 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 9EBC51EA7A for ; Tue, 6 Feb 2024 10:56:53 +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=1707217015; cv=none; b=d/FKptAJH0AlR499vtISzuOv1Q5jaQloENMwGL8o/1EB8NWiSPOm2FeNtIHgfe8gHyYMn5e11mCoK1BauPDrVTihk3n9zAecCGSjBNab3Sn1UxRjNnxS5+FrSQNWGJePz+d0PMmfhf2NNjaD+kWW6d5nywvyfVqARjX50/+yG6I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707217015; c=relaxed/simple; bh=8vOg9PtERGFIzxGfr1uQ777xA4qgfnvqvPqJZtaB7dA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=QmdZhzsLjvKgMzOoLEV0H81XgMFK7pygtyGuaVPrWCPeRa7lsKHDYQlj+8uogkZXBxHy3fnGukExgii1MdjeSu3yiJX2U2XHkoyZtFVPSshbgcW5mNLvGJ88oBcQxRlJJ2RszcAlbKCCduXToxShNFabQcQZMioTwoY2C8l9E4w= 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=RVjKdDIs; 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=1707217012; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=NOcDAAfRrdOruM3vQufk8xXSJsuXJBYipbiUl5Fyob4=; b=RVjKdDIsSP0Q7OmBmNbtiO0JJ/ddL7gbF4tIuUVu58JvPlUy0SMNco+Y0PpWXFts19m9Jm uV8E3oMqcWf5HKL0kqmnHwx+JCcpFgOC7Bvjn7EdKw4HGsBsQak7ek6dCCs/CbYhBrNUYk SCVbIpIausJ+ok7Lk2phoncseslXF44= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-66-uPxI6AnQOc6Z9eg0kV6pog-1; Tue, 06 Feb 2024 05:56:51 -0500 X-MC-Unique: uPxI6AnQOc6Z9eg0kV6pog-1 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-68c4f2aca5dso95047336d6.3 for ; Tue, 06 Feb 2024 02:56:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707217011; x=1707821811; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NOcDAAfRrdOruM3vQufk8xXSJsuXJBYipbiUl5Fyob4=; b=BEx+yXNE6grtFCWM9BFgth7dhXQep7Cp8GKXQufNyKCNSIjBb1l1nhqImed1s+vFEq iDyzz1FlNu756EP4vpC5I25iViPHcNuoZQzOd5D4ebLNJLXKRuobCrldkE3O9LRP0h91 W9OS7Y4cnpxEQIDFXDnFAVlF5uMlzSoUdJ3kA4kFEmKiHvhKOJ1APy1aX+ed5MuDkU+K jaieI072aZokNlz8D771RUk4jobdWzkTZYLoVyZgjt3rKi6JIDPKvHSSlu0MyBHKNmbP Nea9WCgphuO4DPUfNuqgjEltfODXrIRSYOWTyIXv+GsoXSovlHNw0HauFQAfnOsUsKo5 jcVg== X-Gm-Message-State: AOJu0YzW7/JVz6jIHZpUvLdzn998fxDxihEc7OPWPE4FAB1TYJhgc66z vqHnRDLso99zMOzx1Imyi0RZX9CBMlRAD0I0E5Y/SWHq227ebqE9x3yjGilBA2hEVBbWbVADUpe vZFDlD+Q6wLzF4j+s55Uh3MjH3rFdoDsfg7tdLbM/nYBlHOqrd3xg8s9mIlHx X-Received: by 2002:a05:6214:21e9:b0:680:f8d2:c828 with SMTP id p9-20020a05621421e900b00680f8d2c828mr2323851qvj.16.1707217010851; Tue, 06 Feb 2024 02:56:50 -0800 (PST) X-Received: by 2002:a05:6214:21e9:b0:680:f8d2:c828 with SMTP id p9-20020a05621421e900b00680f8d2c828mr2323839qvj.16.1707217010625; Tue, 06 Feb 2024 02:56:50 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUy6sn6pHYdmwklCBeIPLcmA1sdU6HtNEqv2vI89wRaRuOTRoeDVvkMZSTi8k4LvKuQ+uw3wya3VWjclc935+MWSLQ1FLMXeUPsNKCqJwqo0N6g9CaWIXEbpHIvFW4hY7hdrx/83/UaLEwREYUxlSfIj5OurBwqw55BcvAuQ+neLuoy4C+Z+fIT9uVzHZvhMc9Sz4UEcu6C+LqYKemieSEGBzAP8IaKN126K1tr1tdC4NdMTGdm8oh6aM6Phr+EB36wRQfo/rv0tJjtyfcAZEnIX73Z08xwdYPfFImmhKT+pjVQWpQmPMlEnwVxqnnVrD4ZhbO4AMKT0PFYi1Oki6vJ+bbj Received: from klayman.redhat.com (net-2-34-24-75.cust.vodafonedsl.it. [2.34.24.75]) by smtp.gmail.com with ESMTPSA id hf15-20020a0562140e8f00b0068c95b634d3sm909547qvb.11.2024.02.06.02.56.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 02:56:50 -0800 (PST) From: Marco Pagani To: Moritz Fischer , Wu Hao , Xu Yilun , Tom Rix , Jonathan Corbet , Greg Kroah-Hartman , Alan Tull Cc: Marco Pagani , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-fpga@vger.kernel.org Subject: [RFC PATCH 0/1] fpga: bridge improve protection against low-level control module unloading Date: Tue, 6 Feb 2024 11:56:43 +0100 Message-ID: <20240206105644.41185-1-marpagan@redhat.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790146820023813215 X-GMAIL-MSGID: 1790146820023813215 This RFC proposes a solution to keep protecting the fpga bridge against the unloading of the low-level control modules while addressing the limitations of the current implementation. Currently, the code assumes that the low-level module registers a driver for the parent device that is later used to take the module's refcount. This proposal removes this limitation by adding a module owner field to the fpga_bridge struct that can be set while registering the bridge. The RFC patch is based on top of ("fpga: remove redundant checks for bridge ops"). https://lore.kernel.org/linux-fpga/20240201155713.82898-1-marpagan@redhat.com/ Marco Pagani (1): fpga: bridge: improve protection against low-level control module unloading Documentation/driver-api/fpga/fpga-bridge.rst | 7 ++- drivers/fpga/fpga-bridge.c | 61 +++++++++++-------- include/linux/fpga/fpga-bridge.h | 10 ++- 3 files changed, 47 insertions(+), 31 deletions(-)