From nobody Sun May 24 22:33:49 2026 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B01183D1CC6 for ; Wed, 20 May 2026 18:21:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779301299; cv=none; b=nK0nEoAUIVKnfIIEdOd9XSVkJz8Jm1MtuZ0uFS9Q05INo/KRXn+iA1L+MmSiS01soB4cmI2J/uYUQQMjgB0sPMANDY8HPAQqy2dly5UXFuTHUWD5X90kNCrH0LXAUHS3/Jp7sygrjYeTZEfVQn5BtExmlHgmD1kikYb/fJiouWs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779301299; c=relaxed/simple; bh=x636ut0RZ5wYnt7aSj18rAtb/0svsgw9sQkTLVXWxcQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=ZsQIu87rpMe9+tit1NnWkisjd1Amvh9l4Pbpe07nhnYeee28eSxtNfoisB0kVINCEp1oXkwHNKGe4c7PREQ7Zyk6/BIe0nrBG3Q3jvegMCi3Bf0USvdsnpeqyY2coWnMKPQw5VzzsqInWAOthBRaF/A85X7+O+yePC071+5ykvI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=YTUOkO7V; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="YTUOkO7V" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4891ca4ce02so1175e9.1 for ; Wed, 20 May 2026 11:21:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1779301296; x=1779906096; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=FAP//RTu4wWK2TYm2jPxc4p52Y956hm9dxGKavgaEzo=; b=YTUOkO7VfxWlIBODGx6l5jICSLYJRnzv1Wd01FLtMmFSzC9LSUArpJCa3IAeTK7bfJ rE+KEXVzTK9fgB3N0CgmGi+6YrakQIkPD68rd8q8Dp0I2P1nEaT1ZsbR/PM/Ubv4rhhT 1r0XMbNyqGGgRKWkA8HEttieyfhLfc7qeCHX28t5XyrSJH0LaanR90sS6g2jb1hixd/z g/2Bg9iba+e8tGm9THY6OZHMXLuSN/qi1AdJ/JN2aXJ/HXUKOV8fJpR5sNcUNqM7qTxJ OXakNXNC2j1wsA7F/hcdHD5iUpakWY60x61zlkuPOEmMiWfyHXezNWlgyA0K6rGmxwMB XNUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779301296; x=1779906096; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=FAP//RTu4wWK2TYm2jPxc4p52Y956hm9dxGKavgaEzo=; b=r3CsYS7YcZRmtXXZaCj8z76eh/Mmb70afwurQ9WHepntdzPfcyrWarD+Pr2hJzWd0R cCvpiHz6CnO0PPIoBxy10Fs4OeGwjB9h7n9YsUqkhjsEH1ipqs2u1hdklylsosbVwuUb NNrr2pkYGxhGbmMByR/6A2QpDPHhKHpNZU4Gy3fj2TNqHqPknzJ4yg3UH0vyPtf6S1yl QAKoTd3hLhxMjx4N8JZoTGwPsfrb5WUJjf/xzMr+EfX5y6xyVxH/dkgRAWh1mEDMgA42 HpPb08ubWqYJ2wh5T0IsxU/6gY3I5970TLih7UOepSicr5RVihfgMpot9+YNtGzOTU2L MxVA== X-Gm-Message-State: AOJu0YzbDu5P/B76LRDPt4IQqAEaKZTjDxHEjavjAx8lP2UJBOmPkFJp yjGzdmDnJ6nZqRo3PzRt4ieZF+910t09rYz3HbfVqthYKHoX02tDxWT1HXdzU5GQ+w== X-Gm-Gg: Acq92OEoDjY0NY6aHW1OjLrM5OBkuFs7k9QZ5AEVlwt0CNCAw1WAWtmX01etMilaAjT tfmb9hpbOoObDMZHXIQXqIjCZVY2uI5Mhl08GzQM3bTizxBinX/9zRXZHUBAPWmSlIQ4sOoUVFF EVlkiAAcOaJ0UNSZdrp+P9qeUYCt3ZBjECs4ieMbyjH4PMOLFhF1nloO4K4Dc1p80H0Mn/YFzMp qu2V+/vOJplThU/T5kYp9aBk04aRUd30WsRXrCY5ef+XQIPR+BBU2nQgP6V7THzTkmuir4ixEYn opHxlJFd1J9zhom6Y/uAQorC21I6Sr/l0JBKGU0nHQcBOTWwRlz3KQnb9EA1cr0XXpzI4VcJ9kB kIbPjpA2ziPYhdjuVBaty+xCwgOCasMlvFFHGaEu4aWpP8WyEUNArIawxdVVyEP+VrYqP2D8TcQ DC9LYb3XLq9MLa3x7p8DlNEQM1D5yIeP3rou/Xg9d7DlkYhks1b7TPoS1mNDDJLg== X-Received: by 2002:a7b:ca46:0:b0:48a:55dc:9c1e with SMTP id 5b1f17b1804b1-49034149d09mr99385e9.10.1779301295555; Wed, 20 May 2026 11:21:35 -0700 (PDT) Received: from localhost ([2a00:79e0:288a:8:c24a:a441:f2c5:6e67]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48febf8305dsm202543065e9.9.2026.05.20.11.21.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2026 11:21:35 -0700 (PDT) From: Jann Horn Date: Wed, 20 May 2026 20:21:29 +0200 Subject: [PATCH v2] kcov: update documentation on remote coverage collection 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: quoted-printable Message-Id: <20260520-kcov-docs-v2-1-819f78778763@google.com> X-B4-Tracking: v=1; b=H4sIAKj7DWoC/23MQQrCMBCF4auUWTuSCUbQlfeQLpJ0kga1I4kEp eTuxq5d/o/Ht0LhnLjAeVghc00lydJD7wbws10iY5p6g1b6qAyd8Oal4iS+IJnA1gVHylro/2f mkN6bdR17z6m8JH82utJv/adUQkLjnNbh4J1W/hJF4p33Xh4wtta+ApkKVqMAAAA= X-Change-ID: 20260519-kcov-docs-15feabfb10aa To: Alexander Potapenko , Dmitry Vyukov , Andrey Konovalov , kasan-dev@googlegroups.com, Andrew Morton Cc: linux-kernel@vger.kernel.org, Jann Horn X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1779301291; l=2130; i=jannh@google.com; s=20240730; h=from:subject:message-id; bh=x636ut0RZ5wYnt7aSj18rAtb/0svsgw9sQkTLVXWxcQ=; b=aWWitejxk6PDjMuhpScJKxr4R6SLisvCsLjj/+pIdDiHoGJpf1gtT4Ul+yqVpCQsg3WoC8zAH 6NojETn5r2RAUAo5qstZLyGDmi5xIudbEFOd/CmrZi7kAMO5PPmFApT X-Developer-Key: i=jannh@google.com; a=ed25519; pk=AljNtGOzXeF6khBXDJVVvwSEkVDGnnZZYqfWhP1V+C8= Adjust the docs on remote coverage collection to reflect the changes made in "kcov: refactor common handle ID into kcov_common_handle_id" and "kcov: allow simultaneous KCOV_ENABLE/KCOV_REMOTE_ENABLE". Suggested-by: Alexander Potapenko Signed-off-by: Jann Horn Reviewed-by: Dmitry Vyukov --- Changes in v2: - move and reword sentence on simultaneous normal/remote collection (andrey= knvl) - Link to v1: https://lore.kernel.org/r/20260519-kcov-docs-v1-1-5bb22f4cb20= c@google.com --- Documentation/dev-tools/kcov.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/dev-tools/kcov.rst b/Documentation/dev-tools/kco= v.rst index 8127849d40f5..1a739290c8ec 100644 --- a/Documentation/dev-tools/kcov.rst +++ b/Documentation/dev-tools/kcov.rst @@ -237,6 +237,9 @@ Both ``kcov_remote_start`` and ``kcov_remote_stop`` ann= otations and the collection sections. The way a handle is used depends on the context where= the matching code section executes. =20 +A thread can use two separate KCOV instances to collect remote coverage and +normal coverage at the same time. + KCOV supports collecting remote coverage from the following contexts: =20 1. Global kernel background tasks. These are the tasks that are spawned du= ring @@ -262,6 +265,9 @@ gets saved to the ``kcov_handle`` field in the current = ``task_struct`` and needs to be passed to the newly spawned local tasks via custom kernel code modifications. Those tasks should in turn use the passed handle in their ``kcov_remote_start`` and ``kcov_remote_stop`` annotations. +In the kernel, common handles are wrapped in a ``kcov_common_handle_id``, = which +consumes no space in builds without ``CONFIG_KCOV``; subsystems that integ= rate +with this mechanism should not need to use any ``#ifdef CONFIG_KCOV`` or s= uch. =20 KCOV follows a predefined format for both global and common handles. Each handle is a ``u64`` integer. Currently, only the one top and the lower 4 b= ytes --- base-commit: ab5fce87a778cb780a05984a2ca448f2b41aafbf change-id: 20260519-kcov-docs-15feabfb10aa -- =20 Jann Horn