Message ID | 20231218202809.84253-1-marpagan@redhat.com |
---|---|
Headers |
Return-Path: <linux-kernel+bounces-4347-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp1513012dyi; Mon, 18 Dec 2023 12:28:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IE2kASN+a3jdleTjUzXkC5+/5uQhr5DGaQvqFWq7760x+rweR1YBZmfNVIcC771/nNXly69 X-Received: by 2002:a17:906:a843:b0:a1b:763c:b382 with SMTP id dx3-20020a170906a84300b00a1b763cb382mr7645129ejb.115.1702931314482; Mon, 18 Dec 2023 12:28:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702931314; cv=none; d=google.com; s=arc-20160816; b=SCWC0SC+mFzzqSFwUIRurNMFDIozcLn9HsJaISkbbpDWY+h35aKm0zfY3WuHqVh/4N mlHnzoZJjQnwlMTV3mgjhEu3oSgeJuYqdRAW4Kl8x2lZVsuMu5ifRdUPvZ+k9MiyZnhP tdcMJDp9fOkq7KoC3ZTds1NylLSNg4/Dh0vumjoqSpAShEu2NRyityjRRH+RTshbCJ/y 4WSVP0E+fBcf5dVEkceocaneZ2a4NW29NRqMqk3ndKAwQXb7JbYCbb+AeFL9djrj6fbW 3vrCMSoB6pwOQjg0HjLpckmroT5SVmfq2jPwAzlss7xwf6OJH6VHeAjnMmFhdQCxmVtY hK6Q== 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=cesTf4BMIhSFr8qWWmn/Rq34XyOQvunDu3wB6pOXvHw=; fh=RI0mNHrSGBk/0gJ3tsBPdYn+81ROXQTqubQc1unKFUU=; b=GyQEa1kVBdiWD7asLvZ8Ad8B/cn60dRD37QQ7mD1zxiXrichMReHeJfClmGxbDRuPy YBd3tS3RCmIuGDtb//s9JzlQXwfcTDutFjK8n00F4cI6h3/lR6ExJuceGDfmfPv2UK9V 5K4RCD5zaFEyt9sq/1JSP1H41jvtl0eAlXB4H3Vbpj2yg3lAY3NVPiWD4K+QiF3Qmuqr F1aLkk2Cj5VCuRp7zAOwmxiNw0AHKh4vwiDvQDCN3yH2D4SYe72v/+F7oBDqdpOqmKRW H9WgEmIH2hiyKY3bLZAXJM6RQGenH3TiIXciXlhukU5SIOkkNcP0mdilQEyLy/xIZcjP t++w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HcRtlIzl; spf=pass (google.com: domain of linux-kernel+bounces-4347-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4347-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id d18-20020a170906345200b00a232c95579asi2163743ejb.502.2023.12.18.12.28.34 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 12:28:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4347-ouuuleilei=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=HcRtlIzl; spf=pass (google.com: domain of linux-kernel+bounces-4347-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4347-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 1D6DC1F245D8 for <ouuuleilei@gmail.com>; Mon, 18 Dec 2023 20:28:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EC7FD7347C; Mon, 18 Dec 2023 20:28:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="HcRtlIzl" X-Original-To: linux-kernel@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 CA53648784 for <linux-kernel@vger.kernel.org>; Mon, 18 Dec 2023 20:28:17 +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=1702931296; 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=cesTf4BMIhSFr8qWWmn/Rq34XyOQvunDu3wB6pOXvHw=; b=HcRtlIzlbWP3bvbiYrV9VvdR6HIfOIq2FcqZfV2PPmock5m0tSN1nMNJm0jvNw3W4I5pp5 Rp2waSlhsT+yycOIwuSt50b6TOWqF1lmwNqHUcSHN33V3ogcgOXCMuwviuQmaNkj4e0rGT IfmhbL6uvIDm3Is5iW5RvDx53sqs3sI= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-479-XxjLKtEGMcuo51MSfWMaBw-1; Mon, 18 Dec 2023 15:28:15 -0500 X-MC-Unique: XxjLKtEGMcuo51MSfWMaBw-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-40c6397d9adso30858635e9.0 for <linux-kernel@vger.kernel.org>; Mon, 18 Dec 2023 12:28:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702931294; x=1703536094; 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=cesTf4BMIhSFr8qWWmn/Rq34XyOQvunDu3wB6pOXvHw=; b=tB/2usPUGywaQYzO35u04wE8YLYpUQ968B6iWOeqiAVwypHKMn7orY8wllmZok4b6t 9ezENiR2R0WUrsZsBVv5f9KHXyKseowL4BnZ7VX6x7x3n4OISIHR1DHCBIVtvBnZDRol g4Ka6WBFVbj7ojTQKBYyHsDME0v4dTPrIndCLnOmj5ZDlaO3HvL+lgo+F3ijLugxrNsu ntYWoCcdplXb21kwiq1tGbMGBkCjGXH8yOudS3Lyi5R51H3jxMpgFl2nJC37CRlwqKN5 TAfiFtCFfh8Xv2Ap/mFQUUe5q4fMZtZcNxkhxPINjZGHqOv7K4nXYHNzxQwPyURH5lrX fHTg== X-Gm-Message-State: AOJu0YwKn1+FCB0N9I+lW0OAWSPgrz01pDapS6Hh5PsN1hVdAgpJTxAl oD/WIZ/KoglUOCfRW84qwX7mU8Ngutx+zo4VVHI1vbpadjuV+4KTzK+tKAK/hhcXV0/mI3aIA7N 2t+OWXRQ3xuOJImYEaFdPvrA= X-Received: by 2002:a05:600c:1c1c:b0:40c:32d5:18e1 with SMTP id j28-20020a05600c1c1c00b0040c32d518e1mr8332907wms.179.1702931294154; Mon, 18 Dec 2023 12:28:14 -0800 (PST) X-Received: by 2002:a05:600c:1c1c:b0:40c:32d5:18e1 with SMTP id j28-20020a05600c1c1c00b0040c32d518e1mr8332896wms.179.1702931293828; Mon, 18 Dec 2023 12:28:13 -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 p3-20020a05600c1d8300b0040d1450ca7esm9487652wms.7.2023.12.18.12.28.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 12:28:13 -0800 (PST) From: Marco Pagani <marpagan@redhat.com> To: Moritz Fischer <mdf@kernel.org>, Wu Hao <hao.wu@intel.com>, Xu Yilun <yilun.xu@intel.com>, Tom Rix <trix@redhat.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Marco Pagani <marpagan@redhat.com>, linux-kernel@vger.kernel.org, linux-fpga@vger.kernel.org Subject: [RFC PATCH v3 0/2] fpga: improve protection against low-level control module unloading Date: Mon, 18 Dec 2023 21:28:07 +0100 Message-ID: <20231218202809.84253-1-marpagan@redhat.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785652905893109509 X-GMAIL-MSGID: 1785652905893109509 |
Series |
fpga: improve protection against low-level control module unloading
|
|
Message
Marco Pagani
Dec. 18, 2023, 8:28 p.m. UTC
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 platform driver for the parent device that is later used by the fpga manager (through the parent device's driver pointer) to take the low-level module's refcount. This proposal removes this limitation by adding a module owner field to the fpga_manager_ops struct. Low-level control modules can statically set the owner field to THIS_MODULE, and the fpga manager can later use it to take the low-level module's refcount. 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 v3: - Improved locking using Yilun's proposal v2: - Fixed protection against races during module removal Marco Pagani (2): fpga: add an owner field and use it to take the low-level module's refcount fpga: set owner of fpga_manager_ops for existing low-level modules drivers/fpga/altera-cvp.c | 1 + drivers/fpga/altera-pr-ip-core.c | 1 + drivers/fpga/altera-ps-spi.c | 1 + drivers/fpga/dfl-fme-mgr.c | 1 + drivers/fpga/fpga-mgr.c | 50 ++++++++++++++++++--------- drivers/fpga/ice40-spi.c | 1 + drivers/fpga/lattice-sysconfig.c | 1 + drivers/fpga/machxo2-spi.c | 1 + drivers/fpga/microchip-spi.c | 1 + drivers/fpga/socfpga-a10.c | 1 + drivers/fpga/socfpga.c | 1 + drivers/fpga/stratix10-soc.c | 1 + drivers/fpga/tests/fpga-mgr-test.c | 1 + drivers/fpga/tests/fpga-region-test.c | 1 + drivers/fpga/ts73xx-fpga.c | 1 + drivers/fpga/versal-fpga.c | 1 + drivers/fpga/xilinx-spi.c | 1 + drivers/fpga/zynq-fpga.c | 1 + drivers/fpga/zynqmp-fpga.c | 1 + include/linux/fpga/fpga-mgr.h | 4 +++ 20 files changed, 56 insertions(+), 16 deletions(-) base-commit: ceb6a6f023fd3e8b07761ed900352ef574010bcb