Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1743914rdd; Thu, 11 Jan 2024 08:03:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJfRrHx4vzH4d3oPnESMcyKsKwR1EI1U6qxV5DjwM2fhChME/DWu/sci8TNGl3QfYOlqJT X-Received: by 2002:a50:9f8a:0:b0:557:c179:6d08 with SMTP id c10-20020a509f8a000000b00557c1796d08mr839764edf.79.1704988999807; Thu, 11 Jan 2024 08:03:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704988999; cv=none; d=google.com; s=arc-20160816; b=w4qajXOE4GlX8P3jWUbmDUBpFxu4sURO/1aGIokAEVRekbyCKwNispWzd/lgaRFoUc /gPmQFOW9/xgysXQLXlHorKH67wUgDSQyk2kXOc6Hm66rNH37BC9Y0S8d6PxTDTAPts4 N0YcbeDYkD6lRF6dkUwmQoMoQxhCcGWPdOWeNdNpCoVt0f68jCmEdLd5eA4alDubtEQw /Yj8GI9JjXbgGgSdRjx/k7PuOWXavfq5I/ksjrgSdUWkXEhfF0NSDH6NrmCpBGXIl+dZ W/4kmxHALJov6fX+vlRIXarHIKJMM9iSMwlk9/FAUnOYd8o/yZTfikdJlyKryIGxyquS oRxg== ARC-Message-Signature: i=1; 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=rvVCPW01Dzjo4BPhuO75nSETzwSq/CqyJjnh4//BiuE=; fh=DUImF22rLQ2BSBhWeKs87q+4R3vQbHU6KAFQoUe+ltU=; b=zljDBcVmXfsdva6keKB+jkTmyJhmLrsTMuCATZ5Y+Q/Wd8MTDBi5oO04rIinEwmT64 /wvRfO4uZuEccxPPwTFUqNVt+V/A98BiWTz1FcoJG/rpZQkLo0HJV8cJoFJZ5gEeutiT 6xU/QoLBgCQ46ado+U2Rc99dPGHGSPBfcGaaMhVPgYRoe4O4/3Nu+QEY8YOlr4FyTPpT ODPvL++glqx+RYAavfr66BchNynmSk3bBYiYNt2OO2W67D7f225HtKcB8GXvYLQrrIq6 Akk9b73yR1NI6xMuHr7eMwlWbfD7tAwnurnpJa+1GUZ7GBOLd3hHvYzVw893fbSTHtaZ bWpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=U5jmSUMP; spf=pass (google.com: domain of linux-kernel+bounces-23824-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23824-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id p5-20020a056402074500b005573ce0bf0bsi639873edy.516.2024.01.11.08.03.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 08:03:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23824-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=U5jmSUMP; spf=pass (google.com: domain of linux-kernel+bounces-23824-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23824-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 8CB1F1F23C1E for ; Thu, 11 Jan 2024 16:03:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5F5414F882; Thu, 11 Jan 2024 16:03:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="U5jmSUMP" 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 1767F4F5E6 for ; Thu, 11 Jan 2024 16:03:09 +0000 (UTC) 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=1704988988; 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=rvVCPW01Dzjo4BPhuO75nSETzwSq/CqyJjnh4//BiuE=; b=U5jmSUMP0Oop0b9+KOpXgPob2ifnuxBpETVKaPYAG6dVfcVXJ98GMLWkaZQ/KPqcI8IlWo WVhbSoy83k7Yfik2N6iohm1AJIBIxRus/Q2ljcN2BAahiZsH8zYUbswgF697Rq+CbK3T1/ Tc72yXy2rjue3igwd2hf15AwOuYWxeA= Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-372-TyGL1Cg1MFmmWCJYEjl9aA-1; Thu, 11 Jan 2024 11:03:05 -0500 X-MC-Unique: TyGL1Cg1MFmmWCJYEjl9aA-1 Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-1d56d0a8f85so19643995ad.1 for ; Thu, 11 Jan 2024 08:03:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704988984; x=1705593784; 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=rvVCPW01Dzjo4BPhuO75nSETzwSq/CqyJjnh4//BiuE=; b=vnoewhBFBfu8s2iLVNSWlOAoqpCmw2N7LWQU6FNvxPeALVFKtq6168bz+y/Jhd3N+E QRBrLX+xMQ6D3GFEMxyr5tKkoevnCjDAJcxpXTO4iuDXLxqrEKA8rxvzBYarAKLLPuYQ +HmMI1DvQzuGayZBZQ9Ppqu1oDmxZAvyp08ezk8t8iHqlBgwbtDYUnW08Hse1QL4NPFm 8/48n72D0d3zbUG+JXy4lQMMV/PoHNGiTb1ahhoCLgzNzhPEyVj6hvPYQ4naWTR3MJ4F 4H0Z7dCaf0LjrFOURoADAABFp/2Ck3ntbX38tgjx+BEeWdsZ6U4YKGVbaiGDwdJE+m+i 4Hxw== X-Gm-Message-State: AOJu0YwANGH2dhfTRdw7Ht6MS0jg0t5sNTWj6E11RHuM+dpWv0Bcxoeo kZNo2wA+AXaRMKox2dC0d/YWhXPhVjrg2DtiDwBD0C/YdBlHwk/ougkJt07+m9xVaYkLt9+esgQ 9rHPMktvqBwgWVU8O+/8N3ts3LecwBYE= X-Received: by 2002:a17:902:da8b:b0:1d4:3736:88b0 with SMTP id j11-20020a170902da8b00b001d4373688b0mr1229925plx.55.1704988983852; Thu, 11 Jan 2024 08:03:03 -0800 (PST) X-Received: by 2002:a17:902:da8b:b0:1d4:3736:88b0 with SMTP id j11-20020a170902da8b00b001d4373688b0mr1229908plx.55.1704988983482; Thu, 11 Jan 2024 08:03:03 -0800 (PST) Received: from klayman.redhat.com (net-2-34-31-72.cust.vodafonedsl.it. [2.34.31.72]) by smtp.gmail.com with ESMTPSA id jh18-20020a170903329200b001d4593a2e8fsm1343903plb.83.2024.01.11.08.02.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 08:03:02 -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 v5 0/1] fpga: improve protection against low-level control module unloading Date: Thu, 11 Jan 2024 17:02:41 +0100 Message-ID: <20240111160242.149265-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 Content-Transfer-Encoding: 8bit This RFC proposes a solution to keep protecting the fpga manager 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_manager struct that can be set while registering the manager. For more context, please refer to these threads: https://lore.kernel.org/linux-fpga/ZS6hhlvjUcqyv8zL@yilunxu-OptiPlex-7050 https://lore.kernel.org/linux-fpga/ZT9qENE9fE3Z0KCW@yilunxu-OptiPlex-7050 v5: - Updated the documentation - Removed kernel-doc comments for helper macros v4: - Use helper macros to set the owner module v3: - Improved locking v2: - Fixed protection against races during module removal Marco Pagani (1): fpga: add an owner and use it to take the low-level module's refcount Documentation/driver-api/fpga/fpga-mgr.rst | 34 ++++---- drivers/fpga/fpga-mgr.c | 93 ++++++++++++++-------- include/linux/fpga/fpga-mgr.h | 28 +++++-- 3 files changed, 102 insertions(+), 53 deletions(-) base-commit: c849ecb2ae8413f86c84627cb0af06dffce4e215 -- 2.43.0