Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp664584rdg; Wed, 11 Oct 2023 01:48:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEbGtLuw54EWespbqeJwhNs8/5T3GqRLAoqJvvHv7yhJI4sg6YtgmXqxuxP0MLJ17DTbEZf X-Received: by 2002:a05:6a00:3981:b0:68f:c078:b0c9 with SMTP id fi1-20020a056a00398100b0068fc078b0c9mr27396421pfb.11.1697014125011; Wed, 11 Oct 2023 01:48:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697014124; cv=none; d=google.com; s=arc-20160816; b=MFeQzy/IEt63YCTf+mHepfh6Ox358q6B8tAmQPnCBgKiuLuIuIc2mLK2eJCwlKnB5a VdQasDpoPXMWnbakfT+ELjsFoX2zaxSEdQryovbKDsyPD4M8Xr/DhEPVSuGsWUEMT0vL bRsSnymUmiuabF0y6Uiu+ssdhYu81qavytlsowzz/kNVj/Ok5htfIk4Kz9FQaMWrQbgJ uhMDhqxihi6FI1yL0RH+7DiaeP7QZQlLJDaBFbjMmSvM5grGSvzwlwO6i337T94xsxZs yxZEmqOQKHSEULWKRvJ0qIqgzI8EZIB9UNgdfcP/uhoRVwBP+Ryx74uW0OLIk/x4AD3W ZMKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=6fZvy+rm9WgWz+lQE0FUmkJyOUMU3uv40D8dD89laLU=; fh=dwh3ivYHbb8gQpB2oubCHFirxZFyCmA/PWHnMMqM4Pg=; b=GGRmyZ2KqJtiAWfj8xULKyDwoffiIfPXSLmPg1Q162M9jwhiL9STORGhe1mBTaGMKJ eX2/vfT0VpxOtWH3LvKDvVVaAptjeKPAf7Hoias0eWeq6t8U37mp3uJ9D92Nk6t6QaZl LCEd6fJzrI1ZUelgZXVuTYiHSJdErW6ectQ81vie1/XMi1S/6ybUCT2SUFAJPcVfTl11 /3WVyG0SwlrrAV4Y5LR1bFk/k3fbed1Az4XUEY5f3veBJgIBpRR1wawhE5wEfjoA8S3j /MrKhbK5Mjlwze1bq8SU5XUygbYw4BgqaeeJoAeAYbGIbPnIHcDr0qa5Ldp16Dt9tE/E n4BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UV4omf0D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id fh26-20020a056a00391a00b0068e2b901138si11888107pfb.158.2023.10.11.01.48.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 01:48:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UV4omf0D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 70F808066639; Wed, 11 Oct 2023 01:48:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345033AbjJKIsd (ORCPT + 99 others); Wed, 11 Oct 2023 04:48:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230190AbjJKIsc (ORCPT ); Wed, 11 Oct 2023 04:48:32 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A73194 for ; Wed, 11 Oct 2023 01:48:30 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-505748580ceso8304297e87.3 for ; Wed, 11 Oct 2023 01:48:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697014108; x=1697618908; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=6fZvy+rm9WgWz+lQE0FUmkJyOUMU3uv40D8dD89laLU=; b=UV4omf0DXIqonF2vvbnygjz1i9S4ga5PjRDFFceESh+6NwPuF3uTGoOplqt5UgQx3e W0csYiDWDajm53Z7b+FTc0C/SKi9felIs5HUCuUsepTYzEyCteZOJmsuR+PqRvPLDLBB yzeY7mngOUkXwTqX+e91nIIR7UP1/YSWoeZUSeyIsgrpAkTJIx/2/y9AnoLYgHv+R2UX vkAkgC6BlU98aZef9wi1AlFr1IbCEshINbOnqzcKeAKNBd+oDEiIcO6Uf+vRyXCzPLGe MFrUl57lrtYAr2OG1PPCGJcktv0FAEG0n7COT1CKw8G2HZ+lZ1RfyZo/HohQBMJlzhcu kImw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697014108; x=1697618908; h=mime-version:references:in-reply-to:message-id:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6fZvy+rm9WgWz+lQE0FUmkJyOUMU3uv40D8dD89laLU=; b=IRUa0+VauvSfXK/ZDYmKrECdBWoGbGWAZ5o+N0FW+eE1WcxvjN1hJDsqPLeKramebu vAoNDJ64luWahc1f4/+iVYiZbGl4S3KyKYSvibR0jrZ8hXtyZCUvbQli82yTT12C7BBP zNjIhNmXQ0V4XBezqVfRnLs/HsrmlF/02pBlcuW7sajlTLGKZqG1s6eN5+o0KUsKxmI1 q8Fxl9ASgzeJMs/j15Xm5kbc2IJQ64hLhRlzH1z1XwPal5sACwNROJdLEEfuxDcU5Flt RRmXib2vugL9a5+fF2mkECo+YUntdMABRYGLcelZCIqc8WLiI/abpxJjsfTndJFmSHNm 616Q== X-Gm-Message-State: AOJu0YwU+u0g0AcTE1WuFJnns3uom2kAe8Jq92dzeS/rIYv++2HXnhve j7HPbKo9TdOP1zjjM8nJOD8= X-Received: by 2002:a05:6512:794:b0:502:cc8d:f1fc with SMTP id x20-20020a056512079400b00502cc8df1fcmr15517150lfr.37.1697014108114; Wed, 11 Oct 2023 01:48:28 -0700 (PDT) Received: from eldfell ([194.136.85.206]) by smtp.gmail.com with ESMTPSA id h26-20020ac2597a000000b00502df04c0basm2180080lfp.183.2023.10.11.01.48.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 01:48:27 -0700 (PDT) Date: Wed, 11 Oct 2023 11:48:16 +0300 From: Pekka Paalanen To: jim.cromie@gmail.com Cc: Sean Paul , Simon Ser , lyude@redhat.com, linux-kernel@vger.kernel.org, =?UTF-8?B?xYF1a2Fzeg==?= Bartosik , Steven Rostedt , dri-devel , "wayland-devel@lists.freedesktop.org" Subject: Re: [PATCH v1] dynamic_debug: add support for logs destination Message-ID: <20231011114816.19d79f43@eldfell> In-Reply-To: References: <20230915154856.1896062-1-lb@semihalf.com> <20231003155810.6df9de16@gandalf.local.home> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.37; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/sFNdrTfSJHhZs5qlySTOtr="; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Spam-Status: No, score=3.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SBL_CSS, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 11 Oct 2023 01:48:42 -0700 (PDT) X-Spam-Level: ** --Sig_/sFNdrTfSJHhZs5qlySTOtr= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, 10 Oct 2023 10:06:02 -0600 jim.cromie@gmail.com wrote: > since I name-dropped you all, Hi everyone, I'm really happy to see this topic being developed! I've practically forgot about it myself, but the need for it has not diminished at all. I didn't understand much of the conversation, so I'll just reiterate what I would use it for, as a Wayland compositor developer. I added a few more cc's to get better coverage of DRM and Wayland compositor developers. > On Tue, Oct 10, 2023 at 10:01=E2=80=AFAM wrote: > > > > On Mon, Oct 9, 2023 at 4:47=E2=80=AFPM =C5=81ukasz Bartosik wrote: =20 ... > > > I don't have a real life use case to configure different trace > > > instance for each callsite. > > > I just tried to be as much flexible as possible. > > > =20 > > > > Ive come around to agree - I looked back at some old threads > > (that I was a part of, and barely remembered :-} > > > > At least Sean Paul, Lyude, Simon Ser, Pekka Paalanen > > have expressed a desire for a "flight-recorder" > > it'd be hard to say now that 2-3 such buffers would always be enough, > > esp as theres a performance reason for having your own. A Wayland compositor has roughly three important things where the kernel debugs might come in handy: - input - DRM KMS - DRM GPU rendering DRM KMS is the one I've been thinking of in the flight recorder context the most, because KMS hardware varies a lot, and there is plenty of room for both KMS drivers and KMS userspace to go wrong. The usual result is your display doesn't work, so the system is practically unusable to the end user. In the wild, the simplest or maybe the only way out of that may be a reboot, maybe an automated one (e.g. digital signage). In order to debug such problems, we would need both compositor logs and the relevant kernel debug messages. For example, Weston already has a flight recorder framework of its own, so we have the compositor debug logs. It would be useful to get the selected kernel debug logs in the same place. It could be used for automated or semi-manual bug reporting, for example, making the administrator or end user life much easier reporting issues. Since this is usually a production environment, and the Wayland compositor runs without root privileges, we need something that works with that. We would likely want the kernel debug messages in the compositor to combine and order them properly with the compositor debug messages. It's quite likely that developers would like to pick and choose which kernel debug messages might be interesting enough to record, to avoid excessive log flooding. The flight recorder in Weston is fixed size to avoid running out of memory or disk space. I can also see that Weston could have debugging options that affect which kernel debug messages it subscribes to. We can have a reasonable default setup that allows us to pinpoint the problem area and figure out most problems, and if needed, we could ask the administrator pass another debug option to Weston. It helps if there is just one place to configure everything about the compositor. This implies that it would be really nice to have userspace subscriber specific debug message streams from the kernel, or a good way to filter the messages we want. A Wayland compositor would not be interested in file system or wireless debugs for example, but another system component might be. There is also a security aspect of which component is allowed to see which messages in case they could contain anything sensitive (input debug could contain typed passwords). Configuring the kernel debug message selection for our debug message stream can and probably should require elevated privileges, and we can likely solve that in userspace with a daemon or such, to allow the Wayland compositor to run as a regular user. Thinking of desktop systems, and especially physically multi-seat systems: - there can be multiple different Wayland compositors running simultaneously - each of them may want debug messages only from a specific DRM KMS device instance, and not from others - each of them may have a different idea of which debug messages are import= ant - because DRM KMS leasing is a thing, different compositor instances could be using the same DRM KMS device instance simultaneously; since this is specific to DRM KMS, and it should be harmless to get a little too much DRM KMS debug (that is, from the whole device instead of just the leased parts), it may not be worth to consider splitting debug message streams this far. If userspace is offered some standardised fields in kernel debug structures, then userspace could do some filtering on its own too, but I guess it would be better to filter at the source and not need that. There is also an anti-goal. The kernel debug message contents are specifically not machine-parsable. I very much do not want to impose debug strings as ABI, they are for human (and AI?) readers only. As a summary, here are the most important requirements first: - usable in production as a normal thing to enable always by default - final delivery to unprivileged userspace process - per debug-print selection of messages (finer or coarser, categories within a kernel sub-system could be enough) - per originating device (driver instance) selection of messages - all selections tailored separately for each userspace subscriber (- per open device file description selection of messages) That's my idea of it. It is interesting to see how far the requirements can be reasonably realised. Thanks, pq --Sig_/sFNdrTfSJHhZs5qlySTOtr= Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEJQjwWQChkWOYOIONI1/ltBGqqqcFAmUmYVAACgkQI1/ltBGq qqcyqhAApBL3WJoBlku10S+0QQhW2qQ9N3fDnNYQ2QQMkmITou8otpAjqrqga0eh RvzjhyXF8gehi6bbPPtsksJGWrimBqf5fS2loGEtpX/g7uXAs/9q28ddYEcelAJw HLqOpj/+qI+cUzywt2FBRkdlsfSti/rEESkTYlLPIhwD9Bf7XZyulhrgc2iCL5AA exeD/bQ/D3aiBft8q1dDNv36YeEAJuQsaGsFKu72kJlRXb1zvKVLiD1aZ+M1rDJz 04018vbjXqNeTXpKMsR97KFl4GCOyBeaso2UgTB0yclSEZzwIu2xdgV7IjC/3mmA wdMTeowTe7/MKqM5EeF3VnMrA96daciVrbkhY1HnNau60cGH+Z+dSxAfB9X+08WS /vJ4pLvd1LL35QXJkq0uIr0fPqkTb3RjeCYR1fXu/Ro8dOyWrUGxzKokVUz0SgMm gYNQJ1BJ5+IpSyhr9f0tMtZo4/mBurYRt0ZNuLi/A3LIXx+6Lj1ZqgGVzkRGnSIG njh1pt4OswGmDgvPVeHek+1Tkg9JWX+FS5WKPiISbUHZXjpvN0+qUY5llx9Gd1L1 X0H/QGAuFUCg+NQNeSx3RId8rnvnTHUK/xwqGcRlCydm38CrFig3PIV1kjdGwyRa RDavZMp8tvI2Qi7CM9jIa0v/yls+6+tZUJjuuaFuNx/jUvlu15Y= =hP0+ -----END PGP SIGNATURE----- --Sig_/sFNdrTfSJHhZs5qlySTOtr=--