Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp836603lqb; Fri, 15 Mar 2024 07:47:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU2whY+cfv2RNlxvUNgymFTkcnmzqgZebKpwrVB0w7gA7tvjWI0DCKvtv5ST/FpGv3NQAglmc95JSFXR7MDsLzvQv86/ItNba+JdsyxCg== X-Google-Smtp-Source: AGHT+IEkINnQowWG2KFdJcy9HTP0WOAFmWYYq3F6xr8fn3qYTR1QCfv6GUfigqTMaAkmdo3i1ypW X-Received: by 2002:a05:6870:d152:b0:221:cb66:c36b with SMTP id f18-20020a056870d15200b00221cb66c36bmr5447112oac.4.1710514027352; Fri, 15 Mar 2024 07:47:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710514027; cv=pass; d=google.com; s=arc-20160816; b=Sm0bSHuX7ZVNAOqY8wDWoLhrnWhTlXw2UqpJbgIOrK3U02/SPdVQPh2NjNaScQ0Cac mtjiykywosuPhnhdPfBYNe+vzwM6RdKYaVVBLOpv0bi4Mg8FBfi3COlRTh7gBzSHGUeI C5tgwYXMXt7RAerVCwl6sHDGk6WeX4U5JfZTeOQmzAKUfrDi0WjS/NCsYPsVRNQijUlO 66Lvg9Ny47mzLnOL/r6LivSuHWfx8Ah1TOL7edpkjTUDImzJIco79u9QU+t+NM1IsAXR 9CBqPIhJWpET0+Bpl2X+RYGgLxpKcYOi3w9d/UkoE8eHfG4FqlZfishQBxa0p1gB/p/2 Ip7g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=dISTFzApEIqPSKy2ueVarUzhlQTBKtGYYqGPe6Yegdw=; fh=kSvuG4ZgZVKSTFoHfTrPwAuKlQn3G2RmV5sq5Htf7x0=; b=0DyI3nOPgJMwL/d6XwJZt7NJTOBRZ9cNQiXSmRkbuUrfhEuuiTkFGGO4v1ERl1VPBi q+SQfUp0ZWetum/ZEeS89r2xiqNkr1hqirlVRxy7I6muAb5TN63ln1ofSC/iJL2WA0KG MrqAeCWr5d2GEQY1zi5Lcr2VcX6wYuBDGI3T0mQZOe0ApOUjY6UKft/U6xu36dpgE+ti PdMezWXBfa9Um/oRTXmXPJvgRIZYriENMBhnDIfl+Pol+ghobSLYKUDkPLBU1FDeLdlO K+Io/NEuGJyq3n1MMW4PmSLL+0q2ZrqzhwH9CEbEfmpMHehbCwUIR0L136sy21tH/9kE 9GbA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k5L7FB7Z; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-104531-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104531-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a1-20020a05620a02e100b0078822f49d79si3732591qko.631.2024.03.15.07.47.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 07:47:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-104531-linux.lists.archive=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=@kernel.org header.s=k20201202 header.b=k5L7FB7Z; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-104531-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104531-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 029751C209B9 for ; Fri, 15 Mar 2024 14:47:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B394C4C3D0; Fri, 15 Mar 2024 14:45:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="k5L7FB7Z" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C6046487B5; Fri, 15 Mar 2024 14:45:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710513905; cv=none; b=RaHlV50ODyKx0R3v4hOO9GGCtEJlbvp1Elrpo9Jksn5vJl2p9RNDG63MLD/jbT+WvayRMJT2KJRdGSdFe08Tg2+BvqSSW/8AJNunSOD9KKZSYQ9t/jKOPBEB6lmtLE6/qxmBvWueEfCEd97jWnVM2T4k99iLPnRBSC+vhFIWfBk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710513905; c=relaxed/simple; bh=pHSHMrnqR0ZCUlfOmkPFExxeq+HQHfhP88ZBOTpK7+U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YNqxOdDpu5N5/ynQcyLx5R6YIfi4MFo2WxyVtK4wEvtvtXZA4x/yEKuYt5Ss7CWVclNwm8/iyq3f9193uarRMastLCsb3GLmUJWCw0SshoXeGzaDsgrSyZ0YUtZAn1nN9YSyobvIS5C2l0WPtXtQSrbmlBpONxx80FGheIfX/AY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=k5L7FB7Z; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EF12C433C7; Fri, 15 Mar 2024 14:45:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710513905; bh=pHSHMrnqR0ZCUlfOmkPFExxeq+HQHfhP88ZBOTpK7+U=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=k5L7FB7ZPJtTBZL1lfjZb4NkQC98oCeF4hiesYmJWVwHzkLUHvfqxpwCFRRn2kLr7 3Sk8riGIe8rYazkDUkbaNk3wjmXBYybetTp0iyIw9JJLxusH2eLYFaz/mgxoMPsB9x 1BWcqe83XsD5fzeHuS9DJS6AT/jdyfLPXPCHCzJFylPJudi6QXWDGLIQx/atyOkaZO nknUIiRPIm2cPbsmqTVMaro3/xY32t/CTKgJFeMpjZkN7tdW8vWW3pyP0wHs5ghMmH /NulkRAvne/o8lYJak4oHcXaZHWRVjibwsJkNHxqMV4UiWftOhisHeEUNYT0KJnH/R mw2QeyKmdVDtQ== From: Benjamin Tissoires Date: Fri, 15 Mar 2024 15:44:44 +0100 Subject: [PATCH v4 7/7] HID: bpf: allow to use bpf_timer_set_sleepable_cb() in tracing callbacks. Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240315-b4-hid-bpf-new-funcs-v4-7-079c282469d3@kernel.org> References: <20240315-b4-hid-bpf-new-funcs-v4-0-079c282469d3@kernel.org> In-Reply-To: <20240315-b4-hid-bpf-new-funcs-v4-0-079c282469d3@kernel.org> To: Jiri Kosina , Benjamin Tissoires , Jonathan Corbet , Shuah Khan Cc: Benjamin Tissoires , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1710513885; l=1287; i=bentiss@kernel.org; s=20230215; h=from:subject:message-id; bh=pHSHMrnqR0ZCUlfOmkPFExxeq+HQHfhP88ZBOTpK7+U=; b=neXHs6HmauwDcYyxZkB2zyEGDGkjjsb/jB2ZqXOyT2E7aR7xhzlaptJaXq5rkpXzM0p9yQoUE 2jmWyF+kMQFBp22CSeJfCS4DRsYQJC8xJunXMCcIiD+QUwgS+VGwPxv X-Developer-Key: i=bentiss@kernel.org; a=ed25519; pk=7D1DyAVh6ajCkuUTudt/chMuXWIJHlv2qCsRkIizvFw= Export the sleepable kfuncs we have on HID-BPF in tracing bpf programs, but with the condition of being used in a sleepable context. This allows to use the bpf_timer when used in a sleepable context through bpf_timer_set_sleepable_cb() and initiate work from a device event. Signed-off-by: Benjamin Tissoires --- no changes in v4 no changes in v3 new in v2 --- drivers/hid/bpf/hid_bpf_dispatch.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/hid/bpf/hid_bpf_dispatch.c b/drivers/hid/bpf/hid_bpf_dispatch.c index e1a650f4a626..e27c2ffb4f60 100644 --- a/drivers/hid/bpf/hid_bpf_dispatch.c +++ b/drivers/hid/bpf/hid_bpf_dispatch.c @@ -544,6 +544,11 @@ __bpf_kfunc_end_defs(); */ BTF_KFUNCS_START(hid_bpf_kfunc_ids) BTF_ID_FLAGS(func, hid_bpf_get_data, KF_RET_NULL) +BTF_ID_FLAGS(func, hid_bpf_allocate_context, KF_ACQUIRE | KF_RET_NULL | KF_SLEEPABLE) +BTF_ID_FLAGS(func, hid_bpf_release_context, KF_RELEASE | KF_SLEEPABLE) +BTF_ID_FLAGS(func, hid_bpf_hw_request, KF_SLEEPABLE) +BTF_ID_FLAGS(func, hid_bpf_hw_output_report, KF_SLEEPABLE) +BTF_ID_FLAGS(func, hid_bpf_input_report, KF_SLEEPABLE) BTF_KFUNCS_END(hid_bpf_kfunc_ids) static const struct btf_kfunc_id_set hid_bpf_kfunc_set = { -- 2.44.0