From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D2CBC433F5 for ; Mon, 3 Oct 2022 07:28:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231256AbiJCH2P (ORCPT ); Mon, 3 Oct 2022 03:28:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231167AbiJCH1T (ORCPT ); Mon, 3 Oct 2022 03:27:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A8B843618; Mon, 3 Oct 2022 00:19:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5C94CB80E89; Mon, 3 Oct 2022 07:16:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA046C43148; Mon, 3 Oct 2022 07:16:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781408; bh=r9SMDNYMlc+TY4sI5YWGS0MJ2SeqlzjB8zbPnpwEWPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tYxFM0nGOKW38lnV0uzovxXsdCCtLwMiyD/L7mLn16GopMdcA2WzWOkBBD5N7syGG sp4ER4frzJ7hSR4/OR+gwzBeSYZOv0v7D6ZipLYl6iawRWvtqpemvOZ/aoPfX6TR6E PndQClD+Sz7bJnE553N6j/nKRUxXWf6E2g4w3iGo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai , Sasha Levin Subject: [PATCH 5.15 01/83] ALSA: hda: Do disconnect jacks at codec unbind Date: Mon, 3 Oct 2022 09:10:26 +0200 Message-Id: <20221003070722.010820864@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Takashi Iwai [ Upstream commit 37c4fd0db7c961145d9d1909ecab386fdf703c26 ] The HD-audio codec driver remove may happen also at dynamically unbinding during operation, hence it needs manual triggers of snd_device_disconnect() calls, while it's missing for the jack objects that are associated with the codec. This patch adds the manual disconnection call for jacks when the remove happens without card->shutdown (i.e. not under the full removal). Link: https://lore.kernel.org/r/20211117133040.20272-1-tiwai@suse.de Signed-off-by: Takashi Iwai Stable-dep-of: ead3d3c5b54f ("ALSA: hda: Fix hang at HD-audio codec unbindi= ng due to refcount saturation") Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- sound/pci/hda/hda_bind.c | 2 ++ sound/pci/hda/hda_jack.c | 11 +++++++++++ sound/pci/hda/hda_jack.h | 1 + 3 files changed, 14 insertions(+) diff --git a/sound/pci/hda/hda_bind.c b/sound/pci/hda/hda_bind.c index 7153bd53e189..c572fb5886d5 100644 --- a/sound/pci/hda/hda_bind.c +++ b/sound/pci/hda/hda_bind.c @@ -14,6 +14,7 @@ #include #include #include "hda_local.h" +#include "hda_jack.h" =20 /* * find a matching codec id @@ -158,6 +159,7 @@ static int hda_codec_driver_remove(struct device *dev) =20 refcount_dec(&codec->pcm_ref); snd_hda_codec_disconnect_pcms(codec); + snd_hda_jack_tbl_disconnect(codec); wait_event(codec->remove_sleep, !refcount_read(&codec->pcm_ref)); snd_power_sync_ref(codec->bus->card); =20 diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c index f29975e3e98d..7d7786df60ea 100644 --- a/sound/pci/hda/hda_jack.c +++ b/sound/pci/hda/hda_jack.c @@ -158,6 +158,17 @@ snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_= t nid, int dev_id) return jack; } =20 +void snd_hda_jack_tbl_disconnect(struct hda_codec *codec) +{ + struct hda_jack_tbl *jack =3D codec->jacktbl.list; + int i; + + for (i =3D 0; i < codec->jacktbl.used; i++, jack++) { + if (!codec->bus->shutdown && jack->jack) + snd_device_disconnect(codec->card, jack->jack); + } +} + void snd_hda_jack_tbl_clear(struct hda_codec *codec) { struct hda_jack_tbl *jack =3D codec->jacktbl.list; diff --git a/sound/pci/hda/hda_jack.h b/sound/pci/hda/hda_jack.h index 2abf7aac243a..ff7d289c034b 100644 --- a/sound/pci/hda/hda_jack.h +++ b/sound/pci/hda/hda_jack.h @@ -69,6 +69,7 @@ struct hda_jack_tbl * snd_hda_jack_tbl_get_from_tag(struct hda_codec *codec, unsigned char tag, int dev_id); =20 +void snd_hda_jack_tbl_disconnect(struct hda_codec *codec); void snd_hda_jack_tbl_clear(struct hda_codec *codec); =20 void snd_hda_jack_set_dirty_all(struct hda_codec *codec); --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86A98C433FE for ; Mon, 3 Oct 2022 07:25:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230428AbiJCHZF (ORCPT ); Mon, 3 Oct 2022 03:25:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230171AbiJCHXc (ORCPT ); Mon, 3 Oct 2022 03:23:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CD5B3ED51; Mon, 3 Oct 2022 00:17:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 808F0B80E7F; Mon, 3 Oct 2022 07:17:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F059DC43147; Mon, 3 Oct 2022 07:17:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781437; bh=0oBSQwek0f/Ils927xvIAnBi6N7atps5OofrV7L2/jw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XgGLsTzwzkNusdtSDgRxE2hji7ell4/b3efIzTQNKtIbLSVjkn2owgoT4lvsvDt2/ EHmTnux4jVaZHizT6trXtvDOUvdj/qmfllIzy2TXKMdXPQGbGR66iZrnGKAdYAvzE1 PBWbxQdefemok6WQAxnSSBLmxqnRWTn+h6AwtnYo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Takashi Iwai , Sasha Levin Subject: [PATCH 5.15 02/83] ALSA: hda: Fix hang at HD-audio codec unbinding due to refcount saturation Date: Mon, 3 Oct 2022 09:10:27 +0200 Message-Id: <20221003070722.038362006@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takashi Iwai [ Upstream commit ead3d3c5b54f76da79c079e61bacb4279ec56965 ] We fixed the potential deadlock at dynamic unbinding the HD-audio codec at the commit 7206998f578d ("ALSA: hda: Fix potential deadlock at codec unbinding"), but ironically, this caused another potential deadlock. The current code uses refcount_dec() and waits for the pending task with wait_event for dropping the refcount to 0. This works fine when PCMs are assigned and actually waiting for the refcount drop. Meanwhile, when there was no PCM assigned, the refcount_dec() call itself was supposed to drop to zero -- alas, it doesn't in reality; refcount_dec() complains, spews kernel warning and it saturates instead of dropping to 0, due to the nature of refcount_dec() implementation. This eventually blocks the wait_event() wakeup and the code get stuck there. For avoiding the problem, we call refcount_dec_and_test() and skips the sync-wait if it already reaches to zero. The patch does a slight code reshuffling to make sure to invoke other disconnect calls before the sync-wait, too. Fixes: 7206998f578d ("ALSA: hda: Fix potential deadlock at codec unbinding") Reported-by: Ville Syrj=C3=A4l=C3=A4 Tested-by: Ville Syrj=C3=A4l=C3=A4 Cc: Link: https://lore.kernel.org/r/YxtflWQnslMHVlU7@intel.com Link: https://lore.kernel.org/r/20220910142550.28494-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- sound/pci/hda/hda_bind.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/pci/hda/hda_bind.c b/sound/pci/hda/hda_bind.c index c572fb5886d5..7af251573595 100644 --- a/sound/pci/hda/hda_bind.c +++ b/sound/pci/hda/hda_bind.c @@ -157,10 +157,10 @@ static int hda_codec_driver_remove(struct device *dev) return codec->bus->core.ext_ops->hdev_detach(&codec->core); } =20 - refcount_dec(&codec->pcm_ref); snd_hda_codec_disconnect_pcms(codec); snd_hda_jack_tbl_disconnect(codec); - wait_event(codec->remove_sleep, !refcount_read(&codec->pcm_ref)); + if (!refcount_dec_and_test(&codec->pcm_ref)) + wait_event(codec->remove_sleep, !refcount_read(&codec->pcm_ref)); snd_power_sync_ref(codec->bus->card); =20 if (codec->patch_ops.free) --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAF6FC433FE for ; Mon, 3 Oct 2022 07:25:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230439AbiJCHZJ (ORCPT ); Mon, 3 Oct 2022 03:25:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230449AbiJCHXj (ORCPT ); Mon, 3 Oct 2022 03:23:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DBBE43324; Mon, 3 Oct 2022 00:17:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 82BBD60FA2; Mon, 3 Oct 2022 07:17:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94900C433C1; Mon, 3 Oct 2022 07:17:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781458; bh=htqVCF0HyYsDh3mu3tSMuDRWcNQhdX16wkn6ddp+3kk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=szKz28dECdQ3vbWtaCzPg0wuy30+9+mVrFje11EYyZUwT+jVSTkezDhwcZpQwKRVu /8EDo3BfWD1NVE3o/MYN0NPVCLrdNaXTYc7w+MuqudA0xezP0jtdIh8QuzZioGPcBU qGHLq1kUmHr8QcQlop1xmo2l3xMZvtthJeqcKicM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mohan Kumar , Takashi Iwai , Sasha Levin Subject: [PATCH 5.15 03/83] ALSA: hda: Fix Nvidia dp infoframe Date: Mon, 3 Oct 2022 09:10:28 +0200 Message-Id: <20221003070722.064064094@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mohan Kumar [ Upstream commit f89e409402e2aeb3bc3aa44d2b7a597959e4e6af ] Nvidia HDA HW expects infoframe data bytes order same for both HDMI and DP i.e infoframe data starts from 5th bytes offset. As dp infoframe structure has 4th byte as valid infoframe data, use hdmi infoframe structure for nvidia dp infoframe to match HW behvaior. Signed-off-by: Mohan Kumar Cc: Link: https://lore.kernel.org/r/20220913065818.13015-1-mkumard@nvidia.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- sound/pci/hda/patch_hdmi.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index d19bc2b9f778..d3da42e0e7b3 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -162,6 +162,8 @@ struct hdmi_spec { bool dyn_pin_out; bool dyn_pcm_assign; bool dyn_pcm_no_legacy; + bool nv_dp_workaround; /* workaround DP audio infoframe for Nvidia */ + bool intel_hsw_fixup; /* apply Intel platform-specific fixups */ /* * Non-generic VIA/NVIDIA specific @@ -671,15 +673,24 @@ static void hdmi_pin_setup_infoframe(struct hda_codec= *codec, int ca, int active_channels, int conn_type) { + struct hdmi_spec *spec =3D codec->spec; union audio_infoframe ai; =20 memset(&ai, 0, sizeof(ai)); - if (conn_type =3D=3D 0) { /* HDMI */ + if ((conn_type =3D=3D 0) || /* HDMI */ + /* Nvidia DisplayPort: Nvidia HW expects same layout as HDMI */ + (conn_type =3D=3D 1 && spec->nv_dp_workaround)) { struct hdmi_audio_infoframe *hdmi_ai =3D &ai.hdmi; =20 - hdmi_ai->type =3D 0x84; - hdmi_ai->ver =3D 0x01; - hdmi_ai->len =3D 0x0a; + if (conn_type =3D=3D 0) { /* HDMI */ + hdmi_ai->type =3D 0x84; + hdmi_ai->ver =3D 0x01; + hdmi_ai->len =3D 0x0a; + } else {/* Nvidia DP */ + hdmi_ai->type =3D 0x84; + hdmi_ai->ver =3D 0x1b; + hdmi_ai->len =3D 0x11 << 2; + } hdmi_ai->CC02_CT47 =3D active_channels - 1; hdmi_ai->CA =3D ca; hdmi_checksum_audio_infoframe(hdmi_ai); @@ -3539,6 +3550,7 @@ static int patch_nvhdmi_2ch(struct hda_codec *codec) spec->pcm_playback.rates =3D SUPPORTED_RATES; spec->pcm_playback.maxbps =3D SUPPORTED_MAXBPS; spec->pcm_playback.formats =3D SUPPORTED_FORMATS; + spec->nv_dp_workaround =3D true; return 0; } =20 @@ -3678,6 +3690,7 @@ static int patch_nvhdmi(struct hda_codec *codec) spec->chmap.ops.chmap_cea_alloc_validate_get_type =3D nvhdmi_chmap_cea_alloc_validate_get_type; spec->chmap.ops.chmap_validate =3D nvhdmi_chmap_validate; + spec->nv_dp_workaround =3D true; =20 codec->link_down_at_suspend =3D 1; =20 @@ -3701,6 +3714,7 @@ static int patch_nvhdmi_legacy(struct hda_codec *code= c) spec->chmap.ops.chmap_cea_alloc_validate_get_type =3D nvhdmi_chmap_cea_alloc_validate_get_type; spec->chmap.ops.chmap_validate =3D nvhdmi_chmap_validate; + spec->nv_dp_workaround =3D true; =20 codec->link_down_at_suspend =3D 1; =20 @@ -3874,6 +3888,7 @@ static int patch_tegra_hdmi(struct hda_codec *codec) spec->chmap.ops.chmap_cea_alloc_validate_get_type =3D nvhdmi_chmap_cea_alloc_validate_get_type; spec->chmap.ops.chmap_validate =3D nvhdmi_chmap_validate; + spec->nv_dp_workaround =3D true; =20 return 0; } --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 511FEC433FE for ; Mon, 3 Oct 2022 07:25:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230483AbiJCHZY (ORCPT ); Mon, 3 Oct 2022 03:25:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230513AbiJCHXu (ORCPT ); Mon, 3 Oct 2022 03:23:50 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D441342ACF; Mon, 3 Oct 2022 00:17:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D1694B80E81; Mon, 3 Oct 2022 07:17:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40A1FC433D7; Mon, 3 Oct 2022 07:17:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781461; bh=5dWP7lw1Qow/y37RCWa0fod+8ef29E1Bg24Jjgp5cyc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fJRlikeDHG/gGUhNaMVMfhHtQB5ozEXZVMnTkyJETtk7gTtQZkPkRdqPMbeJULMgf rky4YaylMiSkZM2KdQThmIp3hn9MC7S6IwBPoz5/Pqy5Ut2TjOro+t43gG6UbXN0ig F/ovOYnQSXHs5IkwnENJujFQro64AWuDkXWP0PAA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Sergeyev , Takashi Iwai , Sasha Levin Subject: [PATCH 5.15 04/83] ALSA: hda/realtek: fix speakers and micmute on HP 855 G8 Date: Mon, 3 Oct 2022 09:10:29 +0200 Message-Id: <20221003070722.090573944@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Sergeyev [ Upstream commit 91502a9a0b0d5252cf3f32ebd898823c2f5aadab ] There are several PCI ids associated with HP EliteBook 855 G8 Notebook PC. Commit 0e68c4b11f1e6 ("ALSA: hda/realtek: fix mute/micmute LEDs for HP 855 G8") covers 0x103c:0x8896, while this commit covers 0x103c:0x8895 which needs some additional work on top of the quirk from 0e68c4b11f1e6. Note that the device can boot up with working speakers and micmute LED without this patch, but the success rate would be quite low (order of 16 working boots across 709 boots) at least for the built-in drivers scenario. This also means that there are some timing issues during early boot and this patch is a workaround. With this patch applied speakers and headphones are consistenly working, as well as mute/micmute LEDs and the internal microphone. Signed-off-by: Alexander Sergeyev Link: https://lore.kernel.org/r/20220114165050.ouw2nknuspclynro@localhost.l= ocaldomain Signed-off-by: Takashi Iwai Stable-dep-of: 496322302bf1 ("ALSA: hda/realtek: Add a quirk for HP OMEN 16= (8902) mute LED") Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- sound/pci/hda/patch_realtek.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index c4b3f2d3c7e3..f7b6a516439d 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -6939,6 +6939,7 @@ enum { ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME, ALC285_FIXUP_LEGION_Y9000X_SPEAKERS, ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE, + ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED, }; =20 /* A special fixup for Lenovo C940 and Yoga Duet 7; @@ -8753,6 +8754,16 @@ static const struct hda_fixup alc269_fixups[] =3D { .chained =3D true, .chain_id =3D ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC }, + [ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] =3D { + .type =3D HDA_FIXUP_VERBS, + .v.verbs =3D (const struct hda_verb[]) { + { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 }, + { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 }, + { } + }, + .chained =3D true, + .chain_id =3D ALC285_FIXUP_HP_MUTE_LED, + }, }; =20 static const struct snd_pci_quirk alc269_fixup_tbl[] =3D { @@ -8976,6 +8987,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = =3D { SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstat= ion PC", ALC285_FIXUP_HP_GPIO_AMP_INIT), SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workst= ation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT), SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Worksta= tion PC", ALC236_FIXUP_HP_GPIO_LED), + SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_F= IXUP_HP_SPEAKERS_MICMUTE_LED), SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_F= IXUP_HP_MUTE_LED), SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_F= IXUP_HP_LIMIT_INT_MIC_BOOST), SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", A= LC287_FIXUP_HP_GPIO_LED), --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2E91C433FE for ; Mon, 3 Oct 2022 07:30:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231365AbiJCHaP (ORCPT ); Mon, 3 Oct 2022 03:30:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231398AbiJCH3D (ORCPT ); Mon, 3 Oct 2022 03:29:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E30C6CC4; Mon, 3 Oct 2022 00:19:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C402860F9E; Mon, 3 Oct 2022 07:17:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D997BC433C1; Mon, 3 Oct 2022 07:17:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781464; bh=7jf8lxbFWIJq9EwMInVoh7BkFcPx5cCsy/iCviXCE0s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iXz6tf2p2/qmRY400k9f6fmbsCwG8c+Rv/M7DWXd8Qm6eRCTnYD7rdLArosClJyuG lGWBXXUpG5TnRe1d2q0dYJfXyG3gwHjy4kQWc8kaKRllwZCKqj8v6nAGSxmOhHdqBa MA3hN0J7ONTILYoDQkhM8Vxj6efsU1/mhHhYXxFQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shakeel Butt , Tejun Heo , Sasha Levin Subject: [PATCH 5.15 05/83] cgroup: reduce dependency on cgroup_mutex Date: Mon, 3 Oct 2022 09:10:30 +0200 Message-Id: <20221003070722.118445218@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shakeel Butt [ Upstream commit be288169712f3dea0bc6b50c00b3ab53d85f1435 ] Currently cgroup_get_from_path() and cgroup_get_from_id() grab cgroup_mutex before traversing the default hierarchy to find the kernfs_node corresponding to the path/id and then extract the linked cgroup. Since cgroup_mutex is still held, it is guaranteed that the cgroup will be alive and the reference can be taken on it. However similar guarantee can be provided without depending on the cgroup_mutex and potentially reducing avenues of cgroup_mutex contentions. The kernfs_node's priv pointer is RCU protected pointer and with just rcu read lock we can grab the reference on the cgroup without cgroup_mutex. So, remove cgroup_mutex from them. Signed-off-by: Shakeel Butt Signed-off-by: Tejun Heo Stable-dep-of: df02452f3df0 ("cgroup: cgroup_get_from_id() must check the l= ooked-up kn is a directory") Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- kernel/cgroup/cgroup.c | 51 ++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 75c3881af078..97282d6b5d18 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -6021,17 +6021,20 @@ struct cgroup *cgroup_get_from_id(u64 id) struct kernfs_node *kn; struct cgroup *cgrp =3D NULL; =20 - mutex_lock(&cgroup_mutex); kn =3D kernfs_find_and_get_node_by_id(cgrp_dfl_root.kf_root, id); if (!kn) - goto out_unlock; + goto out; + + rcu_read_lock(); =20 - cgrp =3D kn->priv; - if (cgroup_is_dead(cgrp) || !cgroup_tryget(cgrp)) + cgrp =3D rcu_dereference(*(void __rcu __force **)&kn->priv); + if (cgrp && !cgroup_tryget(cgrp)) cgrp =3D NULL; + + rcu_read_unlock(); + kernfs_put(kn); -out_unlock: - mutex_unlock(&cgroup_mutex); +out: return cgrp; } EXPORT_SYMBOL_GPL(cgroup_get_from_id); @@ -6585,30 +6588,34 @@ struct cgroup_subsys_state *css_from_id(int id, str= uct cgroup_subsys *ss) * * Find the cgroup at @path on the default hierarchy, increment its * reference count and return it. Returns pointer to the found cgroup on - * success, ERR_PTR(-ENOENT) if @path doesn't exist and ERR_PTR(-ENOTDIR) - * if @path points to a non-directory. + * success, ERR_PTR(-ENOENT) if @path doesn't exist or if the cgroup has a= lready + * been released and ERR_PTR(-ENOTDIR) if @path points to a non-directory. */ struct cgroup *cgroup_get_from_path(const char *path) { struct kernfs_node *kn; - struct cgroup *cgrp; - - mutex_lock(&cgroup_mutex); + struct cgroup *cgrp =3D ERR_PTR(-ENOENT); =20 kn =3D kernfs_walk_and_get(cgrp_dfl_root.cgrp.kn, path); - if (kn) { - if (kernfs_type(kn) =3D=3D KERNFS_DIR) { - cgrp =3D kn->priv; - cgroup_get_live(cgrp); - } else { - cgrp =3D ERR_PTR(-ENOTDIR); - } - kernfs_put(kn); - } else { - cgrp =3D ERR_PTR(-ENOENT); + if (!kn) + goto out; + + if (kernfs_type(kn) !=3D KERNFS_DIR) { + cgrp =3D ERR_PTR(-ENOTDIR); + goto out_kernfs; } =20 - mutex_unlock(&cgroup_mutex); + rcu_read_lock(); + + cgrp =3D rcu_dereference(*(void __rcu __force **)&kn->priv); + if (!cgrp || !cgroup_tryget(cgrp)) + cgrp =3D ERR_PTR(-ENOENT); + + rcu_read_unlock(); + +out_kernfs: + kernfs_put(kn); +out: return cgrp; } EXPORT_SYMBOL_GPL(cgroup_get_from_path); --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23280C4332F for ; Mon, 3 Oct 2022 07:29:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231223AbiJCH3g (ORCPT ); Mon, 3 Oct 2022 03:29:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231172AbiJCH2J (ORCPT ); Mon, 3 Oct 2022 03:28:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDCB6C6B; Mon, 3 Oct 2022 00:19:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8275860FA2; Mon, 3 Oct 2022 07:17:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95C15C433D7; Mon, 3 Oct 2022 07:17:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781467; bh=vS+9SYW7kd6xHNsujI0Rd9vRK7JVdZ14PAQh+RhulaA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iQ070zOKIM4feWa8DR4Y79aszH2PFJaRglkatPwdZ8Sk3ioCryB1AT4KFTF6lqyH0 mukx5OyqURxhA8Hg4aodM6saM11W2qcfFvBUNQO3VDKY0/9Q2EUkeMNrozs0+nUZ51 Y9S5mutjB07gQuikLwkpSjCrB1RIClFDG52Xvoq8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marco Patalano , Muneendra , Ming Lei , Mukesh Ojha , Tejun Heo , Sasha Levin Subject: [PATCH 5.15 06/83] cgroup: cgroup_get_from_id() must check the looked-up kn is a directory Date: Mon, 3 Oct 2022 09:10:31 +0200 Message-Id: <20221003070722.143782710@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Lei [ Upstream commit df02452f3df069a59bc9e69c84435bf115cb6e37 ] cgroup has to be one kernfs dir, otherwise kernel panic is caused, especially cgroup id is provide from userspace. Reported-by: Marco Patalano Fixes: 6b658c4863c1 ("scsi: cgroup: Add cgroup_get_from_id()") Cc: Muneendra Signed-off-by: Ming Lei Acked-by: Mukesh Ojha Cc: stable@vger.kernel.org # v5.14+ Signed-off-by: Tejun Heo Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- kernel/cgroup/cgroup.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 97282d6b5d18..4b19f7fc4deb 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -6025,6 +6025,9 @@ struct cgroup *cgroup_get_from_id(u64 id) if (!kn) goto out; =20 + if (kernfs_type(kn) !=3D KERNFS_DIR) + goto put; + rcu_read_lock(); =20 cgrp =3D rcu_dereference(*(void __rcu __force **)&kn->priv); @@ -6032,7 +6035,7 @@ struct cgroup *cgroup_get_from_id(u64 id) cgrp =3D NULL; =20 rcu_read_unlock(); - +put: kernfs_put(kn); out: return cgrp; --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E111C433FE for ; Mon, 3 Oct 2022 07:28:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230017AbiJCH2a (ORCPT ); Mon, 3 Oct 2022 03:28:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230445AbiJCH1g (ORCPT ); Mon, 3 Oct 2022 03:27:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C15A474DD; Mon, 3 Oct 2022 00:19:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3F40F60FA6; Mon, 3 Oct 2022 07:17:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 510D8C43143; Mon, 3 Oct 2022 07:17:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781469; bh=qA2SnoDnpquwixj7PTXMJPnHgXspquqBBBYQXotvYNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GWIUbxwsz4Dtx6ohHbXCTCzFpiNzyXIRmi9hPNpOHTCa/c0PpZ212P4pIevph7W71 dYv3ZxCaQkjfYbc9UEVa+XjbQLF0Eu0dOdiXNuNo33QtznB8l0GZd84D3QEqlvRddh c/R2lLOqocfxH9twbJ8/HnascmMDNw3jyHEyRIyg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , stable , Hongling Zeng Subject: [PATCH 5.15 07/83] uas: add no-uas quirk for Hiksemi usb_disk Date: Mon, 3 Oct 2022 09:10:32 +0200 Message-Id: <20221003070722.169457714@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hongling Zeng commit a625a4b8806cc1e928b7dd2cca1fee709c9de56e upstream. The UAS mode of Hiksemi is reported to fail to work on several platforms with the following error message, then after re-connecting the device will be offlined and not working at all. [ 592.518442][ 2] sd 8:0:0:0: [sda] tag#17 uas_eh_abort_handler 0 uas-tag = 18 inflight: CMD [ 592.527575][ 2] sd 8:0:0:0: [sda] tag#17 CDB: Write(10) 2a 00 03 6f 88 0= 0 00 04 00 00 [ 592.536330][ 2] sd 8:0:0:0: [sda] tag#0 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD [ 592.545266][ 2] sd 8:0:0:0: [sda] tag#0 CDB: Write(10) 2a 00 07 44 1a 88= 00 00 08 00 These disks have a broken uas implementation, the tag field of the status iu-s is not set properly,so we need to fall-back to usb-storage. Acked-by: Alan Stern Cc: stable Signed-off-by: Hongling Zeng Link: https://lore.kernel.org/r/1663901173-21020-1-git-send-email-zenghongl= ing@kylinos.cn Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/usb/storage/unusual_uas.h | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/usb/storage/unusual_uas.h +++ b/drivers/usb/storage/unusual_uas.h @@ -52,6 +52,13 @@ UNUSUAL_DEV(0x059f, 0x1061, 0x0000, 0x99 USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NO_REPORT_OPCODES | US_FL_NO_SAME), =20 +/* Reported-by: Hongling Zeng */ +UNUSUAL_DEV(0x090c, 0x2000, 0x0000, 0x9999, + "Hiksemi", + "External HDD", + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_IGNORE_UAS), + /* * Apricorn USB3 dongle sometimes returns "USBSUSBSUSBS" in response to SC= SI * commands in UAS mode. Observed with the 1.28 firmware; are there other= s? From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51908C433FE for ; Mon, 3 Oct 2022 07:30:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231349AbiJCHaI (ORCPT ); Mon, 3 Oct 2022 03:30:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231376AbiJCH2x (ORCPT ); Mon, 3 Oct 2022 03:28:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11272117A; Mon, 3 Oct 2022 00:19:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 811DEB80E6B; Mon, 3 Oct 2022 07:17:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE25EC43143; Mon, 3 Oct 2022 07:17:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781472; bh=gcoji+IwOaxVnG3o+SYR8ObBzpQCYYfcz8oCmzRPUrg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V3NhSt66005xK6oys9/mGlFTmkD7wvayPEJvm1Vomeg6v75kSmD3yz1q+4DEbkHfu uF0BwuH2Qjlllt9S1rOr8qk2XiAs6XPbxMQMIaJxZ3H0kaMJs+2SJOjZXZEdl9F8Yt hVuG+uHq+mx+AgBYynGkQzO6eSi2Qz/JcwB7a/cM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , stable , Hongling Zeng Subject: [PATCH 5.15 08/83] usb-storage: Add Hiksemi USB3-FW to IGNORE_UAS Date: Mon, 3 Oct 2022 09:10:33 +0200 Message-Id: <20221003070722.195722863@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hongling Zeng commit e00b488e813f0f1ad9f778e771b7cd2fe2877023 upstream. The UAS mode of Hiksemi USB_HDD is reported to fail to work on several platforms with the following error message, then after re-connecting the device will be offlined and not working at all. [ 592.518442][ 2] sd 8:0:0:0: [sda] tag#17 uas_eh_abort_handler 0 uas-tag = 18 inflight: CMD [ 592.527575][ 2] sd 8:0:0:0: [sda] tag#17 CDB: Write(10) 2a 00 03 6f 88 0= 0 00 04 00 00 [ 592.536330][ 2] sd 8:0:0:0: [sda] tag#0 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD [ 592.545266][ 2] sd 8:0:0:0: [sda] tag#0 CDB: Write(10) 2a 00 07 44 1a 88= 00 00 08 00 These disks have a broken uas implementation, the tag field of the status iu-s is not set properly,so we need to fall-back to usb-storage. Acked-by: Alan Stern Cc: stable Signed-off-by: Hongling Zeng Link: https://lore.kernel.org/r/1663901185-21067-1-git-send-email-zenghongl= ing@kylinos.cn Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/usb/storage/unusual_uas.h | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/usb/storage/unusual_uas.h +++ b/drivers/usb/storage/unusual_uas.h @@ -83,6 +83,13 @@ UNUSUAL_DEV(0x0bc2, 0x331a, 0x0000, 0x99 USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NO_REPORT_LUNS), =20 +/* Reported-by: Hongling Zeng */ +UNUSUAL_DEV(0x0bda, 0x9210, 0x0000, 0x9999, + "Hiksemi", + "External HDD", + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_IGNORE_UAS), + /* Reported-by: Benjamin Tissoires */ UNUSUAL_DEV(0x13fd, 0x3940, 0x0000, 0x9999, "Initio Corporation", From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9A81C433FE for ; Mon, 3 Oct 2022 07:29:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231252AbiJCH3j (ORCPT ); Mon, 3 Oct 2022 03:29:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230127AbiJCH2Y (ORCPT ); Mon, 3 Oct 2022 03:28:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B4B5DC0; Mon, 3 Oct 2022 00:19:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 494FAB80E6E; Mon, 3 Oct 2022 07:17:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A746BC433C1; Mon, 3 Oct 2022 07:17:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781475; bh=6pZ6UQlxPLXtJOJyXlnGRVygfTHsLZc0+Seg8suUn4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o2N/nCiW6Vdldfvh8IdKeAiCQZHS2uLg3LOX19X/FuXYuJSgXNWfUv4/ukDBF5qQN /6kOyfKq6QORDe0uPaxQSa6iIPWQ01gJxcB0Kg7pBqPfYC2QD9JwG/VeWB0O8Roq0p JtopRRggg4ffH0nbii4s5dkEUgpV0dSwChaHS8i4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , stable , Hongling Zeng Subject: [PATCH 5.15 09/83] uas: ignore UAS for Thinkplus chips Date: Mon, 3 Oct 2022 09:10:34 +0200 Message-Id: <20221003070722.221409619@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hongling Zeng commit 0fb9703a3eade0bb84c635705d9c795345e55053 upstream. The UAS mode of Thinkplus(0x17ef, 0x3899) is reported to influence performance and trigger kernel panic on several platforms with the following error message: [ 39.702439] xhci_hcd 0000:0c:00.3: ERROR Transfer event for disabled endpoint or incorrect stream ring [ 39.702442] xhci_hcd 0000:0c:00.3: @000000026c61f810 00000000 00000000 1b000000 05038000 [ 720.545894][13] Workqueue: usb_hub_wq hub_event [ 720.550971][13] ffff88026c143c38 0000000000016300 ffff8802755bb900 ffff= 880 26cb80000 [ 720.559673][13] ffff88026c144000 ffff88026ca88100 0000000000000000 ffff= 880 26cb80000 [ 720.568374][13] ffff88026cb80000 ffff88026c143c50 ffffffff8186ae25 ffff= 880 26ca880f8 [ 720.577076][13] Call Trace: [ 720.580201][13] [] schedule+0x35/0x80 [ 720.586137][13] [] schedule_preempt_disabled+0xe/0x10 [ 720.593623][13] [] __mutex_lock_slowpath+0x164/0x1e0 [ 720.601012][13] [] mutex_lock+0x2f/0x40 [ 720.607141][13] [] usb_disconnect+0x59/0x290 Falling back to USB mass storage can solve this problem, so ignore UAS function of this chip. Acked-by: Alan Stern Cc: stable Signed-off-by: Hongling Zeng Link: https://lore.kernel.org/r/1663902249837086.19.seg@mailgw Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/usb/storage/unusual_uas.h | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/usb/storage/unusual_uas.h +++ b/drivers/usb/storage/unusual_uas.h @@ -132,6 +132,13 @@ UNUSUAL_DEV(0x154b, 0xf00d, 0x0000, 0x99 USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NO_ATA_1X), =20 +/* Reported-by: Hongling Zeng */ +UNUSUAL_DEV(0x17ef, 0x3899, 0x0000, 0x9999, + "Thinkplus", + "External HDD", + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_IGNORE_UAS), + /* Reported-by: Hans de Goede */ UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, "VIA", From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE02BC433FE for ; Mon, 3 Oct 2022 07:51:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232129AbiJCHvw (ORCPT ); Mon, 3 Oct 2022 03:51:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232252AbiJCHvQ (ORCPT ); Mon, 3 Oct 2022 03:51:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 844EF5BC23; Mon, 3 Oct 2022 00:29:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6371260FA8; Mon, 3 Oct 2022 07:16:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70AA9C43143; Mon, 3 Oct 2022 07:16:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781410; bh=sYll7ZP2PDZtg5d9aDoiVEZ7UY8f0WBXmTE27CYtDp0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LkHygsyaCLQHeXgrUWw34jnNrMJWo4NvzvNKnK1k5CuiFDkId61YigTA4rFdUquNW Xb65OXhkE8VdbSMmVrr34esG5ZOPcmuTIuSaNu6x59nnYU/T1FyKDMHrT70FSHdNKT B51EzB4kkSJZycXNqh9TlAT3cg6mxvuhONFt159w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Menzel , Heikki Krogerus Subject: [PATCH 5.15 10/83] usb: typec: ucsi: Remove incorrect warning Date: Mon, 3 Oct 2022 09:10:35 +0200 Message-Id: <20221003070722.244913101@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Heikki Krogerus commit 415ba26cb73f7d22a892043301b91b57ae54db02 upstream. Sink only devices do not have any source capabilities, so the driver should not warn about that. Also DRP (Dual Role Power) capable devices, such as USB Type-C docking stations, do not return any source capabilities unless they are plugged to a power supply themselves. Fixes: 1f4642b72be7 ("usb: typec: ucsi: Retrieve all the PDOs instead of ju= st the first 4") Reported-by: Paul Menzel Cc: Signed-off-by: Heikki Krogerus Link: https://lore.kernel.org/r/20220922145924.80667-1-heikki.krogerus@linu= x.intel.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/usb/typec/ucsi/ucsi.c | 2 -- 1 file changed, 2 deletions(-) --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -515,8 +515,6 @@ static int ucsi_get_pdos(struct ucsi_con num_pdos * sizeof(u32)); if (ret < 0) dev_err(ucsi->dev, "UCSI_GET_PDOS failed (%d)\n", ret); - if (ret =3D=3D 0 && offset =3D=3D 0) - dev_warn(ucsi->dev, "UCSI_GET_PDOS returned 0 bytes\n"); =20 return ret; } From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC5F6C433F5 for ; Mon, 3 Oct 2022 07:27:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231248AbiJCH1t (ORCPT ); Mon, 3 Oct 2022 03:27:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231209AbiJCH1M (ORCPT ); Mon, 3 Oct 2022 03:27:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE8C14D254; Mon, 3 Oct 2022 00:19:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 34BF960FA7; Mon, 3 Oct 2022 07:16:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 420B2C433D6; Mon, 3 Oct 2022 07:16:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781413; bh=J9P75/5S0RATD9l47s7hFoGzMQDgVknonjFIUC+Vo2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m2SOj6FmIVIYYuiF4NRMrJtxtTdZz981cNznAP6Vv+iy3e1RSJ5Fe4YWhj1+HkFv5 X+/kPN3fO4zMUXFAiBzCiDsGjl1J3EvC5dPUFa4KLFHcaMTM7sY3eIcCPi85tPCo3k E8j6RVfydvRv0RemEzYe8Ixg0QmtAolM09UOP3o4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mario Limonciello , Mika Westerberg Subject: [PATCH 5.15 11/83] thunderbolt: Explicitly reset plug events delay back to USB4 spec value Date: Mon, 3 Oct 2022 09:10:36 +0200 Message-Id: <20221003070722.268664803@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mario Limonciello commit 31f87f705b3c1635345d8e8a493697099b43e508 upstream. If any software has interacted with the USB4 registers before the Linux USB4 CM runs, it may have modified the plug events delay. It has been observed that if this value too large, it's possible that hotplugged devices will negotiate a fallback mode instead in Linux. To prevent this, explicitly align the plug events delay with the USB4 spec value of 10ms. Cc: stable@vger.kernel.org Signed-off-by: Mario Limonciello Signed-off-by: Mika Westerberg Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/thunderbolt/switch.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/thunderbolt/switch.c +++ b/drivers/thunderbolt/switch.c @@ -2281,6 +2281,7 @@ int tb_switch_configure(struct tb_switch * additional capabilities. */ sw->config.cmuv =3D USB4_VERSION_1_0; + sw->config.plug_events_delay =3D 0xa; =20 /* Enumerate the switch */ ret =3D tb_sw_write(sw, (u32 *)&sw->config + 1, TB_CFG_SWITCH, From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D47F3C433F5 for ; Mon, 3 Oct 2022 08:50:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229905AbiJCIug (ORCPT ); Mon, 3 Oct 2022 04:50:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229755AbiJCIty (ORCPT ); Mon, 3 Oct 2022 04:49:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E18B101D0; Mon, 3 Oct 2022 01:32:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C5D1460FA5; Mon, 3 Oct 2022 07:16:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9ED1C433C1; Mon, 3 Oct 2022 07:16:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781416; bh=h/e78F1BrRuBse28yetjYCGwSca6i4dfXzNsCn67ybA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RMq3bXrFitdL8cfFUFxDU9Ea6gDfrqhgsqDB4MKznCeVismF5iRkDLZKNHZjNcZ4x zN4ukp6PW+5B9ODAFRE+UkKAz2mU7F9iVuVhWF4t4SICj81KkOQXNVQWHfYvSJgtC4 GXLgSRxdL7MvoI59++CE4obWlYt6CxS9GNSbZmgI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frank Wunderlich , =?UTF-8?q?Bj=C3=B8rn=20Mork?= , Jakub Kicinski Subject: [PATCH 5.15 12/83] net: usb: qmi_wwan: Add new usb-id for Dell branded EM7455 Date: Mon, 3 Oct 2022 09:10:37 +0200 Message-Id: <20221003070722.292858506@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Frank Wunderlich commit 797666cd5af041ffb66642fff62f7389f08566a2 upstream. Add support for Dell 5811e (EM7455) with USB-id 0x413c:0x81c2. Signed-off-by: Frank Wunderlich Cc: stable@vger.kernel.org Acked-by: Bj=C3=B8rn Mork Link: https://lore.kernel.org/r/20220926150740.6684-3-linux@fw-web.de Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c @@ -1393,6 +1393,7 @@ static const struct usb_device_id produc {QMI_FIXED_INTF(0x413c, 0x81b3, 8)}, /* Dell Wireless 5809e Gobi(TM) 4G L= TE Mobile Broadband Card (rev3) */ {QMI_FIXED_INTF(0x413c, 0x81b6, 8)}, /* Dell Wireless 5811e */ {QMI_FIXED_INTF(0x413c, 0x81b6, 10)}, /* Dell Wireless 5811e */ + {QMI_FIXED_INTF(0x413c, 0x81c2, 8)}, /* Dell Wireless 5811e */ {QMI_FIXED_INTF(0x413c, 0x81cc, 8)}, /* Dell Wireless 5816e */ {QMI_FIXED_INTF(0x413c, 0x81d7, 0)}, /* Dell Wireless 5821e */ {QMI_FIXED_INTF(0x413c, 0x81d7, 1)}, /* Dell Wireless 5821e preproduction= config */ From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30E04C433F5 for ; Mon, 3 Oct 2022 07:50:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232283AbiJCHuw (ORCPT ); Mon, 3 Oct 2022 03:50:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232357AbiJCHuG (ORCPT ); Mon, 3 Oct 2022 03:50:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E83805AC72; Mon, 3 Oct 2022 00:28:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 706C960FB3; Mon, 3 Oct 2022 07:16:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80DFCC43142; Mon, 3 Oct 2022 07:16:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781418; bh=iiHvL8xuvSgYPTGIvbygeHeLLXH/8zJ7cHYbq0fxa4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k1vsldhahH/KUy1Z3fwnvfRvvPobR4XSoy+RbQcCaLKdiWnrlkjQ4Pz776TNDYIJw pZVNz59k5MO7ipcdOH6MWyTexPZtA4IWr/k+aUnuviQkfGXfFMZu187AS7kTJwau93 f/vvw/eIEl/7XzOZpiiRrWcZl+eki2LY43MnwX/I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Kepplinger , Sebastian Krzyszkowiak , Mattijs Korpershoek , Dmitry Torokhov Subject: [PATCH 5.15 13/83] Input: snvs_pwrkey - fix SNVS_HPVIDR1 register address Date: Mon, 3 Oct 2022 09:10:38 +0200 Message-Id: <20221003070722.316560040@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sebastian Krzyszkowiak commit e62563db857f81d75c5726a35bc0180bed6d1540 upstream. Both i.MX6 and i.MX8 reference manuals list 0xBF8 as SNVS_HPVIDR1 (chapters 57.9 and 6.4.5 respectively). Without this, trying to read the revision number results in 0 on all revisions, causing the i.MX6 quirk to apply on all platforms, which in turn causes the driver to synthesise power button release events instead of passing the real one as they happen even on platforms like i.MX8 where that's not wanted. Fixes: 1a26c920717a ("Input: snvs_pwrkey - send key events for i.MX6 S, DL = and Q") Tested-by: Martin Kepplinger Signed-off-by: Sebastian Krzyszkowiak Reviewed-by: Mattijs Korpershoek Cc: Link: https://lore.kernel.org/r/4599101.ElGaqSPkdT@pliszka Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/input/keyboard/snvs_pwrkey.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/input/keyboard/snvs_pwrkey.c +++ b/drivers/input/keyboard/snvs_pwrkey.c @@ -20,7 +20,7 @@ #include #include =20 -#define SNVS_HPVIDR1_REG 0xF8 +#define SNVS_HPVIDR1_REG 0xBF8 #define SNVS_LPSR_REG 0x4C /* LP Status Register */ #define SNVS_LPCR_REG 0x38 /* LP Control Register */ #define SNVS_HPSR_REG 0x14 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 228C5C4332F for ; Mon, 3 Oct 2022 07:28:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230469AbiJCH21 (ORCPT ); Mon, 3 Oct 2022 03:28:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230434AbiJCH1g (ORCPT ); Mon, 3 Oct 2022 03:27:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74927B48B; Mon, 3 Oct 2022 00:19:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0408C60FAA; Mon, 3 Oct 2022 07:17:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 136A9C433D7; Mon, 3 Oct 2022 07:17:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781421; bh=9kc9PLb+BZ8QNCH1sq+jdWU3fbqpU4mSrdn9iVjAAQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hzo1+LwVhfAKFixUcj+sN0kcyTGwC0Wj+6sFPYrrhhiUkfWfKX9XuOFCp6Vo2PYxA R1iVb5pcQhFJQ5+zFzGSCUNlAQLkPD1tYKCLNoab4+w2mgJzmC24x4lGs+4NcXw/X4 2oDuF9kRYm13tlddH25Kvm3YOmmMZA9bxnvVWnNQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jacob Kroon , Marc Kleine-Budde Subject: [PATCH 5.15 14/83] can: c_can: dont cache TX messages for C_CAN cores Date: Mon, 3 Oct 2022 09:10:39 +0200 Message-Id: <20221003070722.341068727@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marc Kleine-Budde commit 81d192c2ce74157e717e1fc4b68791f82f7499d4 upstream. As Jacob noticed, the optimization introduced in 387da6bc7a82 ("can: c_can: cache frames to operate as a true FIFO") doesn't properly work on C_CAN, but on D_CAN IP cores. The exact reasons are still unknown. For now disable caching if CAN frames in the TX path for C_CAN cores. Fixes: 387da6bc7a82 ("can: c_can: cache frames to operate as a true FIFO") Link: https://lore.kernel.org/all/20220928083354.1062321-1-mkl@pengutronix.= de Link: https://lore.kernel.org/all/15a8084b-9617-2da1-6704-d7e39d60643b@gmai= l.com Reported-by: Jacob Kroon Tested-by: Jacob Kroon Cc: stable@vger.kernel.org # v5.15 Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/net/can/c_can/c_can.h | 17 +++++++++++++++-- drivers/net/can/c_can/c_can_main.c | 11 +++++------ 2 files changed, 20 insertions(+), 8 deletions(-) --- a/drivers/net/can/c_can/c_can.h +++ b/drivers/net/can/c_can/c_can.h @@ -236,9 +236,22 @@ static inline u8 c_can_get_tx_tail(const return ring->tail & (ring->obj_num - 1); } =20 -static inline u8 c_can_get_tx_free(const struct c_can_tx_ring *ring) +static inline u8 c_can_get_tx_free(const struct c_can_priv *priv, + const struct c_can_tx_ring *ring) { - return ring->obj_num - (ring->head - ring->tail); + u8 head =3D c_can_get_tx_head(ring); + u8 tail =3D c_can_get_tx_tail(ring); + + if (priv->type =3D=3D BOSCH_D_CAN) + return ring->obj_num - (ring->head - ring->tail); + + /* This is not a FIFO. C/D_CAN sends out the buffers + * prioritized. The lowest buffer number wins. + */ + if (head < tail) + return 0; + + return ring->obj_num - head; } =20 #endif /* C_CAN_H */ --- a/drivers/net/can/c_can/c_can_main.c +++ b/drivers/net/can/c_can/c_can_main.c @@ -430,7 +430,7 @@ static void c_can_setup_receive_object(s static bool c_can_tx_busy(const struct c_can_priv *priv, const struct c_can_tx_ring *tx_ring) { - if (c_can_get_tx_free(tx_ring) > 0) + if (c_can_get_tx_free(priv, tx_ring) > 0) return false; =20 netif_stop_queue(priv->dev); @@ -438,7 +438,7 @@ static bool c_can_tx_busy(const struct c /* Memory barrier before checking tx_free (head and tail) */ smp_mb(); =20 - if (c_can_get_tx_free(tx_ring) =3D=3D 0) { + if (c_can_get_tx_free(priv, tx_ring) =3D=3D 0) { netdev_dbg(priv->dev, "Stopping tx-queue (tx_head=3D0x%08x, tx_tail=3D0x%08x, len=3D%d).\n= ", tx_ring->head, tx_ring->tail, @@ -466,7 +466,7 @@ static netdev_tx_t c_can_start_xmit(stru =20 idx =3D c_can_get_tx_head(tx_ring); tx_ring->head++; - if (c_can_get_tx_free(tx_ring) =3D=3D 0) + if (c_can_get_tx_free(priv, tx_ring) =3D=3D 0) netif_stop_queue(dev); =20 if (idx < c_can_get_tx_tail(tx_ring)) @@ -751,7 +751,7 @@ static void c_can_do_tx(struct net_devic return; =20 tx_ring->tail +=3D pkts; - if (c_can_get_tx_free(tx_ring)) { + if (c_can_get_tx_free(priv, tx_ring)) { /* Make sure that anybody stopping the queue after * this sees the new tx_ring->tail. */ @@ -764,8 +764,7 @@ static void c_can_do_tx(struct net_devic can_led_event(dev, CAN_LED_EVENT_TX); =20 tail =3D c_can_get_tx_tail(tx_ring); - - if (tail =3D=3D 0) { + if (priv->type =3D=3D BOSCH_D_CAN && tail =3D=3D 0) { u8 head =3D c_can_get_tx_head(tx_ring); =20 /* Start transmission for all cached messages */ From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 288B6C433F5 for ; Mon, 3 Oct 2022 07:24:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230397AbiJCHYu (ORCPT ); Mon, 3 Oct 2022 03:24:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229942AbiJCHX2 (ORCPT ); Mon, 3 Oct 2022 03:23:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10AC94A819; Mon, 3 Oct 2022 00:17:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9912660F9D; Mon, 3 Oct 2022 07:17:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEB85C43144; Mon, 3 Oct 2022 07:17:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781424; bh=ZpKjv/MqU+BVENNAyJSrumUBGjzF0RDQDNmlN6qablY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zc/YPfFnqqTYbo18W6DQ4EJxa66XvRlgC96gEv0/zaP8unB+LB+3t2dk5E1DHAxuO 9WHOv2gr/qxPA3XQp5pDK9rsXlK/Um/nbkjZpCo0OHFcBTf+Cf6z9qRESRsI8BHtnx t0YPuKJSzONGD96jj7HBSZ7LrorYYEcac9k/OknA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Cercueil , Aidan MacDonald , Stephen Boyd Subject: [PATCH 5.15 15/83] clk: ingenic-tcu: Properly enable registers before accessing timers Date: Mon, 3 Oct 2022 09:10:40 +0200 Message-Id: <20221003070722.365624246@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Aidan MacDonald commit 6726d552a6912e88cf63fe2bda87b2efa0efc7d0 upstream. Access to registers is guarded by ingenic_tcu_{enable,disable}_regs() so the stop bit can be cleared before accessing a timer channel, but those functions did not clear the stop bit on SoCs with a global TCU clock gate. Testing on the X1000 has revealed that the stop bits must be cleared _and_ the global TCU clock must be ungated to access timer registers. This appears to be the norm on Ingenic SoCs, and is specified in the documentation for the X1000 and numerous JZ47xx SoCs. If the stop bit isn't cleared, register writes don't take effect and the system can be left in a broken state, eg. the watchdog timer may not run. The bug probably went unnoticed because stop bits are zeroed when the SoC is reset, and the kernel does not set them unless a timer gets disabled at runtime. However, it is possible that a bootloader or a previous kernel (if using kexec) leaves the stop bits set and we should not rely on them being cleared. Fixing this is easy: have ingenic_tcu_{enable,disable}_regs() always clear the stop bit, regardless of the presence of a global TCU gate. Reviewed-by: Paul Cercueil Tested-by: Paul Cercueil Fixes: 4f89e4b8f121 ("clk: ingenic: Add driver for the TCU clocks") Cc: stable@vger.kernel.org Signed-off-by: Aidan MacDonald Link: https://lore.kernel.org/r/20220617122254.738900-1-aidanmacdonald.0x0@= gmail.com Signed-off-by: Stephen Boyd Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/clk/ingenic/tcu.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) --- a/drivers/clk/ingenic/tcu.c +++ b/drivers/clk/ingenic/tcu.c @@ -100,15 +100,11 @@ static bool ingenic_tcu_enable_regs(stru bool enabled =3D false; =20 /* - * If the SoC has no global TCU clock, we must ungate the channel's - * clock to be able to access its registers. - * If we have a TCU clock, it will be enabled automatically as it has - * been attached to the regmap. + * According to the programming manual, a timer channel's registers can + * only be accessed when the channel's stop bit is clear. */ - if (!tcu->clk) { - enabled =3D !!ingenic_tcu_is_enabled(hw); - regmap_write(tcu->map, TCU_REG_TSCR, BIT(info->gate_bit)); - } + enabled =3D !!ingenic_tcu_is_enabled(hw); + regmap_write(tcu->map, TCU_REG_TSCR, BIT(info->gate_bit)); =20 return enabled; } @@ -119,8 +115,7 @@ static void ingenic_tcu_disable_regs(str const struct ingenic_tcu_clk_info *info =3D tcu_clk->info; struct ingenic_tcu *tcu =3D tcu_clk->tcu; =20 - if (!tcu->clk) - regmap_write(tcu->map, TCU_REG_TSSR, BIT(info->gate_bit)); + regmap_write(tcu->map, TCU_REG_TSSR, BIT(info->gate_bit)); } =20 static u8 ingenic_tcu_get_parent(struct clk_hw *hw) From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B41DC433FE for ; Mon, 3 Oct 2022 08:52:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229986AbiJCIwU (ORCPT ); Mon, 3 Oct 2022 04:52:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229747AbiJCIvv (ORCPT ); Mon, 3 Oct 2022 04:51:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9756C5A8AE; Mon, 3 Oct 2022 01:35:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EFCCDB80E6F; Mon, 3 Oct 2022 07:17:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67261C433D6; Mon, 3 Oct 2022 07:17:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781426; bh=yk41U2/x1V1jtnOx1oAS+KXJCG6Br0e4E/NOlvbPDTM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yxtSLWW5PdKIGJjQxcO2DiMay9Eqk0h0kvKqgu8X3mIUSvw0GdkftiqNJyHFvO29O w8QrN1mgGWiiszoa59pY8POA4oOr9YdrhbjFfh10pAKCTQ92eAUE0xNcNG9qd8qsDa GT3/bSqd6QuBuNMZ+KmyeLpMn1YlEhlm4uzgcLm0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Menzel , Jarkko Sakkinen , Dave Hansen , Reinette Chatre Subject: [PATCH 5.15 16/83] x86/sgx: Do not fail on incomplete sanitization on premature stop of ksgxd Date: Mon, 3 Oct 2022 09:10:41 +0200 Message-Id: <20221003070722.390669625@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jarkko Sakkinen commit 133e049a3f8c91b175029fb6a59b6039d5e79cba upstream. Unsanitized pages trigger WARN_ON() unconditionally, which can panic the whole computer, if /proc/sys/kernel/panic_on_warn is set. In sgx_init(), if misc_register() fails or misc_register() succeeds but neither sgx_drv_init() nor sgx_vepc_init() succeeds, then ksgxd will be prematurely stopped. This may leave unsanitized pages, which will result a false warning. Refine __sgx_sanitize_pages() to return: 1. Zero when the sanitization process is complete or ksgxd has been requested to stop. 2. The number of unsanitized pages otherwise. Fixes: 51ab30eb2ad4 ("x86/sgx: Replace section->init_laundry_list with sgx_= dirty_page_list") Reported-by: Paul Menzel Signed-off-by: Jarkko Sakkinen Signed-off-by: Dave Hansen Reviewed-by: Reinette Chatre Cc: stable@vger.kernel.org Link: https://lore.kernel.org/linux-sgx/20220825051827.246698-1-jarkko@kern= el.org/T/#u Link: https://lkml.kernel.org/r/20220906000221.34286-2-jarkko@kernel.org Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- arch/x86/kernel/cpu/sgx/main.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) --- a/arch/x86/kernel/cpu/sgx/main.c +++ b/arch/x86/kernel/cpu/sgx/main.c @@ -46,9 +46,13 @@ static LIST_HEAD(sgx_dirty_page_list); * Reset post-kexec EPC pages to the uninitialized state. The pages are re= moved * from the input list, and made available for the page allocator. SECS pa= ges * prepending their children in the input list are left intact. + * + * Return 0 when sanitization was successful or kthread was stopped, and t= he + * number of unsanitized pages otherwise. */ -static void __sgx_sanitize_pages(struct list_head *dirty_page_list) +static unsigned long __sgx_sanitize_pages(struct list_head *dirty_page_lis= t) { + unsigned long left_dirty =3D 0; struct sgx_epc_page *page; LIST_HEAD(dirty); int ret; @@ -56,7 +60,7 @@ static void __sgx_sanitize_pages(struct /* dirty_page_list is thread-local, no need for a lock: */ while (!list_empty(dirty_page_list)) { if (kthread_should_stop()) - return; + return 0; =20 page =3D list_first_entry(dirty_page_list, struct sgx_epc_page, list); =20 @@ -71,12 +75,14 @@ static void __sgx_sanitize_pages(struct } else { /* The page is not yet clean - move to the dirty list. */ list_move_tail(&page->list, &dirty); + left_dirty++; } =20 cond_resched(); } =20 list_splice(&dirty, dirty_page_list); + return left_dirty; } =20 static bool sgx_reclaimer_age(struct sgx_epc_page *epc_page) @@ -427,10 +433,7 @@ static int ksgxd(void *p) * required for SECS pages, whose child pages blocked EREMOVE. */ __sgx_sanitize_pages(&sgx_dirty_page_list); - __sgx_sanitize_pages(&sgx_dirty_page_list); - - /* sanity check: */ - WARN_ON(!list_empty(&sgx_dirty_page_list)); + WARN_ON(__sgx_sanitize_pages(&sgx_dirty_page_list)); =20 while (!kthread_should_stop()) { if (try_to_freeze()) From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADC70C433F5 for ; Mon, 3 Oct 2022 08:18:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229689AbiJCISm (ORCPT ); Mon, 3 Oct 2022 04:18:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229618AbiJCISP (ORCPT ); Mon, 3 Oct 2022 04:18:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5921786E1; Mon, 3 Oct 2022 00:53:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A916FB80E74; Mon, 3 Oct 2022 07:17:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1672FC433B5; Mon, 3 Oct 2022 07:17:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781429; bh=EXjK73KHdYpm2V0MmgjH12NZLEWMdxNT6n4uqcYvUtc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K6YBqMUrAI1mMSLctzDqTILB9lbYuoelpvk+hdZ3aw6fZhiqW8VXGpMxhpxL8L5iG abzSDduFVuBd4M7A6Ve6Ktuu/CDsHRz9L694gyBpDPAfbJSxzg5O32AE5anDYj/n3M W4/iEk25ZEMbvsnX8kQqkcprjkmVEUYk+Tiqubfc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Arnd Bergmann Subject: [PATCH 5.15 17/83] ARM: dts: integrator: Tag PCI host with device_type Date: Mon, 3 Oct 2022 09:10:42 +0200 Message-Id: <20221003070722.415685981@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linus Walleij commit 4952aa696a9f221c5e34e5961e02fca41ef67ad6 upstream. The DT parser is dependent on the PCI device being tagged as device_type =3D "pci" in order to parse memory ranges properly. Fix this up. Signed-off-by: Linus Walleij Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220919092608.813511-1-linus.walleij@linar= o.org' Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- arch/arm/boot/dts/integratorap.dts | 1 + 1 file changed, 1 insertion(+) --- a/arch/arm/boot/dts/integratorap.dts +++ b/arch/arm/boot/dts/integratorap.dts @@ -153,6 +153,7 @@ =20 pci: pciv3@62000000 { compatible =3D "arm,integrator-ap-pci", "v3,v360epc-pci"; + device_type =3D "pci"; #interrupt-cells =3D <1>; #size-cells =3D <2>; #address-cells =3D <3>; From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBFCFC433F5 for ; Mon, 3 Oct 2022 07:50:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232255AbiJCHut (ORCPT ); Mon, 3 Oct 2022 03:50:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232331AbiJCHt6 (ORCPT ); Mon, 3 Oct 2022 03:49:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D30455AC66; Mon, 3 Oct 2022 00:28:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9D30660FAC; Mon, 3 Oct 2022 07:17:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3AAEC433C1; Mon, 3 Oct 2022 07:17:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781432; bh=kXF99wYI2vw+gjdXMYA9FTirKzz+ImYzxc+lgH9a35I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C7UM9rVFLkSs3dG12NmpgfTFiAFcm5TI+drXEQXxDJyfYwG139wHFtRCmKmuUVEbT lMTox7T1SDJMBqqtD8cQyuUIlvrIsXSg0e//3Rg1M2XER0OBH9krU+KfMBKg90C0GH goYt090p4R/nGf6xrx/p86FxTbdRV2tO/Q07PZbA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, ChenXiaoSong , Anton Altaparmakov , Andrew Morton Subject: [PATCH 5.15 18/83] ntfs: fix BUG_ON in ntfs_lookup_inode_by_name() Date: Mon, 3 Oct 2022 09:10:43 +0200 Message-Id: <20221003070722.440859023@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: ChenXiaoSong commit 1b513f613731e2afc05550e8070d79fac80c661e upstream. Syzkaller reported BUG_ON as follows: Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee ------------[ cut here ]------------ kernel BUG at fs/ntfs/dir.c:86! invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI CPU: 3 PID: 758 Comm: a.out Not tainted 5.19.0-next-20220808 #5 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd= 239552ce722-prebuilt.qemu.org 04/01/2014 RIP: 0010:ntfs_lookup_inode_by_name+0xd11/0x2d10 Code: ff e9 b9 01 00 00 e8 1e fe d6 fe 48 8b 7d 98 49 8d 5d 07 e8 91 85 29 = ff 48 c7 45 98 00 00 00 00 e9 5a fb ff ff e8 ff fd d6 fe <0f> 0b e8 f8 fd d= 6 fe 0f 0b e8 f1 fd d6 fe 48 8b b5 50 ff ff ff 4c RSP: 0018:ffff888079607978 EFLAGS: 00010293 RAX: 0000000000000000 RBX: 0000000000008000 RCX: 0000000000000000 RDX: ffff88807cf10000 RSI: ffffffff82a4a081 RDI: 0000000000000003 RBP: ffff888079607a70 R08: 0000000000000001 R09: ffff88807a6d01d7 R10: ffffed100f4da03a R11: 0000000000000000 R12: ffff88800f0fb110 R13: ffff88800f0ee000 R14: ffff88800f0fb000 R15: 0000000000000001 FS: 00007f33b63c7540(0000) GS:ffff888108580000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f33b635c090 CR3: 000000000f39e005 CR4: 0000000000770ee0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: load_system_files+0x1f7f/0x3620 ntfs_fill_super+0xa01/0x1be0 mount_bdev+0x36a/0x440 ntfs_mount+0x3a/0x50 legacy_get_tree+0xfb/0x210 vfs_get_tree+0x8f/0x2f0 do_new_mount+0x30a/0x760 path_mount+0x4de/0x1880 __x64_sys_mount+0x2b3/0x340 do_syscall_64+0x38/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f33b62ff9ea Code: 48 8b 0d a9 f4 0b 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 = 00 00 00 00 0f 1f 44 00 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff f= f 73 01 c3 48 8b 0d 76 f4 0b 00 f7 d8 64 89 01 48 RSP: 002b:00007ffd0c471aa8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f33b62ff9ea RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007ffd0c471be0 RBP: 00007ffd0c471c60 R08: 00007ffd0c471ae0 R09: 00007ffd0c471c24 R10: 0000000000000000 R11: 0000000000000202 R12: 000055bac5afc160 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Modules linked in: ---[ end trace 0000000000000000 ]--- Fix this by adding sanity check on extended system files' directory inode to ensure that it is directory, just like ntfs_extend_init() when mounting ntfs3. Link: https://lkml.kernel.org/r/20220809064730.2316892-1-chenxiaosong2@huaw= ei.com Signed-off-by: ChenXiaoSong Cc: Anton Altaparmakov Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- fs/ntfs/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c @@ -2092,7 +2092,8 @@ get_ctx_vol_failed: // TODO: Initialize security. /* Get the extended system files' directory inode. */ vol->extend_ino =3D ntfs_iget(sb, FILE_Extend); - if (IS_ERR(vol->extend_ino) || is_bad_inode(vol->extend_ino)) { + if (IS_ERR(vol->extend_ino) || is_bad_inode(vol->extend_ino) || + !S_ISDIR(vol->extend_ino->i_mode)) { if (!IS_ERR(vol->extend_ino)) iput(vol->extend_ino); ntfs_error(sb, "Failed to load $Extend."); From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80487C433F5 for ; Mon, 3 Oct 2022 08:41:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229811AbiJCIlQ (ORCPT ); Mon, 3 Oct 2022 04:41:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbiJCIk4 (ORCPT ); Mon, 3 Oct 2022 04:40:56 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B91521EC60; Mon, 3 Oct 2022 01:15:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id C895ECE0B1B; Mon, 3 Oct 2022 07:17:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5891EC433B5; Mon, 3 Oct 2022 07:17:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781434; bh=OMhC/0OyVug3ZfZTIbErceYWR0Edznp98eG1Zj1b+TU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HOvIIDpxR5mcsNIVA0OaulbAq+nDU4DDpsrA/IHq4Bog2uOzaGDtfPO0VyzbPVu6a nHq6CRSHHpwyxJNAjVGXWWHNWiXv/Ydeh3uent2eknUfHLznCHe3XhSS6Leh5A0jG1 9nlKvKZLvrpNt9iDqOlrPGObDowsVKmRct8J193Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, SeongJae Park , Andrew Morton Subject: [PATCH 5.15 19/83] mm/damon/dbgfs: fix memory leak when using debugfs_lookup() Date: Mon, 3 Oct 2022 09:10:44 +0200 Message-Id: <20221003070722.466233554@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Greg Kroah-Hartman commit 1552fd3ef7dbe07208b8ae84a0a6566adf7dfc9d upstream. When calling debugfs_lookup() the result must have dput() called on it, otherwise the memory will leak over time. Fix this up by properly calling dput(). Link: https://lkml.kernel.org/r/20220902191149.112434-1-sj@kernel.org Fixes: 75c1c2b53c78b ("mm/damon/dbgfs: support multiple contexts") Signed-off-by: Greg Kroah-Hartman Signed-off-by: SeongJae Park Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- mm/damon/dbgfs.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) --- a/mm/damon/dbgfs.c +++ b/mm/damon/dbgfs.c @@ -443,6 +443,7 @@ static int dbgfs_rm_context(char *name) struct dentry *root, *dir, **new_dirs; struct damon_ctx **new_ctxs; int i, j; + int ret =3D 0; =20 if (damon_nr_running_ctxs()) return -EBUSY; @@ -457,14 +458,16 @@ static int dbgfs_rm_context(char *name) =20 new_dirs =3D kmalloc_array(dbgfs_nr_ctxs - 1, sizeof(*dbgfs_dirs), GFP_KERNEL); - if (!new_dirs) - return -ENOMEM; + if (!new_dirs) { + ret =3D -ENOMEM; + goto out_dput; + } =20 new_ctxs =3D kmalloc_array(dbgfs_nr_ctxs - 1, sizeof(*dbgfs_ctxs), GFP_KERNEL); if (!new_ctxs) { - kfree(new_dirs); - return -ENOMEM; + ret =3D -ENOMEM; + goto out_new_dirs; } =20 for (i =3D 0, j =3D 0; i < dbgfs_nr_ctxs; i++) { @@ -484,7 +487,13 @@ static int dbgfs_rm_context(char *name) dbgfs_ctxs =3D new_ctxs; dbgfs_nr_ctxs--; =20 - return 0; + goto out_dput; + +out_new_dirs: + kfree(new_dirs); +out_dput: + dput(dir); + return ret; } =20 static ssize_t dbgfs_rm_context_write(struct file *file, From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47B0BC433F5 for ; Mon, 3 Oct 2022 07:45:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232231AbiJCHpr (ORCPT ); Mon, 3 Oct 2022 03:45:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232351AbiJCHoO (ORCPT ); Mon, 3 Oct 2022 03:44:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E28D57568; Mon, 3 Oct 2022 00:25:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3F458B80E7A; Mon, 3 Oct 2022 07:17:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B767C433D6; Mon, 3 Oct 2022 07:17:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781440; bh=+K2M49aupPvctZ91T0D68iUEBcL7JYgj1FqGcf/KDjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RRKJ7XTa1zbX//t8+sZ1gymSbI+E6LXrDuLYBz1wY1RUMvY3QzZP/99edgXGMu1LA ri9snwj9Rwvok0/ecOgpoorKdvvpcaCLurltTJbsTF8eLuJ8XLqJzCTO+SbO9vrtvU KyuEpIegTaXLyToLkTjemR/bpDEuypNaVC/IAamM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Couzens , Jakub Kicinski Subject: [PATCH 5.15 20/83] net: mt7531: only do PLL once after the reset Date: Mon, 3 Oct 2022 09:10:45 +0200 Message-Id: <20221003070722.491312135@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Couzens commit 42bc4fafe359ed6b73602b7a2dba0dd99588f8ce upstream. Move the PLL init of the switch out of the pad configuration of the port 6 (usally cpu port). Fix a unidirectional 100 mbit limitation on 1 gbit or 2.5 gbit links for outbound traffic on port 5 or port 6. Fixes: c288575f7810 ("net: dsa: mt7530: Add the support of MT7531 switch") Cc: stable@vger.kernel.org Signed-off-by: Alexander Couzens Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/net/dsa/mt7530.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -501,14 +501,19 @@ static bool mt7531_dual_sgmii_supported( static int mt7531_pad_setup(struct dsa_switch *ds, phy_interface_t interface) { - struct mt7530_priv *priv =3D ds->priv; + return 0; +} + +static void +mt7531_pll_setup(struct mt7530_priv *priv) +{ u32 top_sig; u32 hwstrap; u32 xtal; u32 val; =20 if (mt7531_dual_sgmii_supported(priv)) - return 0; + return; =20 val =3D mt7530_read(priv, MT7531_CREV); top_sig =3D mt7530_read(priv, MT7531_TOP_SIG_SR); @@ -587,8 +592,6 @@ mt7531_pad_setup(struct dsa_switch *ds, val |=3D EN_COREPLL; mt7530_write(priv, MT7531_PLLGP_EN, val); usleep_range(25, 35); - - return 0; } =20 static void @@ -2292,6 +2295,8 @@ mt7531_setup(struct dsa_switch *ds) SYS_CTRL_PHY_RST | SYS_CTRL_SW_RST | SYS_CTRL_REG_RST); =20 + mt7531_pll_setup(priv); + if (mt7531_dual_sgmii_supported(priv)) { priv->p5_intf_sel =3D P5_INTF_SEL_GMAC5_SGMII; =20 @@ -2867,8 +2872,6 @@ mt7531_cpu_port_config(struct dsa_switch case 6: interface =3D PHY_INTERFACE_MODE_2500BASEX; =20 - mt7531_pad_setup(ds, interface); - priv->p6_interface =3D interface; break; default: From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B84AC433F5 for ; Mon, 3 Oct 2022 07:29:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231193AbiJCH30 (ORCPT ); Mon, 3 Oct 2022 03:29:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231224AbiJCH2Q (ORCPT ); Mon, 3 Oct 2022 03:28:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3859310; Mon, 3 Oct 2022 00:19:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 43E5A60FC1; Mon, 3 Oct 2022 07:17:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56466C433C1; Mon, 3 Oct 2022 07:17:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781442; bh=vV6J72lgCKZaW1qd9qddBQY27IkQVHpqMFO4vnJKAs8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RbNAxzqm3xKZzuwvBJ+MlRWuBlyTFzaoOYhP6Uipg7iaQmhTu409haxEMkKQ53nu+ cV4rKXttLmhMn4WNKsENOctfjJiKNiuiVOO88ald14SB9WUq2C2khSMQfWRt48gSIu ygkcB4u+7Dl70uDuMgX7hSXZDLJ6ohi6jz5adD1c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Pitre , Ulf Hansson , Peng Fan , Sudeep Holla Subject: [PATCH 5.15 21/83] Revert "firmware: arm_scmi: Add clock management to the SCMI power domain" Date: Mon, 3 Oct 2022 09:10:46 +0200 Message-Id: <20221003070722.518396983@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ulf Hansson commit 3c6656337852e9f1a4079d172f3fddfbf00868f9 upstream. This reverts commit a3b884cef873 ("firmware: arm_scmi: Add clock management to the SCMI power domain"). Using the GENPD_FLAG_PM_CLK tells genpd to gate/ungate the consumer device's clock(s) during runtime suspend/resume through the PM clock API. More precisely, in genpd_runtime_resume() the clock(s) for the consumer device would become ungated prior to the driver-level ->runtime_resume() callbacks gets invoked. This behaviour isn't a good fit for all platforms/drivers. For example, a driver may need to make some preparations of its device in its ->runtime_resume() callback, like calling clk_set_rate() before the clock(s) should be ungated. In these cases, it's easier to let the clock(s) to be managed solely by the driver, rather than at the PM domain level. For these reasons, let's drop the use GENPD_FLAG_PM_CLK for the SCMI PM domain, as to enable it to be more easily adopted across ARM platforms. Fixes: a3b884cef873 ("firmware: arm_scmi: Add clock management to the SCMI = power domain") Cc: Nicolas Pitre Cc: stable@vger.kernel.org Signed-off-by: Ulf Hansson Tested-by: Peng Fan Acked-by: Sudeep Holla Link: https://lore.kernel.org/r/20220919122033.86126-1-ulf.hansson@linaro.o= rg Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/firmware/arm_scmi/scmi_pm_domain.c | 26 ------------------------= -- 1 file changed, 26 deletions(-) --- a/drivers/firmware/arm_scmi/scmi_pm_domain.c +++ b/drivers/firmware/arm_scmi/scmi_pm_domain.c @@ -8,7 +8,6 @@ #include #include #include -#include #include #include =20 @@ -53,27 +52,6 @@ static int scmi_pd_power_off(struct gene return scmi_pd_power(domain, false); } =20 -static int scmi_pd_attach_dev(struct generic_pm_domain *pd, struct device = *dev) -{ - int ret; - - ret =3D pm_clk_create(dev); - if (ret) - return ret; - - ret =3D of_pm_clk_add_clks(dev); - if (ret >=3D 0) - return 0; - - pm_clk_destroy(dev); - return ret; -} - -static void scmi_pd_detach_dev(struct generic_pm_domain *pd, struct device= *dev) -{ - pm_clk_destroy(dev); -} - static int scmi_pm_domain_probe(struct scmi_device *sdev) { int num_domains, i; @@ -124,10 +102,6 @@ static int scmi_pm_domain_probe(struct s scmi_pd->genpd.name =3D scmi_pd->name; scmi_pd->genpd.power_off =3D scmi_pd_power_off; scmi_pd->genpd.power_on =3D scmi_pd_power_on; - scmi_pd->genpd.attach_dev =3D scmi_pd_attach_dev; - scmi_pd->genpd.detach_dev =3D scmi_pd_detach_dev; - scmi_pd->genpd.flags =3D GENPD_FLAG_PM_CLK | - GENPD_FLAG_ACTIVE_WAKEUP; =20 pm_genpd_init(&scmi_pd->genpd, NULL, state =3D=3D SCMI_POWER_STATE_GENERIC_OFF); From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C98F6C433F5 for ; Mon, 3 Oct 2022 07:25:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230465AbiJCHZQ (ORCPT ); Mon, 3 Oct 2022 03:25:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230452AbiJCHXj (ORCPT ); Mon, 3 Oct 2022 03:23:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 479574B4A6; Mon, 3 Oct 2022 00:17:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A3CCBB80E6B; Mon, 3 Oct 2022 07:17:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E128EC433D6; Mon, 3 Oct 2022 07:17:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781445; bh=Ep335t2I/xaHGQeJd/i5wb01J+lIvEjwZwn2VcHR79Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mcFAUieFOPj1vEe/vfwrvP91635+QwDMBjq/k7y12SlxbYE2JsIII3mP2wRVUJAOV SJPW8M7KvxcnDuRnVhc9VXetw/wlthdY5YqM+9tsPgFv4Cwa+Vu85tTnEc8WZiFYfc 3TIGRrkVXmSBCPDpX7XJ2BM7ObPwq6NvLmgKjMaw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Aneesh Kumar K.V" , Yang Shi , David Hildenbrand , Peter Xu , Christophe Leroy , Hugh Dickins , Jason Gunthorpe , John Hubbard , "Kirill A. Shutemov" , Michael Ellerman , Nicholas Piggin , Andrew Morton Subject: [PATCH 5.15 22/83] powerpc/64s/radix: dont need to broadcast IPI for radix pmd collapse flush Date: Mon, 3 Oct 2022 09:10:47 +0200 Message-Id: <20221003070722.545874809@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Shi commit bedf03416913d88c796288f9dca109a53608c745 upstream. The IPI broadcast is used to serialize against fast-GUP, but fast-GUP will move to use RCU instead of disabling local interrupts in fast-GUP. Using an IPI is the old-styled way of serializing against fast-GUP although it still works as expected now. And fast-GUP now fixed the potential race with THP collapse by checking whether PMD is changed or not. So IPI broadcast in radix pmd collapse flush is not necessary anymore. But it is still needed for hash TLB. Link: https://lkml.kernel.org/r/20220907180144.555485-2-shy828301@gmail.com Suggested-by: Aneesh Kumar K.V Signed-off-by: Yang Shi Acked-by: David Hildenbrand Acked-by: Peter Xu Cc: Christophe Leroy Cc: Hugh Dickins Cc: Jason Gunthorpe Cc: John Hubbard Cc: "Kirill A. Shutemov" Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- arch/powerpc/mm/book3s64/radix_pgtable.c | 9 --------- 1 file changed, 9 deletions(-) --- a/arch/powerpc/mm/book3s64/radix_pgtable.c +++ b/arch/powerpc/mm/book3s64/radix_pgtable.c @@ -954,15 +954,6 @@ pmd_t radix__pmdp_collapse_flush(struct pmd =3D *pmdp; pmd_clear(pmdp); =20 - /* - * pmdp collapse_flush need to ensure that there are no parallel gup - * walk after this call. This is needed so that we can have stable - * page ref count when collapsing a page. We don't allow a collapse page - * if we have gup taken on the page. We can ensure that by sending IPI - * because gup walk happens with IRQ disabled. - */ - serialize_against_pte_lookup(vma->vm_mm); - radix__flush_tlb_collapsed_pmd(vma->vm_mm, address); =20 return pmd; From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76215C433FE for ; Mon, 3 Oct 2022 07:26:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231161AbiJCH0R (ORCPT ); Mon, 3 Oct 2022 03:26:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230492AbiJCHXq (ORCPT ); Mon, 3 Oct 2022 03:23:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14E5346224; Mon, 3 Oct 2022 00:17:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C9B4C60FAF; Mon, 3 Oct 2022 07:17:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7AFFC433C1; Mon, 3 Oct 2022 07:17:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781448; bh=L6PUVAwizPyx4YMe0PQv6L4vBKBX2k7yjtIKYhvrJlw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JF8Uo0YxguSWNJa30GO+pCZTLls/iswh8Mr6h6BfGAEQlnEa2wHOT32vf7rnSRQIN abQ6lHiqa0i08K/s9ETz4l+0e8kNGyRVO9ofmPDHra9LiUSAs7zgGpcFcfVWVcH6m8 RrXZrk9QsxF520AQn3Rfzd9cblf5768xG78nvRso= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tvrtko Ursulin , Chris Wilson , Andi Shyti , Andrzej Hajda , Rodrigo Vivi Subject: [PATCH 5.15 23/83] drm/i915/gt: Restrict forced preemption to the active context Date: Mon, 3 Oct 2022 09:10:48 +0200 Message-Id: <20221003070722.573308617@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chris Wilson commit 6ef7d362123ecb5bf6d163bb9c7fd6ba2d8c968c upstream. When we submit a new pair of contexts to ELSP for execution, we start a timer by which point we expect the HW to have switched execution to the pending contexts. If the promotion to the new pair of contexts has not occurred, we declare the executing context to have hung and force the preemption to take place by resetting the engine and resubmitting the new contexts. This can lead to an unfair situation where almost all of the preemption timeout is consumed by the first context which just switches into the second context immediately prior to the timer firing and triggering the preemption reset (assuming that the timer interrupts before we process the CS events for the context switch). The second context hasn't yet had a chance to yield to the incoming ELSP (and send the ACk for the promotion) and so ends up being blamed for the reset. If we see that a context switch has occurred since setting the preemption timeout, but have not yet received the ACK for the ELSP promotion, rearm the preemption timer and check again. This is especially significant if the first context was not schedulable and so we used the shortest timer possible, greatly increasing the chance of accidentally blaming the second innocent context. Fixes: 3a7a92aba8fb ("drm/i915/execlists: Force preemption") Fixes: d12acee84ffb ("drm/i915/execlists: Cancel banned contexts on schedul= e-out") Reported-by: Tvrtko Ursulin Signed-off-by: Chris Wilson Cc: Tvrtko Ursulin Cc: Andi Shyti Reviewed-by: Andrzej Hajda Tested-by: Andrzej Hajda Cc: # v5.5+ Signed-off-by: Andi Shyti Link: https://patchwork.freedesktop.org/patch/msgid/20220921135258.1714873-= 1-andrzej.hajda@intel.com (cherry picked from commit 107ba1a2c705f4358f2602ec2f2fd821bb651f42) Signed-off-by: Rodrigo Vivi Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/gpu/drm/i915/gt/intel_engine_types.h | 15 +++++++++++++ drivers/gpu/drm/i915/gt/intel_execlists_submission.c | 21 ++++++++++++++= ++++- 2 files changed, 35 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/i915/gt/intel_engine_types.h +++ b/drivers/gpu/drm/i915/gt/intel_engine_types.h @@ -144,6 +144,21 @@ struct intel_engine_execlists { struct timer_list preempt; =20 /** + * @preempt_target: active request at the time of the preemption request + * + * We force a preemption to occur if the pending contexts have not + * been promoted to active upon receipt of the CS ack event within + * the timeout. This timeout maybe chosen based on the target, + * using a very short timeout if the context is no longer schedulable. + * That short timeout may not be applicable to other contexts, so + * if a context switch should happen within before the preemption + * timeout, we may shoot early at an innocent context. To prevent this, + * we record which context was active at the time of the preemption + * request and only reset that context upon the timeout. + */ + const struct i915_request *preempt_target; + + /** * @ccid: identifier for contexts submitted to this engine */ u32 ccid; --- a/drivers/gpu/drm/i915/gt/intel_execlists_submission.c +++ b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c @@ -1225,6 +1225,9 @@ static unsigned long active_preempt_time if (!rq) return 0; =20 + /* Only allow ourselves to force reset the currently active context */ + engine->execlists.preempt_target =3D rq; + /* Force a fast reset for terminated contexts (ignoring sysfs!) */ if (unlikely(intel_context_is_banned(rq->context) || bad_request(rq))) return 1; @@ -2401,8 +2404,24 @@ static void execlists_submission_tasklet GEM_BUG_ON(inactive - post > ARRAY_SIZE(post)); =20 if (unlikely(preempt_timeout(engine))) { + const struct i915_request *rq =3D *engine->execlists.active; + + /* + * If after the preempt-timeout expired, we are still on the + * same active request/context as before we initiated the + * preemption, reset the engine. + * + * However, if we have processed a CS event to switch contexts, + * but not yet processed the CS event for the pending + * preemption, reset the timer allowing the new context to + * gracefully exit. + */ cancel_timer(&engine->execlists.preempt); - engine->execlists.error_interrupt |=3D ERROR_PREEMPT; + if (rq =3D=3D engine->execlists.preempt_target) + engine->execlists.error_interrupt |=3D ERROR_PREEMPT; + else + set_timer_ms(&engine->execlists.preempt, + active_preempt_timeout(engine, rq)); } =20 if (unlikely(READ_ONCE(engine->execlists.error_interrupt))) { From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63057C433F5 for ; Mon, 3 Oct 2022 08:50:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230018AbiJCIum (ORCPT ); Mon, 3 Oct 2022 04:50:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229747AbiJCItx (ORCPT ); Mon, 3 Oct 2022 04:49:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EB941117E; Mon, 3 Oct 2022 01:32:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6815760F9D; Mon, 3 Oct 2022 07:17:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E6E5C433D6; Mon, 3 Oct 2022 07:17:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781450; bh=B85uFqG5PGDxw446Kw4DsU9bgXtwfPJOpHo43ov/VD4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u6I3ha180pyDZ6vZ6aMNGaRNp1KC1inF2s1eUSM+pZzatOD4vzJ/wox8BWkEeLt38 wX9OCXpiOqlSc64v0HYD8Ep3JiF9G+HyhTW+4dCozy9ydsoCn13w/5YSgzA1WQrQmn zMapgfhyDW5OKbpnfgFq9OFYoQGnFHiQDyp2WG44= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bokun Zhang , Alex Deucher Subject: [PATCH 5.15 24/83] drm/amdgpu: Add amdgpu suspend-resume code path under SRIOV Date: Mon, 3 Oct 2022 09:10:49 +0200 Message-Id: <20221003070722.599218245@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bokun Zhang commit 3b7329cf5a767c1be38352d43066012e220ad43c upstream. - Under SRIOV, we need to send REQ_GPU_FINI to the hypervisor during the suspend time. Furthermore, we cannot request a mode 1 reset under SRIOV as VF. Therefore, we will skip it as it is called in suspend_noirq() function. - In the resume code path, we need to send REQ_GPU_INIT to the hypervisor and also resume PSP IP block under SRIOV. Signed-off-by: Bokun Zhang Reviewed-by: Alex Deucher Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 27 ++++++++++++++++++++++++= ++- 2 files changed, 30 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c @@ -1056,6 +1056,10 @@ bool amdgpu_acpi_should_gpu_reset(struct { if (adev->flags & AMD_IS_APU) return false; + + if (amdgpu_sriov_vf(adev)) + return false; + return pm_suspend_target_state !=3D PM_SUSPEND_TO_IDLE; } =20 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -3137,7 +3137,8 @@ static int amdgpu_device_ip_resume_phase continue; if (adev->ip_blocks[i].version->type =3D=3D AMD_IP_BLOCK_TYPE_COMMON || adev->ip_blocks[i].version->type =3D=3D AMD_IP_BLOCK_TYPE_GMC || - adev->ip_blocks[i].version->type =3D=3D AMD_IP_BLOCK_TYPE_IH) { + adev->ip_blocks[i].version->type =3D=3D AMD_IP_BLOCK_TYPE_IH || + (adev->ip_blocks[i].version->type =3D=3D AMD_IP_BLOCK_TYPE_PSP && am= dgpu_sriov_vf(adev))) { =20 r =3D adev->ip_blocks[i].version->funcs->resume(adev); if (r) { @@ -4001,12 +4002,20 @@ static void amdgpu_device_evict_resource int amdgpu_device_suspend(struct drm_device *dev, bool fbcon) { struct amdgpu_device *adev =3D drm_to_adev(dev); + int r =3D 0; =20 if (dev->switch_power_state =3D=3D DRM_SWITCH_POWER_OFF) return 0; =20 adev->in_suspend =3D true; =20 + if (amdgpu_sriov_vf(adev)) { + amdgpu_virt_fini_data_exchange(adev); + r =3D amdgpu_virt_request_full_gpu(adev, false); + if (r) + return r; + } + if (amdgpu_acpi_smart_shift_update(dev, AMDGPU_SS_DEV_D3)) DRM_WARN("smart shift update failed\n"); =20 @@ -4035,6 +4044,9 @@ int amdgpu_device_suspend(struct drm_dev */ amdgpu_device_evict_resources(adev); =20 + if (amdgpu_sriov_vf(adev)) + amdgpu_virt_release_full_gpu(adev, false); + return 0; } =20 @@ -4053,6 +4065,12 @@ int amdgpu_device_resume(struct drm_devi struct amdgpu_device *adev =3D drm_to_adev(dev); int r =3D 0; =20 + if (amdgpu_sriov_vf(adev)) { + r =3D amdgpu_virt_request_full_gpu(adev, true); + if (r) + return r; + } + if (dev->switch_power_state =3D=3D DRM_SWITCH_POWER_OFF) return 0; =20 @@ -4067,6 +4085,13 @@ int amdgpu_device_resume(struct drm_devi } =20 r =3D amdgpu_device_ip_resume(adev); + + /* no matter what r is, always need to properly release full GPU */ + if (amdgpu_sriov_vf(adev)) { + amdgpu_virt_init_data_exchange(adev); + amdgpu_virt_release_full_gpu(adev, true); + } + if (r) { dev_err(adev->dev, "amdgpu_device_ip_resume failed (%d).\n", r); return r; From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE5BFC433F5 for ; Mon, 3 Oct 2022 07:25:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230473AbiJCHZV (ORCPT ); Mon, 3 Oct 2022 03:25:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230479AbiJCHXn (ORCPT ); Mon, 3 Oct 2022 03:23:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19B324AD6F; Mon, 3 Oct 2022 00:17:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B50CCB80E7B; Mon, 3 Oct 2022 07:17:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20716C433C1; Mon, 3 Oct 2022 07:17:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781453; bh=nLcfUt/LczRYhf4bCTzFSuUX5SXmRIwKX2n/XDarK+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KkZgw8JTJUYAIvR3XAtIM2VdsrwFGrG8FrzW9STIEWlfJxdrO9cbBFk1WV5qYPRMC 6J3Zl7z7DDeNoupe6T7o+hW6M22h6aUPMT7ot6GJBhWPPl3YOjjbH1dwgRyYbfFNc8 s50j8jvmq+i1voDmn08W9zShnhwiFd+5rAGZ3sww= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xie Yongji , Jason Wang , Maxime Coquelin , "Michael S. Tsirkin" , Chaitanya Kulkarni Subject: [PATCH 5.15 25/83] vduse: prevent uninitialized memory accesses Date: Mon, 3 Oct 2022 09:10:50 +0200 Message-Id: <20221003070722.625602921@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxime Coquelin commit 46f8a29272e51b6df7393d58fc5cb8967397ef2b upstream. If the VDUSE application provides a smaller config space than the driver expects, the driver may use uninitialized memory from the stack. This patch prevents it by initializing the buffer passed by the driver to store the config value. This fix addresses CVE-2022-2308. Cc: stable@vger.kernel.org # v5.15+ Fixes: c8a6153b6c59 ("vduse: Introduce VDUSE - vDPA Device in Userspace") Reviewed-by: Xie Yongji Acked-by: Jason Wang Signed-off-by: Maxime Coquelin Message-Id: <20220831154923.97809-1-maxime.coquelin@redhat.com> Signed-off-by: Michael S. Tsirkin Reviewed-by: Chaitanya Kulkarni Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/vdpa/vdpa_user/vduse_dev.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/drivers/vdpa/vdpa_user/vduse_dev.c +++ b/drivers/vdpa/vdpa_user/vduse_dev.c @@ -655,10 +655,15 @@ static void vduse_vdpa_get_config(struct { struct vduse_dev *dev =3D vdpa_to_vduse(vdpa); =20 - if (offset > dev->config_size || - len > dev->config_size - offset) + /* Initialize the buffer in case of partial copy. */ + memset(buf, 0, len); + + if (offset > dev->config_size) return; =20 + if (len > dev->config_size - offset) + len =3D dev->config_size - offset; + memcpy(buf, dev->config + offset, len); } From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C67EC433FE for ; Mon, 3 Oct 2022 07:45:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232137AbiJCHpZ (ORCPT ); Mon, 3 Oct 2022 03:45:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232265AbiJCHoB (ORCPT ); Mon, 3 Oct 2022 03:44:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D16664B9AF; Mon, 3 Oct 2022 00:25:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 75299B80E71; Mon, 3 Oct 2022 07:17:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D95C8C433C1; Mon, 3 Oct 2022 07:17:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781456; bh=Oddoo6UBftHoWQju6iQajBFBoQjhODuWFDBcjMPDH08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HsW/gc7w5Ds+jS5ag1nMEzzZ4/q6woRS5wnJj3dCTUo8P9OA+cC6uovS55iANdEbr 8DWbE6HngL+AyXKBi65jyB1z8xJmJ5TWvJ/A+dt49v3JHmtdNzyYODel3CD3wuxg/4 3IZpLtKP6E8uR/gJ5ln+YUZt5YwnpZxVRni12vhY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jaap Berkhout , Niklas Cassel , Mario Limonciello , Damien Le Moal Subject: [PATCH 5.15 26/83] libata: add ATA_HORKAGE_NOLPM for Pioneer BDR-207M and BDR-205 Date: Mon, 3 Oct 2022 09:10:51 +0200 Message-Id: <20221003070722.651594151@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Niklas Cassel commit ea08aec7e77bfd6599489ec430f9f859ab84575a upstream. Commit 1527f69204fe ("ata: ahci: Add Green Sardine vendor ID as board_ahci_mobile") added an explicit entry for AMD Green Sardine AHCI controller using the board_ahci_mobile configuration (this configuration has later been renamed to board_ahci_low_power). The board_ahci_low_power configuration enables support for low power modes. This explicit entry takes precedence over the generic AHCI controller entry, which does not enable support for low power modes. Therefore, when commit 1527f69204fe ("ata: ahci: Add Green Sardine vendor ID as board_ahci_mobile") was backported to stable kernels, it make some Pioneer optical drives, which was working perfectly fine before the commit was backported, stop working. The real problem is that the Pioneer optical drives do not handle low power modes correctly. If these optical drives would have been tested on another AHCI controller using the board_ahci_low_power configuration, this issue would have been detected earlier. Unfortunately, the board_ahci_low_power configuration is only used in less than 15% of the total AHCI controller entries, so many devices have never been tested with an AHCI controller with low power modes. Fixes: 1527f69204fe ("ata: ahci: Add Green Sardine vendor ID as board_ahci_= mobile") Cc: stable@vger.kernel.org Reported-by: Jaap Berkhout Signed-off-by: Niklas Cassel Reviewed-by: Mario Limonciello Signed-off-by: Damien Le Moal Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/ata/libata-core.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -3961,6 +3961,10 @@ static const struct ata_blacklist_entry { "PIONEER DVD-RW DVR-212D", NULL, ATA_HORKAGE_NOSETXFER }, { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER }, =20 + /* These specific Pioneer models have LPM issues */ + { "PIONEER BD-RW BDR-207M", NULL, ATA_HORKAGE_NOLPM }, + { "PIONEER BD-RW BDR-205", NULL, ATA_HORKAGE_NOLPM }, + /* Crucial BX100 SSD 500GB has broken LPM support */ { "CT500BX100SSD1", NULL, ATA_HORKAGE_NOLPM }, From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A741C4332F for ; Mon, 3 Oct 2022 08:52:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230463AbiJCIwS (ORCPT ); Mon, 3 Oct 2022 04:52:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229906AbiJCIvt (ORCPT ); Mon, 3 Oct 2022 04:51:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D45885AC65; Mon, 3 Oct 2022 01:35:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1BA9BB80E87; Mon, 3 Oct 2022 07:19:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F5ADC433C1; Mon, 3 Oct 2022 07:19:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781561; bh=XlEsKmMwMZ0trT6yuKAC/k9dEZb/s+PDZV0Hw2+rCEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2f6V+HIyGe7tAAHPDpSh0OwPJFLrc1iN+61Rdw6OHMQ0f4kwdoQ2TMw8Ugdy0iQJr zc2Jk6RDStd6huNz5P3y2of1N4SX4T9Q69AoItU+PEipyuR0/y8Eezy4NeFmg81sZ1 TcTAd8HwCWjX06CM06WuQdurF5MUyjwMBYJTkdB4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergei Antonov , Jonas Jensen , Ulf Hansson Subject: [PATCH 5.15 27/83] mmc: moxart: fix 4-bit bus width and remove 8-bit bus width Date: Mon, 3 Oct 2022 09:10:52 +0200 Message-Id: <20221003070722.679321491@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sergei Antonov commit 35ca91d1338ae158f6dcc0de5d1e86197924ffda upstream. According to the datasheet [1] at page 377, 4-bit bus width is turned on by bit 2 of the Bus Width Register. Thus the current bitmask is wrong: define BUS_WIDTH_4 BIT(1) BIT(1) does not work but BIT(2) works. This has been verified on real MOXA hardware with FTSDC010 controller revision 1_6_0. The corrected value of BUS_WIDTH_4 mask collides with: define BUS_WIDTH_8 BIT(2). Additionally, 8-bit bus width mode isn't supported according to the datasheet, so let's remove the corresponding code. [1] https://bitbucket.org/Kasreyn/mkrom-uc7112lx/src/master/documents/FIC8120_D= S_v1.2.pdf Fixes: 1b66e94e6b99 ("mmc: moxart: Add MOXA ART SD/MMC driver") Signed-off-by: Sergei Antonov Cc: Jonas Jensen Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220907205753.1577434-1-saproj@gmail.com Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/mmc/host/moxart-mmc.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) --- a/drivers/mmc/host/moxart-mmc.c +++ b/drivers/mmc/host/moxart-mmc.c @@ -111,8 +111,8 @@ #define CLK_DIV_MASK 0x7f =20 /* REG_BUS_WIDTH */ -#define BUS_WIDTH_8 BIT(2) -#define BUS_WIDTH_4 BIT(1) +#define BUS_WIDTH_4_SUPPORT BIT(3) +#define BUS_WIDTH_4 BIT(2) #define BUS_WIDTH_1 BIT(0) =20 #define MMC_VDD_360 23 @@ -524,9 +524,6 @@ static void moxart_set_ios(struct mmc_ho case MMC_BUS_WIDTH_4: writel(BUS_WIDTH_4, host->base + REG_BUS_WIDTH); break; - case MMC_BUS_WIDTH_8: - writel(BUS_WIDTH_8, host->base + REG_BUS_WIDTH); - break; default: writel(BUS_WIDTH_1, host->base + REG_BUS_WIDTH); break; @@ -651,16 +648,8 @@ static int moxart_probe(struct platform_ dmaengine_slave_config(host->dma_chan_rx, &cfg); } =20 - switch ((readl(host->base + REG_BUS_WIDTH) >> 3) & 3) { - case 1: + if (readl(host->base + REG_BUS_WIDTH) & BUS_WIDTH_4_SUPPORT) mmc->caps |=3D MMC_CAP_4_BIT_DATA; - break; - case 2: - mmc->caps |=3D MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA; - break; - default: - break; - } =20 writel(0, host->base + REG_INTERRUPT_MASK); From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0854C433FE for ; Mon, 3 Oct 2022 07:30:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231310AbiJCH37 (ORCPT ); Mon, 3 Oct 2022 03:29:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231345AbiJCH2t (ORCPT ); Mon, 3 Oct 2022 03:28:49 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6697AF587; Mon, 3 Oct 2022 00:19:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 1566BCE0B1C; Mon, 3 Oct 2022 07:18:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 262D9C433C1; Mon, 3 Oct 2022 07:17:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781480; bh=2UHdbvEr9lqpstgtuyNn+47IaQkePd+H6y1WP7Yv+1o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MrhClt9KX4TV62GmRhnRv/loQ8y7hehAZXwMgo1YMSwkvjoCa1SedFgzFhlX+8R0R ZGG/UbTcFuRvO/gKRC8/nD5tSuGKmASLtLe5+BTx4MwKlxzjY+36SQeNNyh6xdSbat QtgeOT9Gx1nSp0X5lQWNIh+e7fgDohzOLRjMjPSk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wenchao Chen , Ulf Hansson Subject: [PATCH 5.15 28/83] mmc: hsq: Fix data stomping during mmc recovery Date: Mon, 3 Oct 2022 09:10:53 +0200 Message-Id: <20221003070722.704036470@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wenchao Chen commit e7afa79a3b35a27a046a2139f8b20bd6b98155c2 upstream. The block device uses multiple queues to access emmc. There will be up to 3 requests in the hsq of the host. The current code will check whether there is a request doing recovery before entering the queue, but it will not check whether there is a request when the lock is issued. The request is in recov= ery mode. If there is a request in recovery, then a read and write request is initiated at this time, and the conflict between the request and the recove= ry request will cause the data to be trampled. Signed-off-by: Wenchao Chen Fixes: 511ce378e16f ("mmc: Add MMC host software queue support") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220916090506.10662-1-wenchao.chen666@gmai= l.com Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/mmc/host/mmc_hsq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/mmc/host/mmc_hsq.c +++ b/drivers/mmc/host/mmc_hsq.c @@ -34,7 +34,7 @@ static void mmc_hsq_pump_requests(struct spin_lock_irqsave(&hsq->lock, flags); =20 /* Make sure we are not already running a request now */ - if (hsq->mrq) { + if (hsq->mrq || hsq->recovery_halt) { spin_unlock_irqrestore(&hsq->lock, flags); return; } From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C6D4C433FE for ; Mon, 3 Oct 2022 08:35:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231388AbiJCIfo (ORCPT ); Mon, 3 Oct 2022 04:35:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231238AbiJCIfT (ORCPT ); Mon, 3 Oct 2022 04:35:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF6F96CD1B; Mon, 3 Oct 2022 01:07:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E11E760FA1; Mon, 3 Oct 2022 07:18:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F39A9C43146; Mon, 3 Oct 2022 07:18:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781510; bh=sVKJ0Eu7/YVmT6rZCHWcjoEZVUMWKnXkMKZMwTwIUI0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2baB63gC3wmVelXguPvSgvhK6cREEjKIOUcnFTufIMaIuksfYQbHp4e3v0nbirzW2 QDFmtGd8DBbghWQMXO62kVxXJF7YNpXJVcLZHQfI21h5aXcrhsoc0s9JG/v3E8qaYS oG6QQvR5cEM3pKJGFcnLdvNnKyD8KGr2QuIgF6f8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mel Gorman , Patrick Daly , Michal Hocko , David Hildenbrand , Andrew Morton Subject: [PATCH 5.15 29/83] mm/page_alloc: fix race condition between build_all_zonelists and page allocation Date: Mon, 3 Oct 2022 09:10:54 +0200 Message-Id: <20221003070722.729158772@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mel Gorman commit 3d36424b3b5850bd92f3e89b953a430d7cfc88ef upstream. Patrick Daly reported the following problem; NODE_DATA(nid)->node_zonelists[ZONELIST_FALLBACK] - before offline operati= on [0] - ZONE_MOVABLE [1] - ZONE_NORMAL [2] - NULL For a GFP_KERNEL allocation, alloc_pages_slowpath() will save the offset of ZONE_NORMAL in ac->preferred_zoneref. If a concurrent memory_offline operation removes the last page from ZONE_MOVABLE, build_all_zonelists() & build_zonerefs_node() will update node_zonelists as shown below. Only populated zones are added. NODE_DATA(nid)->node_zonelists[ZONELIST_FALLBACK] - after offline operation [0] - ZONE_NORMAL [1] - NULL [2] - NULL The race is simple -- page allocation could be in progress when a memory hot-remove operation triggers a zonelist rebuild that removes zones. The allocation request will still have a valid ac->preferred_zoneref that is now pointing to NULL and triggers an OOM kill. This problem probably always existed but may be slightly easier to trigger due to 6aa303defb74 ("mm, vmscan: only allocate and reclaim from zones with pages managed by the buddy allocator") which distinguishes between zones that are completely unpopulated versus zones that have valid pages not managed by the buddy allocator (e.g. reserved, memblock, ballooning etc). Memory hotplug had multiple stages with timing considerations around managed/present page updates, the zonelist rebuild and the zone span updates. As David Hildenbrand puts it memory offlining adjusts managed+present pages of the zone essentially in one go. If after the adjustments, the zone is no longer populated (present=3D=3D0), we rebuild the zone lists. Once that's done, we try shrinking the zone (start+spanned pages) -- which results in zone_start_pfn =3D=3D 0 if there are no more pages. That happens *after* rebuilding the zonelists via remove_pfn_range_from_zone(). The only requirement to fix the race is that a page allocation request identifies when a zonelist rebuild has happened since the allocation request started and no page has yet been allocated. Use a seqlock_t to track zonelist updates with a lockless read-side of the zonelist and protecting the rebuild and update of the counter with a spinlock. [akpm@linux-foundation.org: make zonelist_update_seq static] Link: https://lkml.kernel.org/r/20220824110900.vh674ltxmzb3proq@techsingula= rity.net Fixes: 6aa303defb74 ("mm, vmscan: only allocate and reclaim from zones with= pages managed by the buddy allocator") Signed-off-by: Mel Gorman Reported-by: Patrick Daly Acked-by: Michal Hocko Reviewed-by: David Hildenbrand Cc: [4.9+] Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- mm/page_alloc.c | 53 +++++++++++++++++++++++++++++++++++++++++++--------= -- 1 file changed, 43 insertions(+), 10 deletions(-) --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4581,6 +4581,30 @@ void fs_reclaim_release(gfp_t gfp_mask) EXPORT_SYMBOL_GPL(fs_reclaim_release); #endif =20 +/* + * Zonelists may change due to hotplug during allocation. Detect when zone= lists + * have been rebuilt so allocation retries. Reader side does not lock and + * retries the allocation if zonelist changes. Writer side is protected by= the + * embedded spin_lock. + */ +static DEFINE_SEQLOCK(zonelist_update_seq); + +static unsigned int zonelist_iter_begin(void) +{ + if (IS_ENABLED(CONFIG_MEMORY_HOTREMOVE)) + return read_seqbegin(&zonelist_update_seq); + + return 0; +} + +static unsigned int check_retry_zonelist(unsigned int seq) +{ + if (IS_ENABLED(CONFIG_MEMORY_HOTREMOVE)) + return read_seqretry(&zonelist_update_seq, seq); + + return seq; +} + /* Perform direct synchronous page reclaim */ static unsigned long __perform_reclaim(gfp_t gfp_mask, unsigned int order, @@ -4888,6 +4912,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, u int compaction_retries; int no_progress_loops; unsigned int cpuset_mems_cookie; + unsigned int zonelist_iter_cookie; int reserve_flags; =20 /* @@ -4898,11 +4923,12 @@ __alloc_pages_slowpath(gfp_t gfp_mask, u (__GFP_ATOMIC|__GFP_DIRECT_RECLAIM))) gfp_mask &=3D ~__GFP_ATOMIC; =20 -retry_cpuset: +restart: compaction_retries =3D 0; no_progress_loops =3D 0; compact_priority =3D DEF_COMPACT_PRIORITY; cpuset_mems_cookie =3D read_mems_allowed_begin(); + zonelist_iter_cookie =3D zonelist_iter_begin(); =20 /* * The fast path uses conservative alloc_flags to succeed only until @@ -5061,9 +5087,13 @@ retry: goto retry; =20 =20 - /* Deal with possible cpuset update races before we start OOM killing */ - if (check_retry_cpuset(cpuset_mems_cookie, ac)) - goto retry_cpuset; + /* + * Deal with possible cpuset update races or zonelist updates to avoid + * a unnecessary OOM kill. + */ + if (check_retry_cpuset(cpuset_mems_cookie, ac) || + check_retry_zonelist(zonelist_iter_cookie)) + goto restart; =20 /* Reclaim has failed us, start killing things */ page =3D __alloc_pages_may_oom(gfp_mask, order, ac, &did_some_progress); @@ -5083,9 +5113,13 @@ retry: } =20 nopage: - /* Deal with possible cpuset update races before we fail */ - if (check_retry_cpuset(cpuset_mems_cookie, ac)) - goto retry_cpuset; + /* + * Deal with possible cpuset update races or zonelist updates to avoid + * a unnecessary OOM kill. + */ + if (check_retry_cpuset(cpuset_mems_cookie, ac) || + check_retry_zonelist(zonelist_iter_cookie)) + goto restart; =20 /* * Make sure that __GFP_NOFAIL request doesn't leak out and make sure @@ -6367,9 +6401,8 @@ static void __build_all_zonelists(void * int nid; int __maybe_unused cpu; pg_data_t *self =3D data; - static DEFINE_SPINLOCK(lock); =20 - spin_lock(&lock); + write_seqlock(&zonelist_update_seq); =20 #ifdef CONFIG_NUMA memset(node_load, 0, sizeof(node_load)); @@ -6402,7 +6435,7 @@ static void __build_all_zonelists(void * #endif } =20 - spin_unlock(&lock); + write_sequnlock(&zonelist_update_seq); } =20 static noinline void __init From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF5EAC433FE for ; Mon, 3 Oct 2022 07:32:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231452AbiJCHce (ORCPT ); Mon, 3 Oct 2022 03:32:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231406AbiJCHbs (ORCPT ); Mon, 3 Oct 2022 03:31:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7224F4DF03; Mon, 3 Oct 2022 00:20:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7E3B860FA9; Mon, 3 Oct 2022 07:19:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F994C433C1; Mon, 3 Oct 2022 07:19:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781542; bh=gx/J8rU/fTa/VktFLUA7AZdk5eUgvudLcIK4l1h2ppM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WptnuLiaeWeUJKAhgbRLavS3ybKd1gXgPKxYr0onGLPDLl+pIe9LTe/3PC84SKP4z Ko3K0G/51+3YylrwFIEbjwxOgPxPjhMXr+aKTEoFds3A/W2RGxzaIkZflU0ei7I3r6 CWMYRHF/g1Qz6BIX0aofUvQ/E81yAl/78s85kqPM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maurizio Lombardi , Alexander Duyck , Chen Lin , Jakub Kicinski , Andrew Morton Subject: [PATCH 5.15 30/83] mm: prevent page_frag_alloc() from corrupting the memory Date: Mon, 3 Oct 2022 09:10:55 +0200 Message-Id: <20221003070722.754877734@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maurizio Lombardi commit dac22531bbd4af2426c4e29e05594415ccfa365d upstream. A number of drivers call page_frag_alloc() with a fragment's size > PAGE_SIZE. In low memory conditions, __page_frag_cache_refill() may fail the order 3 cache allocation and fall back to order 0; In this case, the cache will be smaller than the fragment, causing memory corruptions. Prevent this from happening by checking if the newly allocated cache is large enough for the fragment; if not, the allocation will fail and page_frag_alloc() will return NULL. Link: https://lkml.kernel.org/r/20220715125013.247085-1-mlombard@redhat.com Fixes: b63ae8ca096d ("mm/net: Rename and move page fragment handling from n= et/ to mm/") Signed-off-by: Maurizio Lombardi Reviewed-by: Alexander Duyck Cc: Chen Lin Cc: Jakub Kicinski Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- mm/page_alloc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5600,6 +5600,18 @@ refill: /* reset page count bias and offset to start of new frag */ nc->pagecnt_bias =3D PAGE_FRAG_CACHE_MAX_SIZE + 1; offset =3D size - fragsz; + if (unlikely(offset < 0)) { + /* + * The caller is trying to allocate a fragment + * with fragsz > PAGE_SIZE but the cache isn't big + * enough to satisfy the request, this may + * happen in low memory conditions. + * We don't release the cache page because + * it could make memory pressure worse + * so we simply return NULL here. + */ + return NULL; + } } =20 nc->pagecnt_bias--; From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D52F3C433FE for ; Mon, 3 Oct 2022 07:30:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230502AbiJCHaq (ORCPT ); Mon, 3 Oct 2022 03:30:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231462AbiJCH3L (ORCPT ); Mon, 3 Oct 2022 03:29:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91BC7B7C9; Mon, 3 Oct 2022 00:20:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A7602B80E72; Mon, 3 Oct 2022 07:19:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25580C433D7; Mon, 3 Oct 2022 07:19:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781545; bh=lpaqM68iF2A+dnBUkjIFdA/gEKCDcJqoCeNWy5/CwWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yPcOsksckQOzxq7xW473yun18FxjQnN34R48fpoQFyTZdJ7h5+jHvTzJ+wNiLQI56 mXg2pltLnyyKZOBtDx3++6G+Z3Y1N0uS+03h4gpAHmYD3EFSNHshG9DEK1lx/E/eN8 eSAl8wTfZ4Aa81OYNEEh6QLNILdt1JIPiNqn9bSw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Binyi Han , Andrew Morton , Mike Rapoport , Ammar Faizi , Hagen Paul Pfeifer , James Bottomley , Andrew Morton Subject: [PATCH 5.15 31/83] mm: fix dereferencing possible ERR_PTR Date: Mon, 3 Oct 2022 09:10:56 +0200 Message-Id: <20221003070722.780081220@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Binyi Han commit 4eb5bbde3ccb710d3b85bfb13466612e56393369 upstream. Smatch checker complains that 'secretmem_mnt' dereferencing possible ERR_PTR(). Let the function return if 'secretmem_mnt' is ERR_PTR, to avoid deferencing it. Link: https://lkml.kernel.org/r/20220904074647.GA64291@cloud-MacBookPro Fixes: 1507f51255c9f ("mm: introduce memfd_secret system call to create "se= cret" memory areas") Signed-off-by: Binyi Han Reviewed-by: Andrew Morton Cc: Mike Rapoport Cc: Ammar Faizi Cc: Hagen Paul Pfeifer Cc: James Bottomley Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- mm/secretmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/secretmem.c +++ b/mm/secretmem.c @@ -283,7 +283,7 @@ static int secretmem_init(void) =20 secretmem_mnt =3D kern_mount(&secretmem_fs); if (IS_ERR(secretmem_mnt)) - ret =3D PTR_ERR(secretmem_mnt); + return PTR_ERR(secretmem_mnt); =20 /* prevent secretmem mappings from ever getting PROT_EXEC */ secretmem_mnt->mnt_flags |=3D MNT_NOEXEC; From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 958C0C433F5 for ; Mon, 3 Oct 2022 07:31:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231434AbiJCHb0 (ORCPT ); Mon, 3 Oct 2022 03:31:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231237AbiJCH3i (ORCPT ); Mon, 3 Oct 2022 03:29:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4F685F48; Mon, 3 Oct 2022 00:20:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6A445B80E80; Mon, 3 Oct 2022 07:19:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9118AC433C1; Mon, 3 Oct 2022 07:19:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781548; bh=ZrxVxtXp/dUbfCF43tK79HuuLUoVMBvREU6yefQDcls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tg20w5kUAafDZfG3IHf1IKFuXlJyU1g1rsBPlgwb18w8HnOW05s7yztd48+hyC+qr 8aB73bL+b0git9cLwsDwOFImJASEvdJyQQ61og+q6HtDIcdTw9eCelgUIJQaUa4s4/ ZYR6WvW09hvX5v26gtqQy8ezud4Hl/RTEUH7pADY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alistair Popple , Nadav Amit , "Huang, Ying" , David Hildenbrand , Peter Xu , Alex Sierra , Ben Skeggs , Felix Kuehling , huang ying , Jason Gunthorpe , John Hubbard , Karol Herbst , Logan Gunthorpe , Lyude Paul , Matthew Wilcox , Paul Mackerras , Ralph Campbell , Andrew Morton Subject: [PATCH 5.15 32/83] mm/migrate_device.c: flush TLB while holding PTL Date: Mon, 3 Oct 2022 09:10:57 +0200 Message-Id: <20221003070722.804229905@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alistair Popple commit 60bae73708963de4a17231077285bd9ff2f41c44 upstream. When clearing a PTE the TLB should be flushed whilst still holding the PTL to avoid a potential race with madvise/munmap/etc. For example consider the following sequence: CPU0 CPU1 ---- ---- migrate_vma_collect_pmd() pte_unmap_unlock() madvise(MADV_DONTNEED) -> zap_pte_range() pte_offset_map_lock() [ PTE not present, TLB not flushed ] pte_unmap_unlock() [ page is still accessible via stale TLB ] flush_tlb_range() In this case the page may still be accessed via the stale TLB entry after madvise returns. Fix this by flushing the TLB while holding the PTL. Fixes: 8c3328f1f36a ("mm/migrate: migrate_vma() unmap page from vma while c= ollecting pages") Link: https://lkml.kernel.org/r/9f801e9d8d830408f2ca27821f606e09aa856899.16= 62078528.git-series.apopple@nvidia.com Signed-off-by: Alistair Popple Reported-by: Nadav Amit Reviewed-by: "Huang, Ying" Acked-by: David Hildenbrand Acked-by: Peter Xu Cc: Alex Sierra Cc: Ben Skeggs Cc: Felix Kuehling Cc: huang ying Cc: Jason Gunthorpe Cc: John Hubbard Cc: Karol Herbst Cc: Logan Gunthorpe Cc: Lyude Paul Cc: Matthew Wilcox Cc: Paul Mackerras Cc: Ralph Campbell Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- mm/migrate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2422,13 +2422,14 @@ next: migrate->dst[migrate->npages] =3D 0; migrate->src[migrate->npages++] =3D mpfn; } - arch_leave_lazy_mmu_mode(); - pte_unmap_unlock(ptep - 1, ptl); =20 /* Only flush the TLB if we actually modified any entries */ if (unmapped) flush_tlb_range(walk->vma, start, end); =20 + arch_leave_lazy_mmu_mode(); + pte_unmap_unlock(ptep - 1, ptl); + return 0; } From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 550D4C4332F for ; Mon, 3 Oct 2022 07:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231282AbiJCHbw (ORCPT ); Mon, 3 Oct 2022 03:31:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231363AbiJCHaP (ORCPT ); Mon, 3 Oct 2022 03:30:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0BBD193D3; Mon, 3 Oct 2022 00:20:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 54B6060FB7; Mon, 3 Oct 2022 07:19:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B8B5C433D6; Mon, 3 Oct 2022 07:19:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781550; bh=C9ZvWw+UenKB9jO9q1WUvMGaXfgYM2xRDf+wTZN8t4w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LGmgsxXoCLRSr3K1UZXWMb2DKH3XhsN3etI31ROu0fT7elrjx0Ig9E3UaIy7FTETd wl1quaqvSUvdpfMKxEX3vt1qEUGa/7pRvpUnHzeewNRyFoRjS/s9dLWXtR5cWB9ly1 v9dTU+4as3IShn8JsJks9Nxkfwxlriei8PcBvdD0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Minchan Kim , =?UTF-8?q?=E9=9F=A9=E5=A4=A9=C3=A7`=C2=95?= , Yang Shi , Andrew Morton Subject: [PATCH 5.15 33/83] mm: fix madivse_pageout mishandling on non-LRU page Date: Mon, 3 Oct 2022 09:10:58 +0200 Message-Id: <20221003070722.828061114@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Minchan Kim commit 58d426a7ba92870d489686dfdb9d06b66815a2ab upstream. MADV_PAGEOUT tries to isolate non-LRU pages and gets a warning from isolate_lru_page below. Fix it by checking PageLRU in advance. Acked-by: Yang Shi Reported-by: Linux Kernel Functional Testing Reported-by: =E9=9F=A9=E5=A4=A9=C3=A7`=C2=95 Suggested-by: Yang Shi Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee ------------[ cut here ]------------ trying to isolate tail page WARNING: CPU: 0 PID: 6175 at mm/folio-compat.c:158 isolate_lru_page+0x130/0= x140 Modules linked in: CPU: 0 PID: 6175 Comm: syz-executor.0 Not tainted 5.18.12 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1= .1 04/01/2014 RIP: 0010:isolate_lru_page+0x130/0x140 Link: https://lore.kernel.org/linux-mm/485f8c33.2471b.182d5726afb.Coremail.= hantianshuo@iie.ac.cn/ Link: https://lkml.kernel.org/r/20220908151204.762596-1-minchan@kernel.org Fixes: 1a4e58cce84e ("mm: introduce MADV_PAGEOUT") Signed-off-by: Minchan Kim Reported-by: =E9=9F=A9=E5=A4=A9=C3=A7`=C2=95 Suggested-by: Yang Shi Acked-by: Yang Shi Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/madvise.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/mm/madvise.c +++ b/mm/madvise.c @@ -436,8 +436,11 @@ regular_page: continue; } =20 - /* Do not interfere with other mappings of this page */ - if (page_mapcount(page) !=3D 1) + /* + * Do not interfere with other mappings of this page and + * non-LRU page. + */ + if (!PageLRU(page) || page_mapcount(page) !=3D 1) continue; =20 VM_BUG_ON_PAGE(PageTransCompound(page), page); From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A822C433F5 for ; Mon, 3 Oct 2022 07:45:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232210AbiJCHpm (ORCPT ); Mon, 3 Oct 2022 03:45:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232329AbiJCHoM (ORCPT ); Mon, 3 Oct 2022 03:44:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DE1757563; Mon, 3 Oct 2022 00:25:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CAF4FB80E7F; Mon, 3 Oct 2022 07:19:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3ABD1C433D6; Mon, 3 Oct 2022 07:19:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781553; bh=HSFhtvXCo+irCMXGqTF2j6qoYuSJB/k0Y30uNtW1jEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dcojaH9TaM9P8ZtldWYB4gQqkA3hnKX6Tme6U4biQI0px7hPASXyOg2OY6B6RG6TJ V3CXU56+wzgOc2WXL6yj/7jYYj9QR+KtEVWVjmWEcm1OiNb8rEOnYxcaKupjP3Em6l YvkIGp+GiGCPCX+56IZKTgGSMKazcaZDXfUNqybQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuai Xue , Miaohe Lin , Naoya Horiguchi , Huang Ying , Baolin Wang , Bixuan Cui , Andrew Morton Subject: [PATCH 5.15 34/83] mm,hwpoison: check mm when killing accessing process Date: Mon, 3 Oct 2022 09:10:59 +0200 Message-Id: <20221003070722.852051421@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shuai Xue commit 77677cdbc2aa4b5d5d839562793d3d126201d18d upstream. The GHES code calls memory_failure_queue() from IRQ context to queue work into workqueue and schedule it on the current CPU. Then the work is processed in memory_failure_work_func() by kworker and calls memory_failure(). When a page is already poisoned, commit a3f5d80ea401 ("mm,hwpoison: send SIGBUS with error virutal address") make memory_failure() call kill_accessing_process() that: - holds mmap locking of current->mm - does pagetable walk to find the error virtual address - and sends SIGBUS to the current process with error info. However, the mm of kworker is not valid, resulting in a null-pointer dereference. So check mm when killing the accessing process. [akpm@linux-foundation.org: remove unrelated whitespace alteration] Link: https://lkml.kernel.org/r/20220914064935.7851-1-xueshuai@linux.alibab= a.com Fixes: a3f5d80ea401 ("mm,hwpoison: send SIGBUS with error virutal address") Signed-off-by: Shuai Xue Reviewed-by: Miaohe Lin Acked-by: Naoya Horiguchi Cc: Huang Ying Cc: Baolin Wang Cc: Bixuan Cui Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- mm/memory-failure.c | 3 +++ 1 file changed, 3 insertions(+) --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -700,6 +700,9 @@ static int kill_accessing_process(struct }; priv.tk.tsk =3D p; =20 + if (!p->mm) + return -EFAULT; + mmap_read_lock(p->mm); ret =3D walk_page_range(p->mm, 0, TASK_SIZE, &hwp_walk_ops, (void *)&priv); From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31F9CC4332F for ; Mon, 3 Oct 2022 07:32:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230513AbiJCHcM (ORCPT ); Mon, 3 Oct 2022 03:32:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230140AbiJCHbB (ORCPT ); Mon, 3 Oct 2022 03:31:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8AEB39B9A; Mon, 3 Oct 2022 00:20:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 96411B80E8F; Mon, 3 Oct 2022 07:19:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5EA5C433C1; Mon, 3 Oct 2022 07:19:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781556; bh=C3YAV3lrI8QAUFa6ta1NH/nFMDR6H6EJh8SGAbeV0q0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GkCosw6mUqs17qtqur8Gk7O5j+bitWPu/xBPKe0lSz8g8f2AhY5ZrJrVJ6rcia1R7 JrU/GQj7D8wHJNerBaR0GiTRKfO80rgEzE1b8jWFwPNLqmDG+KVxuFdHTbCrmvW6S4 I1EGNaw7uH31fHwUUfP0tyZFyncvKiyhQIT5470A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , Sergey Senozhatsky , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.15 35/83] media: dvb_vb2: fix possible out of bound access Date: Mon, 3 Oct 2022 09:11:00 +0200 Message-Id: <20221003070722.877315558@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hangyu Hua commit 37238699073e7e93f05517e529661151173cd458 upstream. vb2_core_qbuf and vb2_core_querybuf don't check the range of b->index controlled by the user. Fix this by adding range checking code before using them. Fixes: 57868acc369a ("media: videobuf2: Add new uAPI for DVB streaming I/O") Signed-off-by: Hangyu Hua Reviewed-by: Sergey Senozhatsky Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/media/dvb-core/dvb_vb2.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/drivers/media/dvb-core/dvb_vb2.c +++ b/drivers/media/dvb-core/dvb_vb2.c @@ -358,6 +358,12 @@ int dvb_vb2_reqbufs(struct dvb_vb2_ctx * =20 int dvb_vb2_querybuf(struct dvb_vb2_ctx *ctx, struct dmx_buffer *b) { + struct vb2_queue *q =3D &ctx->vb_q; + + if (b->index >=3D q->num_buffers) { + dprintk(1, "[%s] buffer index out of range\n", ctx->name); + return -EINVAL; + } vb2_core_querybuf(&ctx->vb_q, b->index, b); dprintk(3, "[%s] index=3D%d\n", ctx->name, b->index); return 0; @@ -382,8 +388,13 @@ int dvb_vb2_expbuf(struct dvb_vb2_ctx *c =20 int dvb_vb2_qbuf(struct dvb_vb2_ctx *ctx, struct dmx_buffer *b) { + struct vb2_queue *q =3D &ctx->vb_q; int ret; =20 + if (b->index >=3D q->num_buffers) { + dprintk(1, "[%s] buffer index out of range\n", ctx->name); + return -EINVAL; + } ret =3D vb2_core_qbuf(&ctx->vb_q, b->index, b, NULL); if (ret) { dprintk(1, "[%s] index=3D%d errno=3D%d\n", ctx->name, From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D55DDC433F5 for ; Mon, 3 Oct 2022 07:33:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231503AbiJCHdI (ORCPT ); Mon, 3 Oct 2022 03:33:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231501AbiJCHcf (ORCPT ); Mon, 3 Oct 2022 03:32:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 451E24DF38; Mon, 3 Oct 2022 00:21:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 38E6DB80E90; Mon, 3 Oct 2022 07:19:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D040C433C1; Mon, 3 Oct 2022 07:19:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781558; bh=bLvLAYpSrTFfe7GvDq+4us9MRoQncBYlB1SEYr38dPU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BZwIlliDb0ifwulFXDOeGPWCQMZv1aZVh/HGeUdNFU8ixPucTf8tyGozsN2FWGJjz xQJSKen1tLHiuKB/ARyWuTww4ANUqWm4YALgTRcI0L2CguHCPZ2UBu0dHpK8sopqiL dRP/lQZjs6XaR7WOka8A8AgCTAJoWO9/0c4Znr6M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Dufresne , Brian Norris , Ezequiel Garcia , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.15 36/83] media: rkvdec: Disable H.264 error detection Date: Mon, 3 Oct 2022 09:11:01 +0200 Message-Id: <20221003070722.901877992@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nicolas Dufresne commit 3a99c4474112f49a5459933d8758614002ca0ddc upstream. Quite often, the HW get stuck in error condition if a stream error was detected. As documented, the HW should stop immediately and self reset. There is likely a problem or a miss-understanding of the self reset mechanism, as unless we make a long pause, the next command will then report an error even if there is no error in it. Disabling error detection fixes the issue, and let the decoder continue after an error. This patch is safe for backport into older kernels. Fixes: cd33c830448b ("media: rkvdec: Add the rkvdec driver") Signed-off-by: Nicolas Dufresne Reviewed-by: Brian Norris Tested-by: Brian Norris Reviewed-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/staging/media/rkvdec/rkvdec-h264.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/staging/media/rkvdec/rkvdec-h264.c +++ b/drivers/staging/media/rkvdec/rkvdec-h264.c @@ -1124,8 +1124,8 @@ static int rkvdec_h264_run(struct rkvdec =20 schedule_delayed_work(&rkvdec->watchdog_work, msecs_to_jiffies(2000)); =20 - writel(0xffffffff, rkvdec->regs + RKVDEC_REG_STRMD_ERR_EN); - writel(0xffffffff, rkvdec->regs + RKVDEC_REG_H264_ERR_E); + writel(0, rkvdec->regs + RKVDEC_REG_STRMD_ERR_EN); + writel(0, rkvdec->regs + RKVDEC_REG_H264_ERR_E); writel(1, rkvdec->regs + RKVDEC_REG_PREF_LUMA_CACHE_COMMAND); writel(1, rkvdec->regs + RKVDEC_REG_PREF_CHR_CACHE_COMMAND); From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F001C433F5 for ; Mon, 3 Oct 2022 07:35:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231577AbiJCHfh (ORCPT ); Mon, 3 Oct 2022 03:35:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231778AbiJCHe2 (ORCPT ); Mon, 3 Oct 2022 03:34:28 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4EAC52DFC; Mon, 3 Oct 2022 00:22:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id E07C1CE0B19; Mon, 3 Oct 2022 07:18:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2581C433C1; Mon, 3 Oct 2022 07:18:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781483; bh=V38LlX0q8zKlpeuuZ8af615SwKazMoTeMAv5NP354dE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nvKew4cJ+tK3rkbqstBDJNsdc2a4jAsqPPIuFYBCqoRIEOn/bbTBbbN8bsg4wYR8C AOauNAb6SvBKDa5OA2knGzSJA5dJ2ebMZ/FmhrJvOufd6j85mxeNjgtkD/3kVXs0TD y5inYD4JQprBHxtc69ayzb5q1+riX3l/RP0ovRe8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans Verkuil , syzbot+ff18193ff05f3f87f226@syzkaller.appspotmail.com, Laurent Pinchart , Mauro Carvalho Chehab Subject: [PATCH 5.15 37/83] media: v4l2-compat-ioctl32.c: zero buffer passed to v4l2_compat_get_array_args() Date: Mon, 3 Oct 2022 09:11:02 +0200 Message-Id: <20221003070722.926248909@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans Verkuil commit 4e768c8e34e639cff66a0f175bc4aebf472e4305 upstream. The v4l2_compat_get_array_args() function can leave uninitialized memory in= the buffer it is passed. So zero it before copying array elements from userspace into the buffer. Signed-off-by: Hans Verkuil Reported-by: syzbot+ff18193ff05f3f87f226@syzkaller.appspotmail.com Reviewed-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c @@ -1033,6 +1033,8 @@ int v4l2_compat_get_array_args(struct fi { int err =3D 0; =20 + memset(mbuf, 0, array_size); + switch (cmd) { case VIDIOC_G_FMT32: case VIDIOC_S_FMT32: From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80983C433FE for ; Mon, 3 Oct 2022 07:29:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231299AbiJCH3x (ORCPT ); Mon, 3 Oct 2022 03:29:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231295AbiJCH2m (ORCPT ); Mon, 3 Oct 2022 03:28:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80B7E657A; Mon, 3 Oct 2022 00:19:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 34839B80E81; Mon, 3 Oct 2022 07:18:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9CCFFC433C1; Mon, 3 Oct 2022 07:18:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781486; bh=16kv6EE0M1hk+TTangBFeVgAF2owVYJ/Tjd+2RcjAks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=helOcA+7QYg70lyd3fTjN13WqAZH4+Pneg4myPPiAOn6X8Yse15gaaHbVf44XP8Kp SIJf+ug2hXZTk41UKEP8vIer8TBslav5B5qj0jB/VwY8zum5yuq2VXldBbS6O0NWpq f1lbETIU1BzYevkD/knssPProGM5AYdA/z+u1Fjo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tianyu Lan , Christoph Hellwig , Rishabh Bhatnagar Subject: [PATCH 5.15 38/83] swiotlb: max mapping size takes min align mask into account Date: Mon, 3 Oct 2022 09:11:03 +0200 Message-Id: <20221003070722.955669891@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tianyu Lan commit 82806744fd7dde603b64c151eeddaa4ee62193fd upstream. swiotlb_find_slots() skips slots according to io tlb aligned mask calculated from min aligned mask and original physical address offset. This affects max mapping size. The mapping size can't achieve the IO_TLB_SEGSIZE * IO_TLB_SIZE when original offset is non-zero. This will cause system boot up failure in Hyper-V Isolation VM where swiotlb force is enabled. Scsi layer use return value of dma_max_mapping_size() to set max segment size and it finally calls swiotlb_max_mapping_size(). Hyper-V storage driver sets min align mask to 4k - 1. Scsi layer may pass 256k length of request buffer with 0~4k offset and Hyper-V storage driver can't get swiotlb bounce buffer via DMA API. Swiotlb_find_slots() can't find 256k length bounce buffer with offset. Make swiotlb_max_mapping _size() take min align mask into account. Signed-off-by: Tianyu Lan Signed-off-by: Christoph Hellwig Signed-off-by: Rishabh Bhatnagar Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- kernel/dma/swiotlb.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -709,7 +709,18 @@ dma_addr_t swiotlb_map(struct device *de =20 size_t swiotlb_max_mapping_size(struct device *dev) { - return ((size_t)IO_TLB_SIZE) * IO_TLB_SEGSIZE; + int min_align_mask =3D dma_get_min_align_mask(dev); + int min_align =3D 0; + + /* + * swiotlb_find_slots() skips slots according to + * min align mask. This affects max mapping size. + * Take it into acount here. + */ + if (min_align_mask) + min_align =3D roundup(min_align_mask, IO_TLB_SIZE); + + return ((size_t)IO_TLB_SIZE) * IO_TLB_SEGSIZE - min_align; } =20 bool is_swiotlb_active(struct device *dev) From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB145C433FE for ; Mon, 3 Oct 2022 07:25:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230519AbiJCHZw (ORCPT ); Mon, 3 Oct 2022 03:25:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231234AbiJCHYL (ORCPT ); Mon, 3 Oct 2022 03:24:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 130B44B0C5; Mon, 3 Oct 2022 00:18:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F17EBB80E87; Mon, 3 Oct 2022 07:18:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59CCBC433C1; Mon, 3 Oct 2022 07:18:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781488; bh=5KSAcG/qU362gXaZQ0XE94NSWFx5aAUveIMPKMStqtE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CMcqw2JR5KyOOJXnYxaccKd+aXam/XvroIap+z9AMRGrMN97WV8uQmgYC3bkSCqrx KMonW5g/V77D6RK/h5SdAlYsWHSXt9nfaHsJic/oLEOPJ0MR7njCwttR/C4A0ZqN0k xIDsd/nPqWc+GtKTuXzkmfABm7TDwp0GiMjNX1g8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YuTong Chang , Krzysztof Kozlowski , Tony Lindgren , Sasha Levin Subject: [PATCH 5.15 39/83] ARM: dts: am33xx: Fix MMCHS0 dma properties Date: Mon, 3 Oct 2022 09:11:04 +0200 Message-Id: <20221003070722.979706612@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: YuTong Chang [ Upstream commit 2eb502f496f7764027b7958d4e74356fed918059 ] According to technical manual(table 11-24), the DMA of MMCHS0 should be direct mapped. Fixes: b5e509066074 ("ARM: DTS: am33xx: Use the new DT bindings for the eDM= A3") Signed-off-by: YuTong Chang Message-Id: <20220620124146.5330-1-mtwget@gmail.com> Acked-by: Krzysztof Kozlowski Signed-off-by: Tony Lindgren Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- arch/arm/boot/dts/am33xx-l4.dtsi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/am33xx-l4.dtsi b/arch/arm/boot/dts/am33xx-l4= .dtsi index c9629cb5ccd1..9a750883b987 100644 --- a/arch/arm/boot/dts/am33xx-l4.dtsi +++ b/arch/arm/boot/dts/am33xx-l4.dtsi @@ -1500,8 +1500,7 @@ mmc1: mmc@0 { compatible =3D "ti,am335-sdhci"; ti,needs-special-reset; - dmas =3D <&edma_xbar 24 0 0 - &edma_xbar 25 0 0>; + dmas =3D <&edma 24 0>, <&edma 25 0>; dma-names =3D "tx", "rx"; interrupts =3D <64>; reg =3D <0x0 0x1000>; --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 567C3C4332F for ; Mon, 3 Oct 2022 07:29:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231274AbiJCH3s (ORCPT ); Mon, 3 Oct 2022 03:29:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231293AbiJCH2m (ORCPT ); Mon, 3 Oct 2022 03:28:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 808756558; Mon, 3 Oct 2022 00:19:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B6406B80E83; Mon, 3 Oct 2022 07:18:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1697AC433C1; Mon, 3 Oct 2022 07:18:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781491; bh=q4QHpmaaAtyn9aGU+5Hj6gU92GcrlTjqLaYaAGTdoRs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u9yPgHoXkzR1EIPKAEoG0xd8EhY5qQFZaLsFg3RGbgj3RfsRfixQh3GmHIKoSpOEP XmZYqQKz/PxofSxppZyySpgHL+pnpChRz/Z2XZKDaMNi5Ly2pcmGEB7kWyE4wEw6KJ UjZqI9VRD7GNVKnPbEqXnD9bdf8misBwKgW3b62U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Zhu , Philipp Zabel , Marek Vasut , Richard Leitner , Alexander Stein , Sasha Levin Subject: [PATCH 5.15 40/83] reset: imx7: Fix the iMX8MP PCIe PHY PERST support Date: Mon, 3 Oct 2022 09:11:05 +0200 Message-Id: <20221003070723.003755296@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Richard Zhu [ Upstream commit 051d9eb403887bb11852b7a4f744728a6a4b1b58 ] On i.MX7/iMX8MM/iMX8MQ, the initialized default value of PERST bit(BIT3) of SRC_PCIEPHY_RCR is 1b'1. But i.MX8MP has one inversed default value 1b'0 of PERST bit. And the PERST bit should be kept 1b'1 after power and clocks are stable. So fix the i.MX8MP PCIe PHY PERST support here. Fixes: e08672c03981 ("reset: imx7: Add support for i.MX8MP SoC") Signed-off-by: Richard Zhu Reviewed-by: Philipp Zabel Tested-by: Marek Vasut Tested-by: Richard Leitner Tested-by: Alexander Stein Signed-off-by: Philipp Zabel Link: https://lore.kernel.org/r/1661845564-11373-5-git-send-email-hongxing.= zhu@nxp.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/reset/reset-imx7.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/reset/reset-imx7.c b/drivers/reset/reset-imx7.c index 185a333df66c..d2408725eb2c 100644 --- a/drivers/reset/reset-imx7.c +++ b/drivers/reset/reset-imx7.c @@ -329,6 +329,7 @@ static int imx8mp_reset_set(struct reset_controller_dev= *rcdev, break; =20 case IMX8MP_RESET_PCIE_CTRL_APPS_EN: + case IMX8MP_RESET_PCIEPHY_PERST: value =3D assert ? 0 : bit; break; } --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 133A8C433FE for ; Mon, 3 Oct 2022 07:30:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231325AbiJCHaC (ORCPT ); Mon, 3 Oct 2022 03:30:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231351AbiJCH2t (ORCPT ); Mon, 3 Oct 2022 03:28:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 311B514000; Mon, 3 Oct 2022 00:19:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9604360FAF; Mon, 3 Oct 2022 07:18:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADE27C433C1; Mon, 3 Oct 2022 07:18:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781494; bh=UJ1ZSCsoX9pendbzzQIvsRKKNW92EBDO2PZe5B4PXY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rLRVpwsLErwgF7zWIn0Qvm7EBC3zSawAVjsKT03hRB0G7Vi/UHOoTN5Hg3GhLZifB 909gG+11aaOZcfmr2Pf04tEpP9pbsufi3ogDYXP3dR7zVdDza00tS5+buAxF+fC+Il xE5zdhHp0h6UiRNJzoDx2qhSR7ofCnMZxiwEAxSA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Romain Naour , Romain Naour , Roger Quadros , Tony Lindgren , Sasha Levin Subject: [PATCH 5.15 41/83] ARM: dts: am5748: keep usb4_tm disabled Date: Mon, 3 Oct 2022 09:11:06 +0200 Message-Id: <20221003070723.027993607@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Romain Naour [ Upstream commit 6a6d9ecff14a2a46c1deeffa3eb3825349639bdd ] Commit bcbb63b80284 ("ARM: dts: dra7: Separate AM57 dtsi files") disabled usb4_tm for am5748 devices since USB4 IP is not present in this SoC. The commit log explained the difference between AM5 and DRA7 families: AM5 and DRA7 SoC families have different set of modules in them so the SoC sepecific dtsi files need to be separated. e.g. Some of the major differences between AM576 and DRA76 DRA76x AM576x USB3 x USB4 x ATL x VCP x MLB x ISS x PRU-ICSS1 x PRU-ICSS2 x Then commit 176f26bcd41a ("ARM: dts: Add support for dra762 abz package") removed usb4_tm part from am5748.dtsi and introcuded new ti-sysc errors in dmesg: ti-sysc 48940000.target-module: clock get error for fck: -2 ti-sysc: probe of 48940000.target-module failed with error -2 Fixes: 176f26bcd41a ("ARM: dts: Add support for dra762 abz package") Signed-off-by: Romain Naour Signed-off-by: Romain Naour Message-Id: <20220823072742.351368-1-romain.naour@smile.fr> Reviewed-by: Roger Quadros Signed-off-by: Tony Lindgren Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- arch/arm/boot/dts/am5748.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/boot/dts/am5748.dtsi b/arch/arm/boot/dts/am5748.dtsi index c260aa1a85bd..a1f029e9d1f3 100644 --- a/arch/arm/boot/dts/am5748.dtsi +++ b/arch/arm/boot/dts/am5748.dtsi @@ -25,6 +25,10 @@ status =3D "disabled"; }; =20 +&usb4_tm { + status =3D "disabled"; +}; + &atl_tm { status =3D "disabled"; }; --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03B5FC433F5 for ; Mon, 3 Oct 2022 07:26:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230527AbiJCHZ5 (ORCPT ); Mon, 3 Oct 2022 03:25:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231236AbiJCHYL (ORCPT ); Mon, 3 Oct 2022 03:24:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8904A4BD2D; Mon, 3 Oct 2022 00:18:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EF911B80E68; Mon, 3 Oct 2022 07:18:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A06CC433D6; Mon, 3 Oct 2022 07:18:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781496; bh=GIa/ywVO2XB/e222LZ6asiJgZvNdn/pfullDpwnyQE4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LJAmhWWe37Agp58HuSNw02bmsScQrG59i5KGxXDYfQ1IJfw74i3fFoJMdny77c3ol ck892xmyNSiZfte7qE4/QwAzHEzi6dFKTXLQOSA+btVwzLX/8lC8VC5foL0mxzyfJK madycVr9kXuYd7ntZilz0KdDnKcPiLtjgJjBKK3M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jernej Skrabec , Samuel Holland , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.15 42/83] soc: sunxi: sram: Actually claim SRAM regions Date: Mon, 3 Oct 2022 09:11:07 +0200 Message-Id: <20221003070723.051867194@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Samuel Holland [ Upstream commit fd362baad2e659ef0fb5652f023a606b248f1781 ] sunxi_sram_claim() checks the sram_desc->claimed flag before updating the register, with the intent that only one device can claim a region. However, this was ineffective because the flag was never set. Fixes: 4af34b572a85 ("drivers: soc: sunxi: Introduce SoC driver to map SRAM= s") Reviewed-by: Jernej Skrabec Signed-off-by: Samuel Holland Reviewed-by: Heiko Stuebner Tested-by: Heiko Stuebner Signed-off-by: Jernej Skrabec Link: https://lore.kernel.org/r/20220815041248.53268-4-samuel@sholland.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/soc/sunxi/sunxi_sram.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c index 42833e33a96c..20b5d38e6da8 100644 --- a/drivers/soc/sunxi/sunxi_sram.c +++ b/drivers/soc/sunxi/sunxi_sram.c @@ -254,6 +254,7 @@ int sunxi_sram_claim(struct device *dev) writel(val | ((device << sram_data->offset) & mask), base + sram_data->reg); =20 + sram_desc->claimed =3D true; spin_unlock(&sram_lock); =20 return 0; --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61FFFC433F5 for ; Mon, 3 Oct 2022 07:27:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231206AbiJCH1J (ORCPT ); Mon, 3 Oct 2022 03:27:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230463AbiJCHZQ (ORCPT ); Mon, 3 Oct 2022 03:25:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FC564BD09; Mon, 3 Oct 2022 00:18:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D71C960FB6; Mon, 3 Oct 2022 07:18:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9F66C433D6; Mon, 3 Oct 2022 07:18:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781499; bh=e/w8t1fK9RfuxqU3rq65AWjAzC+JxuL7MvWCo2+Hd7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RM30Vn/YyEtjkb3bMA6gX00wOAMn981smzmvWoSlQ4wfT730L9SwpdYoqWzJi/TfH G60e1/bFYUzDLXm3Tl3xX/lXESp18A1dYuPGkU3troCk+FnSFioxlAl/oXaFFbLczR nTUjyxbdGtjUF6UvPx3gxYRX/uVD8+UOUEperRoI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jernej Skrabec , Samuel Holland , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.15 43/83] soc: sunxi: sram: Prevent the driver from being unbound Date: Mon, 3 Oct 2022 09:11:08 +0200 Message-Id: <20221003070723.076001638@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Samuel Holland [ Upstream commit 90e10a1fcd9b24b4ba8c0d35136127473dcd829e ] This driver exports a regmap tied to the platform device (as opposed to a syscon, which exports a regmap tied to the OF node). Because of this, the driver can never be unbound, as that would destroy the regmap. Use builtin_platform_driver_probe() to enforce this limitation. Fixes: 5828729bebbb ("soc: sunxi: export a regmap for EMAC clock reg on A64= ") Reviewed-by: Jernej Skrabec Signed-off-by: Samuel Holland Reviewed-by: Heiko Stuebner Tested-by: Heiko Stuebner Signed-off-by: Jernej Skrabec Link: https://lore.kernel.org/r/20220815041248.53268-5-samuel@sholland.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/soc/sunxi/sunxi_sram.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c index 20b5d38e6da8..852f0872f669 100644 --- a/drivers/soc/sunxi/sunxi_sram.c +++ b/drivers/soc/sunxi/sunxi_sram.c @@ -330,7 +330,7 @@ static struct regmap_config sunxi_sram_emac_clock_regma= p =3D { .writeable_reg =3D sunxi_sram_regmap_accessible_reg, }; =20 -static int sunxi_sram_probe(struct platform_device *pdev) +static int __init sunxi_sram_probe(struct platform_device *pdev) { struct resource *res; struct dentry *d; @@ -412,9 +412,8 @@ static struct platform_driver sunxi_sram_driver =3D { .name =3D "sunxi-sram", .of_match_table =3D sunxi_sram_dt_match, }, - .probe =3D sunxi_sram_probe, }; -module_platform_driver(sunxi_sram_driver); +builtin_platform_driver_probe(sunxi_sram_driver, sunxi_sram_probe); =20 MODULE_AUTHOR("Maxime Ripard "); MODULE_DESCRIPTION("Allwinner sunXi SRAM Controller Driver"); --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7D8EC433F5 for ; Mon, 3 Oct 2022 07:36:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231620AbiJCHf7 (ORCPT ); Mon, 3 Oct 2022 03:35:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231814AbiJCHec (ORCPT ); Mon, 3 Oct 2022 03:34:32 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E03C149B62; Mon, 3 Oct 2022 00:22:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id B0BB4CE0B1D; Mon, 3 Oct 2022 07:18:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3F9CC433D6; Mon, 3 Oct 2022 07:18:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781502; bh=srxjzZY5EJ0HE8zdc1BQ/dfSOD/R+nPgAYhcyFjvujU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=av2mET+IhhAdG7gPHnLcKKcFCB+D9fKw36RZ+R30HLr5Lf9b/57qo3MgXROr5eiNQ yuEc6M94naUUkMV80GY4/rt6IIhyJSLhHNd5QNfvdDFCo/sb+5zoCKvQSSEcSnC7nO 1MVkL89afjhQ6a+Es9dHc/EoiYYyJqm8XT/dTbW4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cai Huoqing , Maxime Ripard , Sasha Levin Subject: [PATCH 5.15 44/83] soc: sunxi_sram: Make use of the helper function devm_platform_ioremap_resource() Date: Mon, 3 Oct 2022 09:11:09 +0200 Message-Id: <20221003070723.098373805@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Cai Huoqing [ Upstream commit 1f3753a5f042fea6539986f9caf2552877527d8a ] Use the devm_platform_ioremap_resource() helper instead of calling platform_get_resource() and devm_ioremap_resource() separately Signed-off-by: Cai Huoqing Signed-off-by: Maxime Ripard Link: https://lore.kernel.org/r/20210908071716.772-1-caihuoqing@baidu.com Stable-dep-of: 49fad91a7b89 ("soc: sunxi: sram: Fix probe function ordering= issues") Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/soc/sunxi/sunxi_sram.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c index 852f0872f669..a858a37fcdd4 100644 --- a/drivers/soc/sunxi/sunxi_sram.c +++ b/drivers/soc/sunxi/sunxi_sram.c @@ -332,7 +332,6 @@ static struct regmap_config sunxi_sram_emac_clock_regma= p =3D { =20 static int __init sunxi_sram_probe(struct platform_device *pdev) { - struct resource *res; struct dentry *d; struct regmap *emac_clock; const struct sunxi_sramc_variant *variant; @@ -343,8 +342,7 @@ static int __init sunxi_sram_probe(struct platform_devi= ce *pdev) if (!variant) return -EINVAL; =20 - res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); - base =3D devm_ioremap_resource(&pdev->dev, res); + base =3D devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(base)) return PTR_ERR(base); =20 --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04573C433FE for ; Mon, 3 Oct 2022 08:19:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229593AbiJCITB (ORCPT ); Mon, 3 Oct 2022 04:19:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230295AbiJCISg (ORCPT ); Mon, 3 Oct 2022 04:18:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCB5E1C124; Mon, 3 Oct 2022 00:53:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7192560F9B; Mon, 3 Oct 2022 07:18:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76DABC433B5; Mon, 3 Oct 2022 07:18:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781504; bh=tb0bQpnUQ+TPZ2/ugxZ8lhm5RCQjTZugfa0mWmPiO8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WBDnC7Gm3CI0fZRMFZPsjR1iy1+LibFTnwx4k4mM6iRhbmt3PwkWQ5SBtD+z5gGDk BHjTFUWMDo1FcPg7rFf88BSQ+apeUR5Ok0nCumh/0I3nSVA9l1Fxp+aINXUqucrC4K 3kZ05PtXAzshqNDVdxhK3zagycTwIeaD26yzw7cA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jernej Skrabec , Samuel Holland , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.15 45/83] soc: sunxi: sram: Fix probe function ordering issues Date: Mon, 3 Oct 2022 09:11:10 +0200 Message-Id: <20221003070723.122239167@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Samuel Holland [ Upstream commit 49fad91a7b8941979c3e9a35f9894ac45bc5d3d6 ] Errors from debugfs are intended to be non-fatal, and should not prevent the driver from probing. Since debugfs file creation is treated as infallible, move it below the parts of the probe function that can fail. This prevents an error elsewhere in the probe function from causing the file to leak. Do the same for the call to of_platform_populate(). Finally, checkpatch suggests an octal literal for the file permissions. Fixes: 4af34b572a85 ("drivers: soc: sunxi: Introduce SoC driver to map SRAM= s") Fixes: 5828729bebbb ("soc: sunxi: export a regmap for EMAC clock reg on A64= ") Reviewed-by: Jernej Skrabec Signed-off-by: Samuel Holland Tested-by: Heiko Stuebner Signed-off-by: Jernej Skrabec Link: https://lore.kernel.org/r/20220815041248.53268-6-samuel@sholland.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/soc/sunxi/sunxi_sram.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c index a858a37fcdd4..52d07bed7664 100644 --- a/drivers/soc/sunxi/sunxi_sram.c +++ b/drivers/soc/sunxi/sunxi_sram.c @@ -332,9 +332,9 @@ static struct regmap_config sunxi_sram_emac_clock_regma= p =3D { =20 static int __init sunxi_sram_probe(struct platform_device *pdev) { - struct dentry *d; struct regmap *emac_clock; const struct sunxi_sramc_variant *variant; + struct device *dev =3D &pdev->dev; =20 sram_dev =3D &pdev->dev; =20 @@ -346,13 +346,6 @@ static int __init sunxi_sram_probe(struct platform_dev= ice *pdev) if (IS_ERR(base)) return PTR_ERR(base); =20 - of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); - - d =3D debugfs_create_file("sram", S_IRUGO, NULL, NULL, - &sunxi_sram_fops); - if (!d) - return -ENOMEM; - if (variant->num_emac_clocks > 0) { emac_clock =3D devm_regmap_init_mmio(&pdev->dev, base, &sunxi_sram_emac_clock_regmap); @@ -361,6 +354,10 @@ static int __init sunxi_sram_probe(struct platform_dev= ice *pdev) return PTR_ERR(emac_clock); } =20 + of_platform_populate(dev->of_node, NULL, NULL, dev); + + debugfs_create_file("sram", 0444, NULL, NULL, &sunxi_sram_fops); + return 0; } =20 --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A24EC433F5 for ; Mon, 3 Oct 2022 07:30:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231404AbiJCHaa (ORCPT ); Mon, 3 Oct 2022 03:30:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231417AbiJCH3F (ORCPT ); Mon, 3 Oct 2022 03:29:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85AB917592; Mon, 3 Oct 2022 00:19:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DFE20B80E8A; Mon, 3 Oct 2022 07:18:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42E4FC433D7; Mon, 3 Oct 2022 07:18:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781507; bh=rbGALLdGpMoXn3faPKL8k519MdGxpF/HHBObKz4rX/Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ii6xqogbUcOnkAgRMuie84Jyk47LKE8p91IJzn0vERb6DL2OH2wzT8xMhucal5O/d OlKlMIaboCI6eNAy+8njaqbm4AC6mLq4pTLZEGJDg3Y1B+Etg9ZyNq4vVuHpAoHUEP 1Hpv8YaJHNXirZqorKhnSZ8YkpHbYkJB0OXezPa8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jernej Skrabec , Samuel Holland , Sasha Levin Subject: [PATCH 5.15 46/83] soc: sunxi: sram: Fix debugfs info for A64 SRAM C Date: Mon, 3 Oct 2022 09:11:11 +0200 Message-Id: <20221003070723.148776309@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Samuel Holland [ Upstream commit e3c95edb1bd8b9c2cb0caa6ae382fc8080f6a0ed ] The labels were backward with respect to the register values. The SRAM is mapped to the CPU when the register value is 1. Fixes: 5e4fb6429761 ("drivers: soc: sunxi: add support for A64 and its SRAM= C") Acked-by: Jernej Skrabec Signed-off-by: Samuel Holland Signed-off-by: Jernej Skrabec Link: https://lore.kernel.org/r/20220815041248.53268-7-samuel@sholland.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/soc/sunxi/sunxi_sram.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c index 52d07bed7664..09754cd1d57d 100644 --- a/drivers/soc/sunxi/sunxi_sram.c +++ b/drivers/soc/sunxi/sunxi_sram.c @@ -78,8 +78,8 @@ static struct sunxi_sram_desc sun4i_a10_sram_d =3D { =20 static struct sunxi_sram_desc sun50i_a64_sram_c =3D { .data =3D SUNXI_SRAM_DATA("C", 0x4, 24, 1, - SUNXI_SRAM_MAP(0, 1, "cpu"), - SUNXI_SRAM_MAP(1, 0, "de2")), + SUNXI_SRAM_MAP(1, 0, "cpu"), + SUNXI_SRAM_MAP(0, 1, "de2")), }; =20 static const struct of_device_id sunxi_sram_dt_ids[] =3D { --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B1EFC433F5 for ; Mon, 3 Oct 2022 07:31:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231458AbiJCHbz (ORCPT ); Mon, 3 Oct 2022 03:31:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231279AbiJCHau (ORCPT ); Mon, 3 Oct 2022 03:30:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86F5B1FCFF; Mon, 3 Oct 2022 00:20:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E605E60FA4; Mon, 3 Oct 2022 07:18:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0555BC433C1; Mon, 3 Oct 2022 07:18:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781513; bh=bzT6vyxwK9l/S/M9haD835cIwl5EwhBCeG4yOlarAWE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hIvuVArnBGtYhRlBdb8PaLOkGbV6C7VU3UKCtkuR/kIxMBN9pAFio/52Pdh+OUJQu QcyQrlmBfoGTX6ldiQWFM+FqUOWLfhecKlDwFgtu03drspX9b9tFUWNhArFbMnEb/s st31KjQMIKMmQAcw7bqH8nOTzc4ErqapPr7t1H7Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shengjiu Wang , Mark Brown , Sasha Levin Subject: [PATCH 5.15 47/83] ASoC: imx-card: Fix refcount issue with of_node_put Date: Mon, 3 Oct 2022 09:11:12 +0200 Message-Id: <20221003070723.175841129@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shengjiu Wang [ Upstream commit d56ba9a04d7548d4149c46ec86a0e3cc41a70f4a ] imx_card_parse_of will search all the node with loop, if there is defer probe happen in the middle of loop, the previous released codec node will be released twice, then cause refcount issue. Here assign NULL to pointer of released nodes to fix the issue. Fixes: aa736700f42f ("ASoC: imx-card: Add imx-card machine driver") Signed-off-by: Shengjiu Wang Link: https://lore.kernel.org/r/1663059601-29259-1-git-send-email-shengjiu.= wang@nxp.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- sound/soc/fsl/imx-card.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c index 593d69b96523..d59f5efbf7ed 100644 --- a/sound/soc/fsl/imx-card.c +++ b/sound/soc/fsl/imx-card.c @@ -698,6 +698,10 @@ static int imx_card_parse_of(struct imx_card_data *dat= a) of_node_put(cpu); of_node_put(codec); of_node_put(platform); + + cpu =3D NULL; + codec =3D NULL; + platform =3D NULL; } =20 return 0; --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C77DC433FE for ; Mon, 3 Oct 2022 07:26:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231194AbiJCH0n (ORCPT ); Mon, 3 Oct 2022 03:26:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230306AbiJCHYj (ORCPT ); Mon, 3 Oct 2022 03:24:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 064054C60A; Mon, 3 Oct 2022 00:18:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5167B60F63; Mon, 3 Oct 2022 07:18:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3052FC433C1; Mon, 3 Oct 2022 07:18:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781516; bh=Xf1ytNAkR+HYGw3zMQXW5roEU/+HQqH8SMv3iX8tb2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zuBHX7miQx1zwWLXV3dKRmv8zHQHAkpWMRYk9m2pcHytSg4mvu05TGglD+vNa8MCC KLnsm2PgYlOACkqoPgcLTHPIbrt/snjJhrH5EMXXCn03dLzk02AOw88JHGzqg7KZEZ 8uI179RY+PB97ELCoqniw+2AtuMTFnGRTbKuEQTY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 48/83] arm64: dts: qcom: sm8350: fix UFS PHY serdes size Date: Mon, 3 Oct 2022 09:11:13 +0200 Message-Id: <20221003070723.202129064@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold [ Upstream commit 40e9541959100e017533e18e44d07eed44f91dc5 ] The size of the UFS PHY serdes register region is 0x1c4 and the corresponding 'reg' property should specifically not include the adjacent regions that are defined in the child node (e.g. tx and rx). Fixes: 59c7cf814783 ("arm64: dts: qcom: sm8350: Add UFS nodes") Signed-off-by: Johan Hovold Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220916093603.24263-1-johan+linaro@kernel.= org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- arch/arm64/boot/dts/qcom/sm8350.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/sm8350.dtsi b/arch/arm64/boot/dts/qco= m/sm8350.dtsi index 9ffb7355850c..c0a3ea47302f 100644 --- a/arch/arm64/boot/dts/qcom/sm8350.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8350.dtsi @@ -1109,7 +1109,7 @@ =20 ufs_mem_phy: phy@1d87000 { compatible =3D "qcom,sm8350-qmp-ufs-phy"; - reg =3D <0 0x01d87000 0 0xe10>; + reg =3D <0 0x01d87000 0 0x1c4>; #address-cells =3D <2>; #size-cells =3D <2>; #clock-cells =3D <1>; --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F1FDC433FE for ; Mon, 3 Oct 2022 07:36:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231689AbiJCHgY (ORCPT ); Mon, 3 Oct 2022 03:36:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231858AbiJCHeo (ORCPT ); Mon, 3 Oct 2022 03:34:44 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A9944A120; Mon, 3 Oct 2022 00:22:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 5E7A2CE0B20; Mon, 3 Oct 2022 07:18:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DD17C433D6; Mon, 3 Oct 2022 07:18:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781519; bh=LgYd5uDMmkFHpbHdPXme4CTyzsOyBHSL0NHl2ISCDDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z7BN0S8uaogN4tPMVlQOJT1DxQ5fk/i6peQLFL4VUNXjduQS2G79j2oWD9XZhP9zT 9hqbNma64RqQQZwtAFM2uIXpDQ1FoYHwwC9sZ6k1BMyoiCJ2NVL8flh0mjT4L1IZzE oLSRg+sWXFHHoHKe9yy39gr/iZ208I0Y3mUYr5Hg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Martin=20Povi=C5=A1er?= , Mark Brown , Sasha Levin Subject: [PATCH 5.15 49/83] ASoC: tas2770: Reinit regcache on reset Date: Mon, 3 Oct 2022 09:11:14 +0200 Message-Id: <20221003070723.229603330@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Martin Povi=C5=A1er [ Upstream commit 0a0342ede303fc420f3a388e1ae82da3ae8ff6bd ] On probe of the ASoC component, the device is reset but the regcache is retained. This means the regcache gets out of sync if the codec is rebound to a sound card for a second time. Fix it by reinitializing the regcache to defaults after the device is reset. Fixes: b0bcbe615756 ("ASoC: tas2770: Fix calling reset in probe") Signed-off-by: Martin Povi=C5=A1er Link: https://lore.kernel.org/r/20220919173453.84292-1-povik+lin@cutebit.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- sound/soc/codecs/tas2770.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/soc/codecs/tas2770.c b/sound/soc/codecs/tas2770.c index b8cda6b14b49..a13b086a072b 100644 --- a/sound/soc/codecs/tas2770.c +++ b/sound/soc/codecs/tas2770.c @@ -495,6 +495,8 @@ static struct snd_soc_dai_driver tas2770_dai_driver[] = =3D { }, }; =20 +static const struct regmap_config tas2770_i2c_regmap; + static int tas2770_codec_probe(struct snd_soc_component *component) { struct tas2770_priv *tas2770 =3D @@ -508,6 +510,7 @@ static int tas2770_codec_probe(struct snd_soc_component= *component) } =20 tas2770_reset(tas2770); + regmap_reinit_cache(tas2770->regmap, &tas2770_i2c_regmap); =20 return 0; } --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A0BBC4332F for ; Mon, 3 Oct 2022 07:27:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231173AbiJCH1V (ORCPT ); Mon, 3 Oct 2022 03:27:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230518AbiJCHZt (ORCPT ); Mon, 3 Oct 2022 03:25:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47AFE4D146; Mon, 3 Oct 2022 00:18:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9BBB560F97; Mon, 3 Oct 2022 07:18:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A40B8C433D6; Mon, 3 Oct 2022 07:18:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781523; bh=CLCbo5stG7s/P5aFjP8fzCIzCE/aZzljLqMYIHAqmMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K+Vu3AO6aAUIfDp06IMs5csPfv9c8E3/BUIoO9QgUbdpun63Ml+TavtskIVGVwDJl BiXmWoofvumAVlJdZJJk1pfxum08hcEAktk7QEzckY9kC7yM4jKzmWsf2puwld10hB P6ObwLA1NyMq5Z0roS/7becQLOlF4MzxLJ9jopjA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Philippe Schenker , Adrien Grassein , Neil Armstrong , Sasha Levin Subject: [PATCH 5.15 50/83] drm/bridge: lt8912b: add vsync hsync Date: Mon, 3 Oct 2022 09:11:15 +0200 Message-Id: <20221003070723.255714447@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Philippe Schenker [ Upstream commit da73a94fa282f78d485bd0aab36c8ac15b6f792c ] Currently the bridge driver does not take care whether or not the display needs positive/negative vertical/horizontal syncs. Pass these two flags to the bridge from the EDID that was read out from the display. Fixes: 30e2ae943c26 ("drm/bridge: Introduce LT8912B DSI to HDMI bridge") Signed-off-by: Philippe Schenker Acked-by: Adrien Grassein Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20220922124306.34729-2-= dev@pschenker.ch Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/gpu/drm/bridge/lontium-lt8912b.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bri= dge/lontium-lt8912b.c index 1b0c7eaf6c84..0fae72d45040 100644 --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c @@ -266,7 +266,7 @@ static int lt8912_video_setup(struct lt8912 *lt) u32 hactive, h_total, hpw, hfp, hbp; u32 vactive, v_total, vpw, vfp, vbp; u8 settle =3D 0x08; - int ret; + int ret, hsync_activehigh, vsync_activehigh; =20 if (!lt) return -EINVAL; @@ -276,12 +276,14 @@ static int lt8912_video_setup(struct lt8912 *lt) hpw =3D lt->mode.hsync_len; hbp =3D lt->mode.hback_porch; h_total =3D hactive + hfp + hpw + hbp; + hsync_activehigh =3D lt->mode.flags & DISPLAY_FLAGS_HSYNC_HIGH; =20 vactive =3D lt->mode.vactive; vfp =3D lt->mode.vfront_porch; vpw =3D lt->mode.vsync_len; vbp =3D lt->mode.vback_porch; v_total =3D vactive + vfp + vpw + vbp; + vsync_activehigh =3D lt->mode.flags & DISPLAY_FLAGS_VSYNC_HIGH; =20 if (vactive <=3D 600) settle =3D 0x04; @@ -315,6 +317,11 @@ static int lt8912_video_setup(struct lt8912 *lt) ret |=3D regmap_write(lt->regmap[I2C_CEC_DSI], 0x3e, hfp & 0xff); ret |=3D regmap_write(lt->regmap[I2C_CEC_DSI], 0x3f, hfp >> 8); =20 + ret |=3D regmap_update_bits(lt->regmap[I2C_MAIN], 0xab, BIT(0), + vsync_activehigh ? BIT(0) : 0); + ret |=3D regmap_update_bits(lt->regmap[I2C_MAIN], 0xab, BIT(1), + hsync_activehigh ? BIT(1) : 0); + return ret; } =20 --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03AF5C433FE for ; Mon, 3 Oct 2022 07:45:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232116AbiJCHpP (ORCPT ); Mon, 3 Oct 2022 03:45:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232228AbiJCHnw (ORCPT ); Mon, 3 Oct 2022 03:43:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E4585727C; Mon, 3 Oct 2022 00:25:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 400ECB80E6D; Mon, 3 Oct 2022 07:18:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D7A0C433C1; Mon, 3 Oct 2022 07:18:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781525; bh=wa4Do4daHGoSjRqKXUWxffT+Kt2EzKtJY/TVXVUcLNQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g0+82joAcQPAFrpZovwusz0N6CRM2IIXzmRAE9vPb+lugkXDXoFrMPIUTrGJ+GB5p tEGMdpzIh2wT0PV0zHo0wneWIxVC2O5a7Rq77uMnEMEwDsgT/XyzmCQHx7GFOXDHy6 uHOUa/vUXw4OTmahFz3puvZAlqQqyevdd8QE++/g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Philippe Schenker , Adrien Grassein , Neil Armstrong , Sasha Levin Subject: [PATCH 5.15 51/83] drm/bridge: lt8912b: set hdmi or dvi mode Date: Mon, 3 Oct 2022 09:11:16 +0200 Message-Id: <20221003070723.280873664@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Philippe Schenker [ Upstream commit 6dd1de12e1243f2013e4fabf31e99e63b1a860d0 ] The Lontium LT8912 does have a setting for DVI or HDMI. This patch reads from EDID what the display needs and sets it accordingly. Fixes: 30e2ae943c26 ("drm/bridge: Introduce LT8912B DSI to HDMI bridge") Signed-off-by: Philippe Schenker Acked-by: Adrien Grassein Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20220922124306.34729-3-= dev@pschenker.ch Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/gpu/drm/bridge/lontium-lt8912b.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bri= dge/lontium-lt8912b.c index 0fae72d45040..6e04d51b4636 100644 --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c @@ -321,6 +321,8 @@ static int lt8912_video_setup(struct lt8912 *lt) vsync_activehigh ? BIT(0) : 0); ret |=3D regmap_update_bits(lt->regmap[I2C_MAIN], 0xab, BIT(1), hsync_activehigh ? BIT(1) : 0); + ret |=3D regmap_update_bits(lt->regmap[I2C_MAIN], 0xb2, BIT(0), + lt->connector.display_info.is_hdmi ? BIT(0) : 0); =20 return ret; } --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8244CC433FE for ; Mon, 3 Oct 2022 07:27:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231221AbiJCH10 (ORCPT ); Mon, 3 Oct 2022 03:27:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229678AbiJCH00 (ORCPT ); Mon, 3 Oct 2022 03:26:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D6064BD1C; Mon, 3 Oct 2022 00:18:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4EB4060F08; Mon, 3 Oct 2022 07:18:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 587CCC433C1; Mon, 3 Oct 2022 07:18:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781528; bh=v7g4F4OSPeaZNOBmVwP/wUNFNVZYgcHERgCo9de8d90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WpQcoaUxjWFJubczK4ryFwuQqSEGR6K+FVagBi8bq+01PWFU47iJC39bdneghUIkD pypE23fap4+oBWzrsZzQgRz09xzO9relst+GquLoBrb03xHc2RqxNU/TIswevuzjyh ep2ecP5P0flTrd8ED9c5fiCLF/jmsKIClxFAgF3Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Francesco Dolcini , Philippe Schenker , Adrien Grassein , Neil Armstrong , Sasha Levin Subject: [PATCH 5.15 52/83] drm/bridge: lt8912b: fix corrupted image output Date: Mon, 3 Oct 2022 09:11:17 +0200 Message-Id: <20221003070723.305982375@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Francesco Dolcini [ Upstream commit 051ad2788d35ca07aec8402542e5d38429f2426a ] Correct I2C address for the register list in lt8912_write_lvds_config(), these registers are on the first I2C address (0x48), the current function is just writing garbage to the wrong registers and this creates multiple issues (artifacts and output completely corrupted) on some HDMI displays. Correct I2C address comes from Lontium documentation and it is the one used on other out-of-tree LT8912B drivers [1]. [1] https://github.com/boundarydevices/linux/blob/boundary-imx_5.10.x_2.0.0= /drivers/video/lt8912.c#L296 Fixes: 30e2ae943c26 ("drm/bridge: Introduce LT8912B DSI to HDMI bridge") Signed-off-by: Francesco Dolcini Signed-off-by: Philippe Schenker Acked-by: Adrien Grassein Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20220922124306.34729-4-= dev@pschenker.ch Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/gpu/drm/bridge/lontium-lt8912b.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bri= dge/lontium-lt8912b.c index 6e04d51b4636..82169b6bfca1 100644 --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c @@ -186,7 +186,7 @@ static int lt8912_write_lvds_config(struct lt8912 *lt) {0x03, 0xff}, }; =20 - return regmap_multi_reg_write(lt->regmap[I2C_CEC_DSI], seq, ARRAY_SIZE(se= q)); + return regmap_multi_reg_write(lt->regmap[I2C_MAIN], seq, ARRAY_SIZE(seq)); }; =20 static inline struct lt8912 *bridge_to_lt8912(struct drm_bridge *b) --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1E20C433F5 for ; Mon, 3 Oct 2022 07:45:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232131AbiJCHpT (ORCPT ); Mon, 3 Oct 2022 03:45:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232235AbiJCHny (ORCPT ); Mon, 3 Oct 2022 03:43:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2ABE5550B3; Mon, 3 Oct 2022 00:25:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BC296B80E88; Mon, 3 Oct 2022 07:18:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1ED5FC433D6; Mon, 3 Oct 2022 07:18:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781531; bh=49gBinqoVc/qTG2GDt0F5u3SWhgWgk8u5qAoNFo608U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c9Cg0h3iQZhqF5QyeDPChcWIyaDIoTikkJ65eCTE4efQlQZMaKTHND+3z8OMKOTL7 tuB9BwzqnLrU4DLqKIqQhNrUfBiCwTq0MP1gP9nWIuitRlSFqVBpNyHfYI4hLo4NyN rRyxJ46hsuV9WpzdRJcxM1XE64Gy9RymMAfZ+C4k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Douglas Anderson , Sasha Levin Subject: [PATCH 5.15 53/83] Revert "drm: bridge: analogix/dp: add panel prepare/unprepare in suspend/resume time" Date: Mon, 3 Oct 2022 09:11:18 +0200 Message-Id: <20221003070723.331868597@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Brian Norris [ Upstream commit cc62d98bd56d45de4531844ca23913a15136c05b ] This reverts commit 211f276ed3d96e964d2d1106a198c7f4a4b3f4c0. For quite some time, core DRM helpers already ensure that any relevant connectors/CRTCs/etc. are disabled, as well as their associated components (e.g., bridges) when suspending the system. Thus, analogix_dp_bridge_{enable,disable}() already get called, which in turn call drm_panel_{prepare,unprepare}(). This makes these drm_panel_*() calls redundant. Besides redundancy, there are a few problems with this handling: (1) drm_panel_{prepare,unprepare}() are *not* reference-counted APIs and are not in general designed to be handled by multiple callers -- although some panel drivers have a coarse 'prepared' flag that mitigates some damage, at least. So at a minimum this is redundant and confusing, but in some cases, this could be actively harmful. (2) The error-handling is a bit non-standard. We ignored errors in suspend(), but handled errors in resume(). And recently, people noticed that the clk handling is unbalanced in error paths, and getting *that* right is not actually trivial, given the current way errors are mostly ignored. (3) In the particular way analogix_dp_{suspend,resume}() get used (e.g., in rockchip_dp_*(), as a late/early callback), we don't necessarily have a proper PM relationship between the DP/bridge device and the panel device. So while the DP bridge gets resumed, the panel's parent device (e.g., platform_device) may still be suspended, and so any prepare() calls may fail. So remove the superfluous, possibly-harmful suspend()/resume() handling of panel state. Fixes: 211f276ed3d9 ("drm: bridge: analogix/dp: add panel prepare/unprepare= in suspend/resume time") Link: https://lore.kernel.org/all/Yv2CPBD3Picg%2FgVe@google.com/ Signed-off-by: Brian Norris Reviewed-by: Douglas Anderson Signed-off-by: Douglas Anderson Link: https://patchwork.freedesktop.org/patch/msgid/20220822180729.1.I8ac5a= be3a4c1c6fd5c061686c6e883c22f69022c@changeid Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/g= pu/drm/bridge/analogix/analogix_dp_core.c index 873cf6882bd3..f0305f833b6c 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -1860,12 +1860,6 @@ EXPORT_SYMBOL_GPL(analogix_dp_remove); int analogix_dp_suspend(struct analogix_dp_device *dp) { clk_disable_unprepare(dp->clock); - - if (dp->plat_data->panel) { - if (drm_panel_unprepare(dp->plat_data->panel)) - DRM_ERROR("failed to turnoff the panel\n"); - } - return 0; } EXPORT_SYMBOL_GPL(analogix_dp_suspend); @@ -1880,13 +1874,6 @@ int analogix_dp_resume(struct analogix_dp_device *dp) return ret; } =20 - if (dp->plat_data->panel) { - if (drm_panel_prepare(dp->plat_data->panel)) { - DRM_ERROR("failed to setup the panel\n"); - return -EBUSY; - } - } - return 0; } EXPORT_SYMBOL_GPL(analogix_dp_resume); --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 736F6C433F5 for ; Mon, 3 Oct 2022 07:44:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230369AbiJCHow (ORCPT ); Mon, 3 Oct 2022 03:44:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232065AbiJCHnY (ORCPT ); Mon, 3 Oct 2022 03:43:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61BA029816; Mon, 3 Oct 2022 00:25:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8B75EB80E8B; Mon, 3 Oct 2022 07:18:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1E5FC433B5; Mon, 3 Oct 2022 07:18:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781534; bh=+VAuBlT2qbjuexas2uWO4klILw2NI4Bx5UICdkowzKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v68Eg1GZP3feD8T2qggA7KeJCJ3Tqvskw1oBPWlFKBXe7r2yg6KtYvEs7Q8s7fIyf 0CqcqyfczZWMIoi0KYPEHfJ94quCj4GHYLcRei1XWfqLJsogS5Mt9D+wb7eNRfrfLp ACE23Nx9+n+GEhQ40hThbDXqg9ErIjw11i3lpkGk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Yingliang , Dmitry Torokhov , Sasha Levin Subject: [PATCH 5.15 54/83] Input: melfas_mip4 - fix return value check in mip4_probe() Date: Mon, 3 Oct 2022 09:11:19 +0200 Message-Id: <20221003070723.357996608@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Yingliang [ Upstream commit a54dc27bd25f20ee3ea2009584b3166d25178243 ] devm_gpiod_get_optional() may return ERR_PTR(-EPROBE_DEFER), add a minus sign to fix it. Fixes: 6ccb1d8f78bd ("Input: add MELFAS MIP4 Touchscreen driver") Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20220924030715.1653538-1-yangyingliang@huaw= ei.com Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/input/touchscreen/melfas_mip4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/melfas_mip4.c b/drivers/input/touchs= creen/melfas_mip4.c index 2745bf1aee38..83f4be05e27b 100644 --- a/drivers/input/touchscreen/melfas_mip4.c +++ b/drivers/input/touchscreen/melfas_mip4.c @@ -1453,7 +1453,7 @@ static int mip4_probe(struct i2c_client *client, cons= t struct i2c_device_id *id) "ce", GPIOD_OUT_LOW); if (IS_ERR(ts->gpio_ce)) { error =3D PTR_ERR(ts->gpio_ce); - if (error !=3D EPROBE_DEFER) + if (error !=3D -EPROBE_DEFER) dev_err(&client->dev, "Failed to get gpio: %d\n", error); return error; --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8651FC433F5 for ; Mon, 3 Oct 2022 07:32:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231328AbiJCHcT (ORCPT ); Mon, 3 Oct 2022 03:32:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231433AbiJCHbZ (ORCPT ); Mon, 3 Oct 2022 03:31:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79AA54D27B; Mon, 3 Oct 2022 00:20:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 039BD60F97; Mon, 3 Oct 2022 07:18:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D15B8C433D6; Mon, 3 Oct 2022 07:18:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781537; bh=cGxYMM7fPRmJc/t1JctwKv/zF2KZVsMYsKES/QT78ro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TXGoEfDX5uMfFEcMxgNpD83uwAJ2EXyRoBM4FO+rlPQn5tDpWdLjGyXFf2ViYVVgN AgGk7Q8iT/vjwLsv4waLLNjI08vKYBJSuMDTmbemzY7DNcx24qnJGuKFDIueXeHhmH F48tg5McVQVKt0TqHMWlVmIBis+tfm/5NvEKot+s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.15 55/83] gpio: mvebu: Fix check for pwm support on non-A8K platforms Date: Mon, 3 Oct 2022 09:11:20 +0200 Message-Id: <20221003070723.384232731@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pali Roh=C3=A1r [ Upstream commit 4335417da2b8d6d9b2d4411b5f9e248e5bb2d380 ] pwm support incompatible with Armada 80x0/70x0 API is not only in Armada 370, but also in Armada XP, 38x and 39x. So basically every non-A8K platform. Fix check for pwm support appropriately. Fixes: 85b7d8abfec7 ("gpio: mvebu: add pwm support for Armada 8K/7K") Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/gpio/gpio-mvebu.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c index 1448dc874dfc..a245bfd5a617 100644 --- a/drivers/gpio/gpio-mvebu.c +++ b/drivers/gpio/gpio-mvebu.c @@ -793,8 +793,12 @@ static int mvebu_pwm_probe(struct platform_device *pde= v, u32 offset; u32 set; =20 - if (of_device_is_compatible(mvchip->chip.of_node, - "marvell,armada-370-gpio")) { + if (mvchip->soc_variant =3D=3D MVEBU_GPIO_SOC_VARIANT_A8K) { + int ret =3D of_property_read_u32(dev->of_node, + "marvell,pwm-offset", &offset); + if (ret < 0) + return 0; + } else { /* * There are only two sets of PWM configuration registers for * all the GPIO lines on those SoCs which this driver reserves @@ -804,13 +808,6 @@ static int mvebu_pwm_probe(struct platform_device *pde= v, if (!platform_get_resource_byname(pdev, IORESOURCE_MEM, "pwm")) return 0; offset =3D 0; - } else if (mvchip->soc_variant =3D=3D MVEBU_GPIO_SOC_VARIANT_A8K) { - int ret =3D of_property_read_u32(dev->of_node, - "marvell,pwm-offset", &offset); - if (ret < 0) - return 0; - } else { - return 0; } =20 if (IS_ERR(mvchip->clk)) --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B99BFC433FE for ; Mon, 3 Oct 2022 07:31:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230514AbiJCHbG (ORCPT ); Mon, 3 Oct 2022 03:31:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231480AbiJCH3O (ORCPT ); Mon, 3 Oct 2022 03:29:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 413C4193CC; Mon, 3 Oct 2022 00:20:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 707E4B80E68; Mon, 3 Oct 2022 07:19:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1D43C433D7; Mon, 3 Oct 2022 07:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781540; bh=SrHqb/qJ41BBT+qkESTpl9wftQ8kMguGqElAB2UgeNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AS17068hUuZudFU+BiFUlon/je64owzHvzqoXN47pykNHNV0qtZOT6NQI4nR2HjlY N1d1BQOrURgRe94mbXuZAbTik8ptCH4ZZRO1cw4ZBY+MTZ5Swk9kn0mJvGHAeq0qfl f9Z1gBlz/g2f8crR0zpEjQbLKaVRN+ayzsrwESxU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peilin Ye , Jakub Kicinski , Sasha Levin , syzbot+dcd3e13cf4472f2e0ba1@syzkaller.appspotmail.com Subject: [PATCH 5.15 56/83] usbnet: Fix memory leak in usbnet_disconnect() Date: Mon, 3 Oct 2022 09:11:21 +0200 Message-Id: <20221003070723.408734980@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peilin Ye [ Upstream commit a43206156263fbaf1f2b7f96257441f331e91bb7 ] Currently usbnet_disconnect() unanchors and frees all deferred URBs using usb_scuttle_anchored_urbs(), which does not free urb->context, causing a memory leak as reported by syzbot. Use a usb_get_from_anchor() while loop instead, similar to what we did in commit 19cfe912c37b ("Bluetooth: btusb: Fix memory leak in play_deferred"). Also free urb->sg. Reported-and-tested-by: syzbot+dcd3e13cf4472f2e0ba1@syzkaller.appspotmail.c= om Fixes: 69ee472f2706 ("usbnet & cdc-ether: Autosuspend for online devices") Fixes: 638c5115a794 ("USBNET: support DMA SG") Signed-off-by: Peilin Ye Link: https://lore.kernel.org/r/20220923042551.2745-1-yepeilin.cs@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/net/usb/usbnet.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 5b7272fd25ee..e4fbb4d86606 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -1599,6 +1599,7 @@ void usbnet_disconnect (struct usb_interface *intf) struct usbnet *dev; struct usb_device *xdev; struct net_device *net; + struct urb *urb; =20 dev =3D usb_get_intfdata(intf); usb_set_intfdata(intf, NULL); @@ -1615,7 +1616,11 @@ void usbnet_disconnect (struct usb_interface *intf) net =3D dev->net; unregister_netdev (net); =20 - usb_scuttle_anchored_urbs(&dev->deferred); + while ((urb =3D usb_get_from_anchor(&dev->deferred))) { + dev_kfree_skb(urb->context); + kfree(urb->sg); + usb_free_urb(urb); + } =20 if (dev->driver_info->unbind) dev->driver_info->unbind(dev, intf); --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12705C433FE for ; Mon, 3 Oct 2022 07:36:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231670AbiJCHgO (ORCPT ); Mon, 3 Oct 2022 03:36:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231840AbiJCHel (ORCPT ); Mon, 3 Oct 2022 03:34:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B556145989; Mon, 3 Oct 2022 00:22:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3F739B80E72; Mon, 3 Oct 2022 07:20:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABAACC433D6; Mon, 3 Oct 2022 07:20:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781634; bh=cDa5aTyxPYuYr2/Oz0HIB/2RvObzGfKBYzBTaVPzchs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EcGSlxozDoaFJ7IaXrXt/Np3BJDKgtgCXvY8h5OA40Fj//OdNGOy3T5+HCaYjKIzk KL6Ry6h4xVaMGbiiRn6tmgC7Bq6MjsfU9Tq/FI6igFT0pHYpImMPE9+okap6nFyuKc VhYEZhMC64TW8ey227RJzDdeFH/Qpqq1wVjMyylQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 57/83] net: sched: act_ct: fix possible refcount leak in tcf_ct_init() Date: Mon, 3 Oct 2022 09:11:22 +0200 Message-Id: <20221003070723.433246341@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hangyu Hua [ Upstream commit 6e23ec0ba92d426c77a73a9ccab16346e5e0ef49 ] nf_ct_put need to be called to put the refcount got by tcf_ct_fill_params to avoid possible refcount leak when tcf_ct_flow_table_get fails. Fixes: c34b961a2492 ("net/sched: act_ct: Create nf flow table per zone") Signed-off-by: Hangyu Hua Link: https://lore.kernel.org/r/20220923020046.8021-1-hbh25y@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- net/sched/act_ct.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c index f4fd584fba08..d85fdefe5730 100644 --- a/net/sched/act_ct.c +++ b/net/sched/act_ct.c @@ -1306,7 +1306,7 @@ static int tcf_ct_init(struct net *net, struct nlattr= *nla, =20 err =3D tcf_ct_flow_table_get(params); if (err) - goto cleanup; + goto cleanup_params; =20 spin_lock_bh(&c->tcf_lock); goto_ch =3D tcf_action_set_ctrlact(*a, parm->action, goto_ch); @@ -1321,6 +1321,9 @@ static int tcf_ct_init(struct net *net, struct nlattr= *nla, =20 return res; =20 +cleanup_params: + if (params->tmpl) + nf_ct_put(params->tmpl); cleanup: if (goto_ch) tcf_chain_put_by_act(goto_ch); --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98736C433F5 for ; Mon, 3 Oct 2022 08:48:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229551AbiJCIsI (ORCPT ); Mon, 3 Oct 2022 04:48:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230331AbiJCIro (ORCPT ); Mon, 3 Oct 2022 04:47:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE08C30F48; Mon, 3 Oct 2022 01:27:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 30DE160FA7; Mon, 3 Oct 2022 07:19:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E78CC433D6; Mon, 3 Oct 2022 07:19:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781564; bh=g8ezt+zIuqYm6KOhw3hbjL5xc69Nj8LJANjkzGatBMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j2biDZd25OoyOH+3A6DtDK9d+xy9YBDq6/xFeWi/2caF+yB0TgrEnMAvknaRY46sw CJvJkFcbl8y7gC6z75OXmjc8ewQglHnaecUv/iJwpHNuRLEz6pBLxCoHpsFw96CRAp y8e6xtd7IlHUIhNyFn0by+nXpY4eQYP5b111TFk4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rafael Mendonca , Rahul Lakkireddy , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 58/83] cxgb4: fix missing unlock on ETHOFLD desc collect fail path Date: Mon, 3 Oct 2022 09:11:23 +0200 Message-Id: <20221003070723.457565834@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rafael Mendonca [ Upstream commit c635ebe8d911a93bd849a9419b01a58783de76f1 ] The label passed to the QDESC_GET for the ETHOFLD TXQ, RXQ, and FLQ, is the 'out' one, which skips the 'out_unlock' label, and thus doesn't unlock the 'uld_mutex' before returning. Additionally, since commit 5148e5950c67 ("cxgb4: add EOTID tracking and software context dump"), the access to these ETHOFLD hardware queues should be protected by the 'mqprio_mutex' instead. Fixes: 2d0cb84dd973 ("cxgb4: add ETHOFLD hardware queue support") Fixes: 5148e5950c67 ("cxgb4: add EOTID tracking and software context dump") Signed-off-by: Rafael Mendonca Reviewed-by: Rahul Lakkireddy Link: https://lore.kernel.org/r/20220922175109.764898-1-rafaelmendsr@gmail.= com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- .../net/ethernet/chelsio/cxgb4/cudbg_lib.c | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c b/drivers/net/e= thernet/chelsio/cxgb4/cudbg_lib.c index a7f291c89702..557c591a6ce3 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c @@ -14,6 +14,7 @@ #include "cudbg_entity.h" #include "cudbg_lib.h" #include "cudbg_zlib.h" +#include "cxgb4_tc_mqprio.h" =20 static const u32 t6_tp_pio_array[][IREG_NUM_ELEM] =3D { {0x7e40, 0x7e44, 0x020, 28}, /* t6_tp_pio_regs_20_to_3b */ @@ -3458,7 +3459,7 @@ int cudbg_collect_qdesc(struct cudbg_init *pdbg_init, for (i =3D 0; i < utxq->ntxq; i++) QDESC_GET_TXQ(&utxq->uldtxq[i].q, cudbg_uld_txq_to_qtype(j), - out_unlock); + out_unlock_uld); } } =20 @@ -3475,7 +3476,7 @@ int cudbg_collect_qdesc(struct cudbg_init *pdbg_init, for (i =3D 0; i < urxq->nrxq; i++) QDESC_GET_RXQ(&urxq->uldrxq[i].rspq, cudbg_uld_rxq_to_qtype(j), - out_unlock); + out_unlock_uld); } =20 /* ULD FLQ */ @@ -3487,7 +3488,7 @@ int cudbg_collect_qdesc(struct cudbg_init *pdbg_init, for (i =3D 0; i < urxq->nrxq; i++) QDESC_GET_FLQ(&urxq->uldrxq[i].fl, cudbg_uld_flq_to_qtype(j), - out_unlock); + out_unlock_uld); } =20 /* ULD CIQ */ @@ -3500,29 +3501,34 @@ int cudbg_collect_qdesc(struct cudbg_init *pdbg_ini= t, for (i =3D 0; i < urxq->nciq; i++) QDESC_GET_RXQ(&urxq->uldrxq[base + i].rspq, cudbg_uld_ciq_to_qtype(j), - out_unlock); + out_unlock_uld); } } + mutex_unlock(&uld_mutex); + + if (!padap->tc_mqprio) + goto out; =20 + mutex_lock(&padap->tc_mqprio->mqprio_mutex); /* ETHOFLD TXQ */ if (s->eohw_txq) for (i =3D 0; i < s->eoqsets; i++) QDESC_GET_TXQ(&s->eohw_txq[i].q, - CUDBG_QTYPE_ETHOFLD_TXQ, out); + CUDBG_QTYPE_ETHOFLD_TXQ, out_unlock_mqprio); =20 /* ETHOFLD RXQ and FLQ */ if (s->eohw_rxq) { for (i =3D 0; i < s->eoqsets; i++) QDESC_GET_RXQ(&s->eohw_rxq[i].rspq, - CUDBG_QTYPE_ETHOFLD_RXQ, out); + CUDBG_QTYPE_ETHOFLD_RXQ, out_unlock_mqprio); =20 for (i =3D 0; i < s->eoqsets; i++) QDESC_GET_FLQ(&s->eohw_rxq[i].fl, - CUDBG_QTYPE_ETHOFLD_FLQ, out); + CUDBG_QTYPE_ETHOFLD_FLQ, out_unlock_mqprio); } =20 -out_unlock: - mutex_unlock(&uld_mutex); +out_unlock_mqprio: + mutex_unlock(&padap->tc_mqprio->mqprio_mutex); =20 out: qdesc_info->qdesc_entry_size =3D sizeof(*qdesc_entry); @@ -3559,6 +3565,10 @@ int cudbg_collect_qdesc(struct cudbg_init *pdbg_init, #undef QDESC_GET =20 return rc; + +out_unlock_uld: + mutex_unlock(&uld_mutex); + goto out; } =20 int cudbg_collect_flash(struct cudbg_init *pdbg_init, --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B178C433FE for ; Mon, 3 Oct 2022 07:35:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231584AbiJCHfo (ORCPT ); Mon, 3 Oct 2022 03:35:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231777AbiJCHe1 (ORCPT ); Mon, 3 Oct 2022 03:34:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E82F52DFA; Mon, 3 Oct 2022 00:22:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 646DE60FB1; Mon, 3 Oct 2022 07:19:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A7FEC433C1; Mon, 3 Oct 2022 07:19:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781593; bh=CcH2+5JFR4arTN14uAOW6GMbpSYm3V+PJ+UNMQhMOaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LssQyxtNBPY80V2RHBYJ2XuLgUjRUH6p2z9dqOV9HDJxH8efAUcAC8CIaf3MCgWZ+ 0jGFDUsLXSPKG3qH810HqY25L2rLMdZtTdQEshnuttjjWC4hcVHPq6Ut/zFTJWcH7p VToaR1FvTnkmu/LtBFsuKShhGg+hoyvgtm3cyonQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Wu , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 59/83] net/mlxbf_gige: Fix an IS_ERR() vs NULL bug in mlxbf_gige_mdio_probe Date: Mon, 3 Oct 2022 09:11:24 +0200 Message-Id: <20221003070723.482132748@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peng Wu [ Upstream commit 4774db8dfc6a2e6649920ebb2fc8e2f062c2080d ] The devm_ioremap() function returns NULL on error, it doesn't return error pointers. Fixes: 3a1a274e933f ("mlxbf_gige: compute MDIO period based on i1clk") Signed-off-by: Peng Wu Link: https://lore.kernel.org/r/20220923023640.116057-1-wupeng58@huawei.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_mdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_mdio.c b/d= rivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_mdio.c index caa4380ada13..5819584345ab 100644 --- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_mdio.c +++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_mdio.c @@ -244,8 +244,8 @@ int mlxbf_gige_mdio_probe(struct platform_device *pdev,= struct mlxbf_gige *priv) } =20 priv->clk_io =3D devm_ioremap(dev, res->start, resource_size(res)); - if (IS_ERR(priv->clk_io)) - return PTR_ERR(priv->clk_io); + if (!priv->clk_io) + return -ENOMEM; =20 mlxbf_gige_mdio_cfg(priv); =20 --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAD51C433FE for ; Mon, 3 Oct 2022 07:31:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231379AbiJCHbs (ORCPT ); Mon, 3 Oct 2022 03:31:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231358AbiJCHaO (ORCPT ); Mon, 3 Oct 2022 03:30:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0CE1205F4; Mon, 3 Oct 2022 00:20:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A6085B80E72; Mon, 3 Oct 2022 07:20:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0399C433D6; Mon, 3 Oct 2022 07:20:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781615; bh=oKCYGSycukY9Zk0OSdLHysoRbpbMi0dodmHYKNVraG4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tGHUVBiv/XrlenF1cCLoknlU0qxW0TLmIDx1FCSrYpkGfLnZH4M/9BmjGYIV93jAO IcyHrAd6TT6inHYl2mJHaXxaOqFxBI0tf2oanhv1re0qU5qZRJ905A1ATeqYsUfweA lxIgkxUQeVURtdlG874dABifKvBD4QOuZceNTZrg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Kelley , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.15 60/83] nvme: Fix IOC_PR_CLEAR and IOC_PR_RELEASE ioctls for nvme devices Date: Mon, 3 Oct 2022 09:11:25 +0200 Message-Id: <20221003070723.505616676@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Kelley [ Upstream commit c292a337d0e45a292c301e3cd51c35aa0ae91e95 ] The IOC_PR_CLEAR and IOC_PR_RELEASE ioctls are non-functional on NVMe devices because the nvme_pr_clear() and nvme_pr_release() functions set the IEKEY field incorrectly. The IEKEY field should be set only when the key is zero (i.e, not specified). The current code does it backwards. Furthermore, the NVMe spec describes the persistent reservation "clear" function as an option on the reservation release command. The current implementation of nvme_pr_clear() erroneously uses the reservation register command. Fix these errors. Note that NVMe version 1.3 and later specify that setting the IEKEY field will return an error of Invalid Field in Command. The fix will set IEKEY when the key is zero, which is appropriate as these ioctls consider a zero key to be "unspecified", and the intention of the spec change is to require a valid key. Tested on a version 1.4 PCI NVMe device in an Azure VM. Fixes: 1673f1f08c88 ("nvme: move block_device_operations and ns/ctrl freein= g to common code") Fixes: 1d277a637a71 ("NVMe: Add persistent reservation ops") Signed-off-by: Michael Kelley Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/nvme/host/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index ed2740585c5d..76d8a72f52e2 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2056,14 +2056,14 @@ static int nvme_pr_preempt(struct block_device *bde= v, u64 old, u64 new, =20 static int nvme_pr_clear(struct block_device *bdev, u64 key) { - u32 cdw10 =3D 1 | (key ? 1 << 3 : 0); + u32 cdw10 =3D 1 | (key ? 0 : 1 << 3); =20 - return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_register); + return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_release); } =20 static int nvme_pr_release(struct block_device *bdev, u64 key, enum pr_typ= e type) { - u32 cdw10 =3D nvme_pr_type(type) << 8 | (key ? 1 << 3 : 0); + u32 cdw10 =3D nvme_pr_type(type) << 8 | (key ? 0 : 1 << 3); =20 return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_release); } --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A43DC433F5 for ; Mon, 3 Oct 2022 07:35:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231600AbiJCHfs (ORCPT ); Mon, 3 Oct 2022 03:35:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231809AbiJCHec (ORCPT ); Mon, 3 Oct 2022 03:34:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2A0C52E5E; Mon, 3 Oct 2022 00:22:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 63261B80E68; Mon, 3 Oct 2022 07:20:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA9C1C433D6; Mon, 3 Oct 2022 07:20:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781618; bh=SXP9nyNk5NtHD1ho0EXPJBi6RxYXVxyFXz9k3y7vsU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zE5XH6OlMIWNJBbSlfeTQfb1HN7bNNmH5rYEKLn4jeSSpoPKEtjplOd8NhGnV22On x2BScNvD3Q3IiXZgT/lWkCG1EwSwNOsfZhS1MURzGRJ+heXntvpUaw76BUlhZxQKhP roOySSxw5cHPPDi4uwl7tCGTT2nsuswzW7248lyM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Markus Theil , Stanislaw Gruszka , Hans de Goede , Johannes Berg , Sasha Levin Subject: [PATCH 5.15 61/83] wifi: mac80211: fix regression with non-QoS drivers Date: Mon, 3 Oct 2022 09:11:26 +0200 Message-Id: <20221003070723.529470949@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede [ Upstream commit d873697ef2b7e1b6fdd8e9d449d9354bd5d29a4a ] Commit 10cb8e617560 ("mac80211: enable QoS support for nl80211 ctrl port") changed ieee80211_tx_control_port() to aways call __ieee80211_select_queue() without checking local->hw.queues. __ieee80211_select_queue() returns a queue-id between 0 and 3, which means that now ieee80211_tx_control_port() may end up setting the queue-mapping for a skb to a value higher then local->hw.queues if local->hw.queues is less then 4. Specifically this is a problem for ralink rt2500-pci cards where local->hw.queues is 2. There this causes rt2x00queue_get_tx_queue() to return NULL and the following error to be logged: "ieee80211 phy0: rt2x00mac_tx: Error - Attempt to send packet over invalid queue 2", after which association with the AP fails. Other callers of __ieee80211_select_queue() skip calling it when local->hw.queues < IEEE80211_NUM_ACS, add the same check to ieee80211_tx_control_port(). This fixes ralink rt2500-pci and similar cards when less then 4 tx-queues no longer working. Fixes: 10cb8e617560 ("mac80211: enable QoS support for nl80211 ctrl port") Cc: Markus Theil Suggested-by: Stanislaw Gruszka Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20220918192052.443529-1-hdegoede@redhat.com Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- net/mac80211/tx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index a499b07fee33..8f8dc2625d53 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -5719,6 +5719,9 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, st= ruct net_device *dev, skb_reset_network_header(skb); skb_reset_mac_header(skb); =20 + if (local->hw.queues < IEEE80211_NUM_ACS) + goto start_xmit; + /* update QoS header to prioritize control port frames if possible, * priorization also happens for control port frames send over * AF_PACKET @@ -5734,6 +5737,7 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, st= ruct net_device *dev, =20 rcu_read_unlock(); =20 +start_xmit: /* mutex lock is only needed for incrementing the cookie counter */ mutex_lock(&local->mtx); =20 --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19365C433FE for ; Mon, 3 Oct 2022 07:35:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231565AbiJCHf2 (ORCPT ); Mon, 3 Oct 2022 03:35:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231675AbiJCHeE (ORCPT ); Mon, 3 Oct 2022 03:34:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E637B43E58; Mon, 3 Oct 2022 00:21:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7153F60FAA; Mon, 3 Oct 2022 07:20:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80267C433D6; Mon, 3 Oct 2022 07:20:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781620; bh=Sb5PFIs2scKZ4zhb6dlIQIkS03z409cA4TLbcRTeacI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bMNyGN9nH8PI9+1flgOqZVrwvldIV+rlbbdtsJeRZBd5GzQa3Lr2FVDCU//BRQw70 PVbmg8RWipJLF3FQIWXSQQqOHMqP615Lzyho0NppXxrIF3fUzGNH3zLMOMXKFQ1zbJ xDi37GiBbW2Ms3svnIsdXZwzu70Aot+MX6tOgCDI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Junxiao Chang , Voon Weifeng , Jimmy JS Chen , "Looi, Hong Aun" , Paolo Abeni , Sasha Levin , Looi@vger.kernel.org Subject: [PATCH 5.15 62/83] net: stmmac: power up/down serdes in stmmac_open/release Date: Mon, 3 Oct 2022 09:11:27 +0200 Message-Id: <20221003070723.554455710@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Junxiao Chang [ Upstream commit 49725ffc15fc4e9fae68c55b691fd25168cbe5c1 ] This commit fixes DMA engine reset timeout issue in suspend/resume with ADLink I-Pi SMARC Plus board which dmesg shows: ... [ 54.678271] PM: suspend exit [ 54.754066] intel-eth-pci 0000:00:1d.2 enp0s29f2: PHY [stmmac-3:01] driv= er [Maxlinear Ethernet GPY215B] (irq=3DPOLL) [ 54.755808] intel-eth-pci 0000:00:1d.2 enp0s29f2: Register MEM_TYPE_PAGE= _POOL RxQ-0 ... [ 54.780482] intel-eth-pci 0000:00:1d.2 enp0s29f2: Register MEM_TYPE_PAGE= _POOL RxQ-7 [ 55.784098] intel-eth-pci 0000:00:1d.2: Failed to reset the dma [ 55.784111] intel-eth-pci 0000:00:1d.2 enp0s29f2: stmmac_hw_setup: DMA e= ngine initialization failed [ 55.784115] intel-eth-pci 0000:00:1d.2 enp0s29f2: stmmac_open: Hw setup = failed ... The issue is related with serdes which impacts clock. There is serdes in ADLink I-Pi SMARC board ethernet controller. Please refer to commit b9663b7ca6ff78 ("net: stmmac: Enable SERDES power up/down sequence") for detial. When issue is reproduced, DMA engine clock is not ready because serdes is not powered up. To reproduce DMA engine reset timeout issue with hardware which has serdes in GBE controller, install Ubuntu. In Ubuntu GUI, click "Power Off/Log Out" -> "Suspend" menu, it disables network interface, then goes to sleep mode. When it wakes up, it enables network interface again. Stmmac driver is called in this way: 1. stmmac_release: Stop network interface. In this function, it disables DMA engine and network interface; 2. stmmac_suspend: It is called in kernel suspend flow. But because network interface has been disabled(netif_running(ndev) is false), it does nothing and returns directly; 3. System goes into S3 or S0ix state. Some time later, system is waken up by keyboard or mouse; 4. stmmac_resume: It does nothing because network interface has been disabled; 5. stmmac_open: It is called to enable network interace again. DMA engine is initialized in this API, but serdes is not power on so there will be DMA engine reset timeout issue. Similarly, serdes powerdown should be added in stmmac_release. Network interface might be disabled by cmd "ifconfig eth0 down", DMA engine, phy and mac have been disabled in ndo_stop callback, serdes should be powered down as well. It doesn't make sense that serdes is on while other components have been turned off. If ethernet interface is in enabled state(netif_running(ndev) is true) before suspend/resume, the issue couldn't be reproduced because serdes could be powered up in stmmac_resume. Because serdes_powerup is added in stmmac_open, it doesn't need to be called in probe function. Fixes: b9663b7ca6ff78 ("net: stmmac: Enable SERDES power up/down sequence") Signed-off-by: Junxiao Chang Reviewed-by: Voon Weifeng Tested-by: Jimmy JS Chen Tested-by: Looi, Hong Aun Link: https://lore.kernel.org/r/20220923050448.1220250-1-junxiao.chang@inte= l.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/ne= t/ethernet/stmicro/stmmac/stmmac_main.c index 2569673559df..6f579f498993 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3757,6 +3757,15 @@ static int stmmac_open(struct net_device *dev) goto init_error; } =20 + if (priv->plat->serdes_powerup) { + ret =3D priv->plat->serdes_powerup(dev, priv->plat->bsp_priv); + if (ret < 0) { + netdev_err(priv->dev, "%s: Serdes powerup failed\n", + __func__); + goto init_error; + } + } + ret =3D stmmac_hw_setup(dev, true); if (ret < 0) { netdev_err(priv->dev, "%s: Hw setup failed\n", __func__); @@ -3846,6 +3855,10 @@ static int stmmac_release(struct net_device *dev) /* Disable the MAC Rx/Tx */ stmmac_mac_set(priv, priv->ioaddr, false); =20 + /* Powerdown Serdes if there is */ + if (priv->plat->serdes_powerdown) + priv->plat->serdes_powerdown(dev, priv->plat->bsp_priv); + netif_carrier_off(dev); =20 stmmac_release_ptp(priv); @@ -7224,14 +7237,6 @@ int stmmac_dvr_probe(struct device *device, goto error_netdev_register; } =20 - if (priv->plat->serdes_powerup) { - ret =3D priv->plat->serdes_powerup(ndev, - priv->plat->bsp_priv); - - if (ret < 0) - goto error_serdes_powerup; - } - #ifdef CONFIG_DEBUG_FS stmmac_init_fs(ndev); #endif @@ -7246,8 +7251,6 @@ int stmmac_dvr_probe(struct device *device, =20 return ret; =20 -error_serdes_powerup: - unregister_netdev(ndev); error_netdev_register: phylink_destroy(priv->phylink); error_xpcs_setup: --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91752C433FE for ; Mon, 3 Oct 2022 07:32:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231491AbiJCHcW (ORCPT ); Mon, 3 Oct 2022 03:32:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231335AbiJCHbm (ORCPT ); Mon, 3 Oct 2022 03:31:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 665B51CB02; Mon, 3 Oct 2022 00:20:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0ADBC60FB6; Mon, 3 Oct 2022 07:20:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 217C4C433D6; Mon, 3 Oct 2022 07:20:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781623; bh=6BZmbZpXFKe+jJYKjPvyocQRtW+3xcRxtRgORGiOudk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qwNXsltOPD9ucyNOylolYRuwp91RQpKmHysg7mZpKJqWEwrJkU+BW5c1Quy6Lyht9 8lUkUj/mJa9SpU2KBbS0yEnQ2DfOZftEJ6rrp4hPfDRp1smyvZsUlqAkxOzlNjUWk4 IBBoirmdUwmA6emVzCGHQny3IvxYwNp57EFxmMY4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Szyprowski , Lukas Wunner , Florian Fainelli , Xiaolei Wang , Paolo Abeni , Sasha Levin Subject: [PATCH 5.15 63/83] net: phy: Dont WARN for PHY_UP state in mdio_bus_phy_resume() Date: Mon, 3 Oct 2022 09:11:28 +0200 Message-Id: <20221003070723.578840618@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lukas Wunner [ Upstream commit ea64cdfad124922c931633e39287c5a31a9b14a1 ] Commit 744d23c71af3 ("net: phy: Warn about incorrect mdio_bus_phy_resume() state") introduced a WARN() on resume from system sleep if a PHY is not in PHY_HALTED state. Commit 6dbe852c379f ("net: phy: Don't WARN for PHY_READY state in mdio_bus_phy_resume()") added an exemption for PHY_READY state from the WARN(). It turns out PHY_UP state needs to be exempted as well because the following may happen on suspend: mdio_bus_phy_suspend() phy_stop_machine() phydev->state =3D PHY_UP # if (phydev->state >=3D PHY_UP) Fixes: 744d23c71af3 ("net: phy: Warn about incorrect mdio_bus_phy_resume() = state") Reported-by: Marek Szyprowski Tested-by: Marek Szyprowski Link: https://lore.kernel.org/netdev/2b1a1588-505e-dff3-301d-bfc1fb14d685@s= amsung.com/ Signed-off-by: Lukas Wunner Acked-by: Florian Fainelli Cc: Xiaolei Wang Link: https://lore.kernel.org/r/8128fdb51eeebc9efbf3776a4097363a1317aaf1.16= 63905575.git.lukas@wunner.de Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/net/phy/phy_device.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index b616f55ea222..c5b92ffaffb9 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -315,11 +315,13 @@ static __maybe_unused int mdio_bus_phy_resume(struct = device *dev) =20 phydev->suspended_by_mdio_bus =3D 0; =20 - /* If we manged to get here with the PHY state machine in a state neither - * PHY_HALTED nor PHY_READY this is an indication that something went wro= ng - * and we should most likely be using MAC managed PM and we are not. + /* If we managed to get here with the PHY state machine in a state + * neither PHY_HALTED, PHY_READY nor PHY_UP, this is an indication + * that something went wrong and we should most likely be using + * MAC managed PM, but we are not. */ - WARN_ON(phydev->state !=3D PHY_HALTED && phydev->state !=3D PHY_READY); + WARN_ON(phydev->state !=3D PHY_HALTED && phydev->state !=3D PHY_READY && + phydev->state !=3D PHY_UP); =20 ret =3D phy_init_hw(phydev); if (ret < 0) --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35AEEC433F5 for ; Mon, 3 Oct 2022 07:35:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231532AbiJCHfR (ORCPT ); Mon, 3 Oct 2022 03:35:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231600AbiJCHdp (ORCPT ); Mon, 3 Oct 2022 03:33:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66FB85282C; Mon, 3 Oct 2022 00:21:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 90BDF60FC0; Mon, 3 Oct 2022 07:20:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5197C433D6; Mon, 3 Oct 2022 07:20:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781626; bh=HzWNp5YyPkS2fPfnmk/Ug6wOXveeiRA34eO/DWm4nXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DXgesemlC4WATjnKp0Ae25DSKO70gECkIlNeBNk0yrgoFBRBH+PsfJ7s2E0Yb3kGN e2KZWrXCqkh29f/aJ9VCdUfhta6GYW2Aye7ZexMLUdDXF3ExTVerJTG/uJ0uvMLyB0 94feN8KTgA0CA7kRel0hhtz5BpjNk/jxCThCg4fU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wang Yufen , Paolo Abeni , Sasha Levin Subject: [PATCH 5.15 64/83] selftests: Fix the if conditions of in test_extra_filter() Date: Mon, 3 Oct 2022 09:11:29 +0200 Message-Id: <20221003070723.602603564@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wang Yufen [ Upstream commit bc7a319844891746135dc1f34ab9df78d636a3ac ] The socket 2 bind the addr in use, bind should fail with EADDRINUSE. So if bind success or errno !=3D EADDRINUSE, testcase should be failed. Fixes: 3ca8e4029969 ("soreuseport: BPF selection functional test") Signed-off-by: Wang Yufen Link: https://lore.kernel.org/r/1663916557-10730-1-git-send-email-wangyufen= @huawei.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- tools/testing/selftests/net/reuseport_bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/reuseport_bpf.c b/tools/testing/se= lftests/net/reuseport_bpf.c index b5277106df1f..b0cc082fbb84 100644 --- a/tools/testing/selftests/net/reuseport_bpf.c +++ b/tools/testing/selftests/net/reuseport_bpf.c @@ -330,7 +330,7 @@ static void test_extra_filter(const struct test_params = p) if (bind(fd1, addr, sockaddr_size())) error(1, errno, "failed to bind recv socket 1"); =20 - if (!bind(fd2, addr, sockaddr_size()) && errno !=3D EADDRINUSE) + if (!bind(fd2, addr, sockaddr_size()) || errno !=3D EADDRINUSE) error(1, errno, "bind socket 2 should fail with EADDRINUSE"); =20 free(addr); --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B3C9C433F5 for ; Mon, 3 Oct 2022 07:32:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231293AbiJCHcP (ORCPT ); Mon, 3 Oct 2022 03:32:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231210AbiJCHbQ (ORCPT ); Mon, 3 Oct 2022 03:31:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C588D4D80F; Mon, 3 Oct 2022 00:20:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3062360FC1; Mon, 3 Oct 2022 07:20:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4672BC433D6; Mon, 3 Oct 2022 07:20:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781628; bh=Qehyhczy34GYCAxTdZ+1feiRyWrmxMPUNWaUD+1T+aA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ub4X5N3lsiB2SdBtGa3MZ8YsZi8wJj7xn+HoUlgPrEKDoE6lNEYq6NmTn9wIVEbvB AQu1kCL/yjFEIdb9tHHQH9PfY/vyepAUwf8qUg4i0ohsOZpXnhWcGTHo5Pf30I+YIk sX6npY/udz9+RCQHnYsIShDHo56skMQApXQAx6b8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Angus Chen , Jason Wang , "Michael S. Tsirkin" , Zhu Lingshan , Sasha Levin Subject: [PATCH 5.15 65/83] vdpa/ifcvf: fix the calculation of queuepair Date: Mon, 3 Oct 2022 09:11:30 +0200 Message-Id: <20221003070723.626652120@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Angus Chen [ Upstream commit db5db1a00d0816207be3a0166fcb4f523eaf3b52 ] The q_pair_id to address a queue pair in the lm bar should be calculated by queue_id / 2 rather than queue_id / nr_vring. Fixes: 2ddae773c93b ("vDPA/ifcvf: detect and use the onboard number of queu= es directly") Signed-off-by: Angus Chen Reviewed-by: Jason Wang Reviewed-by: Michael S. Tsirkin Acked-by: Zhu Lingshan Message-Id: <20220923091013.191-1-angus.chen@jaguarmicro.com> Signed-off-by: Michael S. Tsirkin Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/vdpa/ifcvf/ifcvf_base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/vdpa/ifcvf/ifcvf_base.c b/drivers/vdpa/ifcvf/ifcvf_bas= e.c index 7d41dfe48ade..5091ff9d6c93 100644 --- a/drivers/vdpa/ifcvf/ifcvf_base.c +++ b/drivers/vdpa/ifcvf/ifcvf_base.c @@ -327,7 +327,7 @@ u16 ifcvf_get_vq_state(struct ifcvf_hw *hw, u16 qid) u32 q_pair_id; =20 ifcvf_lm =3D (struct ifcvf_lm_cfg __iomem *)hw->lm_cfg; - q_pair_id =3D qid / hw->nr_vring; + q_pair_id =3D qid / 2; avail_idx_addr =3D &ifcvf_lm->vring_lm_cfg[q_pair_id].idx_addr[qid % 2]; last_avail_idx =3D ifc_ioread16(avail_idx_addr); =20 @@ -341,7 +341,7 @@ int ifcvf_set_vq_state(struct ifcvf_hw *hw, u16 qid, u1= 6 num) u32 q_pair_id; =20 ifcvf_lm =3D (struct ifcvf_lm_cfg __iomem *)hw->lm_cfg; - q_pair_id =3D qid / hw->nr_vring; + q_pair_id =3D qid / 2; avail_idx_addr =3D &ifcvf_lm->vring_lm_cfg[q_pair_id].idx_addr[qid % 2]; hw->vring[qid].last_avail_idx =3D num; ifc_iowrite16(num, avail_idx_addr); --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6930DC433FE for ; Mon, 3 Oct 2022 07:37:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231767AbiJCHh1 (ORCPT ); Mon, 3 Oct 2022 03:37:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231586AbiJCHfq (ORCPT ); Mon, 3 Oct 2022 03:35:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB61C49B40; Mon, 3 Oct 2022 00:22:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0CF9760FC6; Mon, 3 Oct 2022 07:20:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D529C433C1; Mon, 3 Oct 2022 07:20:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781631; bh=7Jn0dhn1JoLUX5Vmcge7lUk1T51dy732xLlwJZxSwdM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=neAs0Jx+k3vuAW6DRb/BXUATIjxfo7sXK3zZy/gIS5GFG2v2uMjizZ4x25SNSUjuV ftouWHSXJEh/Rx2z58k9uXDaYy6NPoo2Py24qLevHP9K+gO6fZ/oiBd4i7HkNvxc6m tj0ou6HWTM5nOv5Ngow5sc2ep5RyLXKtX1Y8Uumg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Roesch , Christian Brauner , Jens Axboe , Sasha Levin Subject: [PATCH 5.15 66/83] fs: split off setxattr_copy and do_setxattr function from setxattr Date: Mon, 3 Oct 2022 09:11:31 +0200 Message-Id: <20221003070723.651284725@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stefan Roesch [ Upstream commit 1a91794ce8481a293c5ef432feb440aee1455619 ] This splits of the setup part of the function setxattr in its own dedicated function called setxattr_copy. In addition it also exposes a new function called do_setxattr for making the setxattr call. This makes it possible to call these two functions from io_uring in the processing of an xattr request. Signed-off-by: Stefan Roesch Acked-by: Christian Brauner Link: https://lore.kernel.org/r/20220323154420.3301504-2-shr@fb.com Signed-off-by: Jens Axboe Stable-dep-of: 06bbaa6dc53c ("[coredump] don't use __kernel_write() on kmap= _local_page()") Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- fs/internal.h | 24 +++++++++++++++ fs/xattr.c | 84 ++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 83 insertions(+), 25 deletions(-) diff --git a/fs/internal.h b/fs/internal.h index cdd83d4899bb..4f1fe6d08866 100644 --- a/fs/internal.h +++ b/fs/internal.h @@ -195,3 +195,27 @@ long splice_file_to_pipe(struct file *in, struct pipe_inode_info *opipe, loff_t *offset, size_t len, unsigned int flags); + +/* + * fs/xattr.c: + */ +struct xattr_name { + char name[XATTR_NAME_MAX + 1]; +}; + +struct xattr_ctx { + /* Value of attribute */ + union { + const void __user *cvalue; + void __user *value; + }; + void *kvalue; + size_t size; + /* Attribute name */ + struct xattr_name *kname; + unsigned int flags; +}; + +int setxattr_copy(const char __user *name, struct xattr_ctx *ctx); +int do_setxattr(struct user_namespace *mnt_userns, struct dentry *dentry, + struct xattr_ctx *ctx); diff --git a/fs/xattr.c b/fs/xattr.c index 998045165916..7117cb253864 100644 --- a/fs/xattr.c +++ b/fs/xattr.c @@ -25,6 +25,8 @@ =20 #include =20 +#include "internal.h" + static const char * strcmp_prefix(const char *a, const char *a_prefix) { @@ -539,44 +541,76 @@ EXPORT_SYMBOL_GPL(vfs_removexattr); /* * Extended attribute SET operations */ -static long -setxattr(struct user_namespace *mnt_userns, struct dentry *d, - const char __user *name, const void __user *value, size_t size, - int flags) + +int setxattr_copy(const char __user *name, struct xattr_ctx *ctx) { int error; - void *kvalue =3D NULL; - char kname[XATTR_NAME_MAX + 1]; =20 - if (flags & ~(XATTR_CREATE|XATTR_REPLACE)) + if (ctx->flags & ~(XATTR_CREATE|XATTR_REPLACE)) return -EINVAL; =20 - error =3D strncpy_from_user(kname, name, sizeof(kname)); - if (error =3D=3D 0 || error =3D=3D sizeof(kname)) - error =3D -ERANGE; + error =3D strncpy_from_user(ctx->kname->name, name, + sizeof(ctx->kname->name)); + if (error =3D=3D 0 || error =3D=3D sizeof(ctx->kname->name)) + return -ERANGE; if (error < 0) return error; =20 - if (size) { - if (size > XATTR_SIZE_MAX) + error =3D 0; + if (ctx->size) { + if (ctx->size > XATTR_SIZE_MAX) return -E2BIG; - kvalue =3D kvmalloc(size, GFP_KERNEL); - if (!kvalue) - return -ENOMEM; - if (copy_from_user(kvalue, value, size)) { - error =3D -EFAULT; - goto out; + + ctx->kvalue =3D vmemdup_user(ctx->cvalue, ctx->size); + if (IS_ERR(ctx->kvalue)) { + error =3D PTR_ERR(ctx->kvalue); + ctx->kvalue =3D NULL; } - if ((strcmp(kname, XATTR_NAME_POSIX_ACL_ACCESS) =3D=3D 0) || - (strcmp(kname, XATTR_NAME_POSIX_ACL_DEFAULT) =3D=3D 0)) - posix_acl_fix_xattr_from_user(mnt_userns, d_inode(d), - kvalue, size); } =20 - error =3D vfs_setxattr(mnt_userns, d, kname, kvalue, size, flags); -out: - kvfree(kvalue); + return error; +} + +static void setxattr_convert(struct user_namespace *mnt_userns, + struct dentry *d, struct xattr_ctx *ctx) +{ + if (ctx->size && + ((strcmp(ctx->kname->name, XATTR_NAME_POSIX_ACL_ACCESS) =3D=3D 0) || + (strcmp(ctx->kname->name, XATTR_NAME_POSIX_ACL_DEFAULT) =3D=3D 0))) + posix_acl_fix_xattr_from_user(mnt_userns, d_inode(d), + ctx->kvalue, ctx->size); +} + +int do_setxattr(struct user_namespace *mnt_userns, struct dentry *dentry, + struct xattr_ctx *ctx) +{ + setxattr_convert(mnt_userns, dentry, ctx); + return vfs_setxattr(mnt_userns, dentry, ctx->kname->name, + ctx->kvalue, ctx->size, ctx->flags); +} + +static long +setxattr(struct user_namespace *mnt_userns, struct dentry *d, + const char __user *name, const void __user *value, size_t size, + int flags) +{ + struct xattr_name kname; + struct xattr_ctx ctx =3D { + .cvalue =3D value, + .kvalue =3D NULL, + .size =3D size, + .kname =3D &kname, + .flags =3D flags, + }; + int error; + + error =3D setxattr_copy(name, &ctx); + if (error) + return error; + + error =3D do_setxattr(mnt_userns, d, &ctx); =20 + kvfree(ctx.kvalue); return error; } =20 --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49E23C433FE for ; Mon, 3 Oct 2022 07:33:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231551AbiJCHd2 (ORCPT ); Mon, 3 Oct 2022 03:33:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231461AbiJCHcp (ORCPT ); Mon, 3 Oct 2022 03:32:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76B4C25298; Mon, 3 Oct 2022 00:21:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 97426B80E94; Mon, 3 Oct 2022 07:19:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0074DC433D6; Mon, 3 Oct 2022 07:19:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781567; bh=tfBx23GHH+xKpCPewZ/4fGyE9B3qjYdkoAWuEz5Cfwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y3g9NWyRNgifvFYKztx7L9v0llVDkbXoHIG79wLwzRfsxWbOgYbglrJVgB8hsrkYB BlgfBEqEgQG+8y7Njwth7LrIcTS6DLAO7j4vmIMr9WpMtgwO7Y3h4Bw+XEyAVSYkqH FHLMVgwsarpzs5mESp3HYCx7827AcgTTgtmiJvNQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Viro , Sasha Levin Subject: [PATCH 5.15 67/83] dont use __kernel_write() on kmap_local_page() Date: Mon, 3 Oct 2022 09:11:32 +0200 Message-Id: <20221003070723.675440372@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Al Viro [ Upstream commit 06bbaa6dc53cb72040db952053432541acb9adc7 ] passing kmap_local_page() result to __kernel_write() is unsafe - random ->write_iter() might (and 9p one does) get unhappy when passed ITER_KVEC with pointer that came from kmap_local_page(). Fix by providing a variant of __kernel_write() that takes an iov_iter from caller (__kernel_write() becomes a trivial wrapper) and adding dump_emit_page() that parallels dump_emit(), except that instead of __kernel_write() it uses __kernel_write_iter() with ITER_BVEC source. Fixes: 3159ed57792b "fs/coredump: use kmap_local_page()" Signed-off-by: Al Viro Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- fs/coredump.c | 38 +++++++++++++++++++++++++++++++++----- fs/internal.h | 3 +++ fs/read_write.c | 22 ++++++++++++++-------- 3 files changed, 50 insertions(+), 13 deletions(-) diff --git a/fs/coredump.c b/fs/coredump.c index 26eb5a095832..43fdd82f82ab 100644 --- a/fs/coredump.c +++ b/fs/coredump.c @@ -902,6 +902,38 @@ static int __dump_skip(struct coredump_params *cprm, s= ize_t nr) } } =20 +static int dump_emit_page(struct coredump_params *cprm, struct page *page) +{ + struct bio_vec bvec =3D { + .bv_page =3D page, + .bv_offset =3D 0, + .bv_len =3D PAGE_SIZE, + }; + struct iov_iter iter; + struct file *file =3D cprm->file; + loff_t pos =3D file->f_pos; + ssize_t n; + + if (cprm->to_skip) { + if (!__dump_skip(cprm, cprm->to_skip)) + return 0; + cprm->to_skip =3D 0; + } + if (cprm->written + PAGE_SIZE > cprm->limit) + return 0; + if (dump_interrupted()) + return 0; + iov_iter_bvec(&iter, WRITE, &bvec, 1, PAGE_SIZE); + n =3D __kernel_write_iter(cprm->file, &iter, &pos); + if (n !=3D PAGE_SIZE) + return 0; + file->f_pos =3D pos; + cprm->written +=3D PAGE_SIZE; + cprm->pos +=3D PAGE_SIZE; + + return 1; +} + int dump_emit(struct coredump_params *cprm, const void *addr, int nr) { if (cprm->to_skip) { @@ -933,7 +965,6 @@ int dump_user_range(struct coredump_params *cprm, unsig= ned long start, =20 for (addr =3D start; addr < start + len; addr +=3D PAGE_SIZE) { struct page *page; - int stop; =20 /* * To avoid having to allocate page tables for virtual address @@ -944,10 +975,7 @@ int dump_user_range(struct coredump_params *cprm, unsi= gned long start, */ page =3D get_dump_page(addr); if (page) { - void *kaddr =3D kmap_local_page(page); - - stop =3D !dump_emit(cprm, kaddr, PAGE_SIZE); - kunmap_local(kaddr); + int stop =3D !dump_emit_page(cprm, page); put_page(page); if (stop) return 0; diff --git a/fs/internal.h b/fs/internal.h index 4f1fe6d08866..69b64136ae4c 100644 --- a/fs/internal.h +++ b/fs/internal.h @@ -16,6 +16,7 @@ struct shrink_control; struct fs_context; struct user_namespace; struct pipe_inode_info; +struct iov_iter; =20 /* * block/bdev.c @@ -219,3 +220,5 @@ struct xattr_ctx { int setxattr_copy(const char __user *name, struct xattr_ctx *ctx); int do_setxattr(struct user_namespace *mnt_userns, struct dentry *dentry, struct xattr_ctx *ctx); + +ssize_t __kernel_write_iter(struct file *file, struct iov_iter *from, loff= _t *pos); diff --git a/fs/read_write.c b/fs/read_write.c index 8d3ec975514d..08299a8f3e05 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -512,14 +512,9 @@ static ssize_t new_sync_write(struct file *filp, const= char __user *buf, size_t } =20 /* caller is responsible for file_start_write/file_end_write */ -ssize_t __kernel_write(struct file *file, const void *buf, size_t count, l= off_t *pos) +ssize_t __kernel_write_iter(struct file *file, struct iov_iter *from, loff= _t *pos) { - struct kvec iov =3D { - .iov_base =3D (void *)buf, - .iov_len =3D min_t(size_t, count, MAX_RW_COUNT), - }; struct kiocb kiocb; - struct iov_iter iter; ssize_t ret; =20 if (WARN_ON_ONCE(!(file->f_mode & FMODE_WRITE))) @@ -535,8 +530,7 @@ ssize_t __kernel_write(struct file *file, const void *b= uf, size_t count, loff_t =20 init_sync_kiocb(&kiocb, file); kiocb.ki_pos =3D pos ? *pos : 0; - iov_iter_kvec(&iter, WRITE, &iov, 1, iov.iov_len); - ret =3D file->f_op->write_iter(&kiocb, &iter); + ret =3D file->f_op->write_iter(&kiocb, from); if (ret > 0) { if (pos) *pos =3D kiocb.ki_pos; @@ -546,6 +540,18 @@ ssize_t __kernel_write(struct file *file, const void *= buf, size_t count, loff_t inc_syscw(current); return ret; } + +/* caller is responsible for file_start_write/file_end_write */ +ssize_t __kernel_write(struct file *file, const void *buf, size_t count, l= off_t *pos) +{ + struct kvec iov =3D { + .iov_base =3D (void *)buf, + .iov_len =3D min_t(size_t, count, MAX_RW_COUNT), + }; + struct iov_iter iter; + iov_iter_kvec(&iter, WRITE, &iov, 1, iov.iov_len); + return __kernel_write_iter(file, &iter, pos); +} /* * This "EXPORT_SYMBOL_GPL()" is more of a "EXPORT_SYMBOL_DONTUSE()", * but autofs is one of the few internal kernel users that actually --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 485EDC4332F for ; Mon, 3 Oct 2022 07:29:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230505AbiJCH3T (ORCPT ); Mon, 3 Oct 2022 03:29:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230515AbiJCH2D (ORCPT ); Mon, 3 Oct 2022 03:28:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D036AEE39; Mon, 3 Oct 2022 00:19:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 90FBA60FA6; Mon, 3 Oct 2022 07:19:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5D1DC433D6; Mon, 3 Oct 2022 07:19:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781570; bh=88y6V89ZhIC2mAYvMvB8/89AVze1JwN4vvrzk+RVBGw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L7B3yMshQ3UDwSmjtGghGQkLC+szmeaWdE8x4pi2cyhyBipCz967QRsqPThQ7wjeF YvPVUiYZCSGqN606xg49kgg1nkUBdqFXp85+U3m/NRJVJRRB8DaNyWoVYsRjQl95ms jdtMEN8vintE5A3PRW3Ov5uGuq7OQr/d6jP6M+38= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Han Xu , Fabio Estevam , Abel Vesa , Stephen Boyd , Sasha Levin Subject: [PATCH 5.15 68/83] clk: imx: imx6sx: remove the SET_RATE_PARENT flag for QSPI clocks Date: Mon, 3 Oct 2022 09:11:33 +0200 Message-Id: <20221003070723.699047440@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Han Xu [ Upstream commit b1ff1bfe81e763420afd5f3f25f0b3cbfd97055c ] There is no dedicate parent clock for QSPI so SET_RATE_PARENT flag should not be used. For instance, the default parent clock for QSPI is pll2_bus, which is also the parent clock for quite a few modules, such as MMDC, once GPMI NAND set clock rate for EDO5 mode can cause system hang due to pll2_bus rate changed. Fixes: f1541e15e38e ("clk: imx6sx: Switch to clk_hw based API") Signed-off-by: Han Xu Link: https://lore.kernel.org/r/20220915150959.3646702-1-han.xu@nxp.com Tested-by: Fabio Estevam Reviewed-by: Abel Vesa Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/clk/imx/clk-imx6sx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/clk/imx/clk-imx6sx.c b/drivers/clk/imx/clk-imx6sx.c index fc1bd23d4583..598f3cf4eba4 100644 --- a/drivers/clk/imx/clk-imx6sx.c +++ b/drivers/clk/imx/clk-imx6sx.c @@ -280,13 +280,13 @@ static void __init imx6sx_clocks_init(struct device_n= ode *ccm_node) hws[IMX6SX_CLK_SSI3_SEL] =3D imx_clk_hw_mux("ssi3_sel", = base + 0x1c, 14, 2, ssi_sels, ARRAY_SIZE(ssi_sels)); hws[IMX6SX_CLK_SSI2_SEL] =3D imx_clk_hw_mux("ssi2_sel", = base + 0x1c, 12, 2, ssi_sels, ARRAY_SIZE(ssi_sels)); hws[IMX6SX_CLK_SSI1_SEL] =3D imx_clk_hw_mux("ssi1_sel", = base + 0x1c, 10, 2, ssi_sels, ARRAY_SIZE(ssi_sels)); - hws[IMX6SX_CLK_QSPI1_SEL] =3D imx_clk_hw_mux_flags("qspi1_sel", = base + 0x1c, 7, 3, qspi1_sels, ARRAY_SIZE(qspi1_sels), CLK_SET_RATE_PARENT= ); + hws[IMX6SX_CLK_QSPI1_SEL] =3D imx_clk_hw_mux("qspi1_sel", = base + 0x1c, 7, 3, qspi1_sels, ARRAY_SIZE(qspi1_sels)); hws[IMX6SX_CLK_PERCLK_SEL] =3D imx_clk_hw_mux("perclk_sel", = base + 0x1c, 6, 1, perclk_sels, ARRAY_SIZE(perclk_sels)); hws[IMX6SX_CLK_VID_SEL] =3D imx_clk_hw_mux("vid_sel", = base + 0x20, 21, 3, vid_sels, ARRAY_SIZE(vid_sels)); hws[IMX6SX_CLK_ESAI_SEL] =3D imx_clk_hw_mux("esai_sel", = base + 0x20, 19, 2, audio_sels, ARRAY_SIZE(audio_sels)); hws[IMX6SX_CLK_CAN_SEL] =3D imx_clk_hw_mux("can_sel", = base + 0x20, 8, 2, can_sels, ARRAY_SIZE(can_sels)); hws[IMX6SX_CLK_UART_SEL] =3D imx_clk_hw_mux("uart_sel", = base + 0x24, 6, 1, uart_sels, ARRAY_SIZE(uart_sels)); - hws[IMX6SX_CLK_QSPI2_SEL] =3D imx_clk_hw_mux_flags("qspi2_sel", = base + 0x2c, 15, 3, qspi2_sels, ARRAY_SIZE(qspi2_sels), CLK_SET_RATE_PARENT= ); + hws[IMX6SX_CLK_QSPI2_SEL] =3D imx_clk_hw_mux("qspi2_sel", = base + 0x2c, 15, 3, qspi2_sels, ARRAY_SIZE(qspi2_sels)); hws[IMX6SX_CLK_SPDIF_SEL] =3D imx_clk_hw_mux("spdif_sel", = base + 0x30, 20, 2, audio_sels, ARRAY_SIZE(audio_sels)); hws[IMX6SX_CLK_AUDIO_SEL] =3D imx_clk_hw_mux("audio_sel", = base + 0x30, 7, 2, audio_sels, ARRAY_SIZE(audio_sels)); hws[IMX6SX_CLK_ENET_PRE_SEL] =3D imx_clk_hw_mux("enet_pre_sel", = base + 0x34, 15, 3, enet_pre_sels, ARRAY_SIZE(enet_pre_sels)= ); --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A2A2C433F5 for ; Mon, 3 Oct 2022 07:35:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231515AbiJCHfE (ORCPT ); Mon, 3 Oct 2022 03:35:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231510AbiJCHdV (ORCPT ); Mon, 3 Oct 2022 03:33:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35BFE52096; Mon, 3 Oct 2022 00:21:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CD10EB80E98; Mon, 3 Oct 2022 07:19:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F280C433D6; Mon, 3 Oct 2022 07:19:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781572; bh=mx9ftnuzq9ci2eIbyQWEhEq6TrIUmYIY4z3AB7Ihuxs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ce560jpTt0Va0JF3/b22MpUlLcDB+Ih7zTHvTb4mjEuuVU1VBGDUhOJWHwELHvhfx JXYE/r12nsstUHmhOp5l0DYXJiHi3EU68VJppLj3olM21GhllwW4Dyvz+jK0S9rFzA Jn/I+ZiL1pY4JYcYYpmYqqLztG/eHeMctXyDbQPw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Stephen Boyd , Sasha Levin Subject: [PATCH 5.15 69/83] clk: iproc: Do not rely on node name for correct PLL setup Date: Mon, 3 Oct 2022 09:11:34 +0200 Message-Id: <20221003070723.722996149@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Florian Fainelli [ Upstream commit 1b24a132eba7a1c19475ba2510ec1c00af3ff914 ] After commit 31fd9b79dc58 ("ARM: dts: BCM5301X: update CRU block description") a warning from clk-iproc-pll.c was generated due to a duplicate PLL name as well as the console stopped working. Upon closer inspection it became clear that iproc_pll_clk_setup() used the Device Tree node unit name as an unique identifier as well as a parent name to parent all clocks under the PLL. BCM5301X was the first platform on which that got noticed because of the DT node unit name renaming but the same assumptions hold true for any user of the iproc_pll_clk_setup() function. The first 'clock-output-names' property is always guaranteed to be unique as well as providing the actual desired PLL clock name, so we utilize that to register the PLL and as a parent name of all children clock. Fixes: 5fe225c105fd ("clk: iproc: add initial common clock support") Signed-off-by: Florian Fainelli Acked-by: Rafa=C5=82 Mi=C5=82ecki Link: https://lore.kernel.org/r/20220905161504.1526-1-f.fainelli@gmail.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/clk/bcm/clk-iproc-pll.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/clk/bcm/clk-iproc-pll.c b/drivers/clk/bcm/clk-iproc-pl= l.c index 33da30f99c79..d39c44b61c52 100644 --- a/drivers/clk/bcm/clk-iproc-pll.c +++ b/drivers/clk/bcm/clk-iproc-pll.c @@ -736,6 +736,7 @@ void iproc_pll_clk_setup(struct device_node *node, const char *parent_name; struct iproc_clk *iclk_array; struct clk_hw_onecell_data *clk_data; + const char *clk_name; =20 if (WARN_ON(!pll_ctrl) || WARN_ON(!clk_ctrl)) return; @@ -783,7 +784,12 @@ void iproc_pll_clk_setup(struct device_node *node, iclk =3D &iclk_array[0]; iclk->pll =3D pll; =20 - init.name =3D node->name; + ret =3D of_property_read_string_index(node, "clock-output-names", + 0, &clk_name); + if (WARN_ON(ret)) + goto err_pll_register; + + init.name =3D clk_name; init.ops =3D &iproc_pll_ops; init.flags =3D 0; parent_name =3D of_clk_get_parent_name(node, 0); @@ -803,13 +809,11 @@ void iproc_pll_clk_setup(struct device_node *node, goto err_pll_register; =20 clk_data->hws[0] =3D &iclk->hw; + parent_name =3D clk_name; =20 /* now initialize and register all leaf clocks */ for (i =3D 1; i < num_clks; i++) { - const char *clk_name; - memset(&init, 0, sizeof(init)); - parent_name =3D node->name; =20 ret =3D of_property_read_string_index(node, "clock-output-names", i, &clk_name); --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74AD5C433F5 for ; Mon, 3 Oct 2022 07:30:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231394AbiJCHaZ (ORCPT ); Mon, 3 Oct 2022 03:30:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231387AbiJCH26 (ORCPT ); Mon, 3 Oct 2022 03:28:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFDE01018; Mon, 3 Oct 2022 00:19:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 72313B80E95; Mon, 3 Oct 2022 07:19:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E10FBC433C1; Mon, 3 Oct 2022 07:19:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781575; bh=2BT/09rp4C8+jPg12InhUK6xH/uesRF7DABT2lfDI7Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oPLs8XKM4ghCj14lUX1mYlotuIccE5ytTvSf6zauVzxqR/LRE4koZA22YeT6QFsSi d5WeknLjILIh+qLLWS3fAZXBtd3+2wsoA1+B95cDMRSIAoyis75xTYVIgFaQFjuDfS b54v/ZftiB6+V3YIO7p+ovkFZPOGLsWz9nKKZ/mE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jim Mattson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.15 70/83] KVM: x86: Hide IA32_PLATFORM_DCA_CAP[31:0] from the guest Date: Mon, 3 Oct 2022 09:11:35 +0200 Message-Id: <20221003070723.747928220@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jim Mattson [ Upstream commit aae2e72229cdb21f90df2dbe4244c977e5d3265b ] The only thing reported by CPUID.9 is the value of IA32_PLATFORM_DCA_CAP[31:0] in EAX. This MSR doesn't even exist in the guest, since CPUID.1:ECX.DCA[bit 18] is clear in the guest. Clear CPUID.9 in KVM_GET_SUPPORTED_CPUID. Fixes: 24c82e576b78 ("KVM: Sanitize cpuid") Signed-off-by: Jim Mattson Message-Id: <20220922231854.249383-1-jmattson@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- arch/x86/kvm/cpuid.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index b17c9b00669e..d85a0808a446 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -718,8 +718,6 @@ static inline int __do_cpuid_func(struct kvm_cpuid_arra= y *array, u32 function) entry->edx =3D 0; } break; - case 9: - break; case 0xa: { /* Architectural Performance Monitoring */ struct x86_pmu_capability cap; union cpuid10_eax eax; --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1EFBC433FE for ; Mon, 3 Oct 2022 07:30:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231417AbiJCHad (ORCPT ); Mon, 3 Oct 2022 03:30:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231445AbiJCH3J (ORCPT ); Mon, 3 Oct 2022 03:29:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18D0A2BDD; Mon, 3 Oct 2022 00:19:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 210BAB80E85; Mon, 3 Oct 2022 07:19:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5849FC433D6; Mon, 3 Oct 2022 07:19:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781577; bh=bQOQHFWXu0Y1xHZRrvTz4L2+IME1DPD6dr71obT4YDM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AmxX4gkJME4pKQ6Szs7ZWMB8JhFs5sjMWuM4uxvVbqabO/tJeanVmAjQ1Kw/iITm3 j6F3yn0q4XrqjYlhNvuzXC0hycZ3nyjH5Sdaarf6oHdFrNxOmduSHsxesK0+WxmmLb +cqxQEQqIpjuQu06qcPFoaHzo0ErDyf+dpfSgA4Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Rogers , Andi Kleen , Adrian Hunter , Alexander Antonov , Alexander Shishkin , Andrew Kilroy , Andrew Morton , Changbin Du , Denys Zagorui , Fabian Hemmer , Felix Fietkau , Heiko Carstens , Ingo Molnar , Jacob Keller , Jiapeng Chong , Jin Yao , Jiri Olsa , Joakim Zhang , John Garry , Kajol Jain , Kan Liang , Kees Kook , Mark Rutland , Namhyung Kim , Nicholas Fraser , Nick Desaulniers , Paul Clarke , Peter Zijlstra , Riccardo Mancini , Sami Tolvanen , ShihCheng Tu , Song Liu , Stephane Eranian , Sumanth Korikkar , Thomas Richter , Wan Jiabing , Zhen Lei , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.15 71/83] perf metric: Add documentation and rename a variable. Date: Mon, 3 Oct 2022 09:11:36 +0200 Message-Id: <20221003070723.771956822@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ian Rogers [ Upstream commit 68074811dfb9529bb7cade0e67d42c7f7bf209e6 ] Documentation to make current functionality clearer. Rename a variable called 'metric' to 'metric_name' as it can be ambiguous as to whether a string is the name of a metric or the expression. Signed-off-by: Ian Rogers Acked-by: Andi Kleen Cc: Adrian Hunter Cc: Alexander Antonov Cc: Alexander Shishkin Cc: Andrew Kilroy Cc: Andrew Morton Cc: Changbin Du Cc: Denys Zagorui Cc: Fabian Hemmer Cc: Felix Fietkau Cc: Heiko Carstens Cc: Ingo Molnar Cc: Jacob Keller Cc: Jiapeng Chong Cc: Jin Yao Cc: Jiri Olsa Cc: Joakim Zhang Cc: John Garry Cc: Kajol Jain Cc: Kan Liang Cc: Kees Kook Cc: Mark Rutland Cc: Namhyung Kim Cc: Nicholas Fraser Cc: Nick Desaulniers Cc: Paul Clarke Cc: Peter Zijlstra Cc: Riccardo Mancini Cc: Sami Tolvanen Cc: ShihCheng Tu Cc: Song Liu Cc: Stephane Eranian Cc: Sumanth Korikkar Cc: Thomas Richter Cc: Wan Jiabing Cc: Zhen Lei Link: https://lore.kernel.org/r/20211015172132.1162559-7-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo Stable-dep-of: 71c86cda750b ("perf parse-events: Remove "not supported" hyb= rid cache events") Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- tools/perf/util/metricgroup.c | 59 ++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c index 29b747ac31c1..2dc2a0dcf846 100644 --- a/tools/perf/util/metricgroup.c +++ b/tools/perf/util/metricgroup.c @@ -772,13 +772,27 @@ int __weak arch_get_runtimeparam(struct pmu_event *pe= __maybe_unused) =20 struct metricgroup_add_iter_data { struct list_head *metric_list; - const char *metric; + const char *metric_name; struct expr_ids *ids; int *ret; bool *has_match; bool metric_no_group; }; =20 +/** + * __add_metric - Add a metric to metric_list. + * @metric_list: The list the metric is added to. + * @pe: The pmu_event containing the metric to be added. + * @metric_no_group: Should events written to events be grouped "{}" or + * global. Grouping is the default but due to multiplexi= ng the + * user may override. + * @runtime: A special argument for the parser only known at runtime. + * @mp: The pointer to a location holding the first metric added to metric + * list. It is initialized here if this is the first metric. + * @parent: The last entry in a linked list of metrics being + * added/resolved. This is maintained to detect recursion. + * @ids: Storage for parent list. + */ static int __add_metric(struct list_head *metric_list, struct pmu_event *pe, bool metric_no_group, @@ -1068,7 +1082,7 @@ static int metricgroup__add_metric_sys_event_iter(str= uct pmu_event *pe, struct metric *m =3D NULL; int ret; =20 - if (!match_pe_metric(pe, d->metric)) + if (!match_pe_metric(pe, d->metric_name)) return 0; =20 ret =3D add_metric(d->metric_list, pe, d->metric_no_group, &m, NULL, d->i= ds); @@ -1087,7 +1101,22 @@ static int metricgroup__add_metric_sys_event_iter(st= ruct pmu_event *pe, return ret; } =20 -static int metricgroup__add_metric(const char *metric, bool metric_no_grou= p, +/** + * metricgroup__add_metric - Find and add a metric, or a metric group. + * @metric_name: The name of the metric or metric group. For example, "IPC" + * could be the name of a metric and "TopDownL1" the name of= a + * metric group. + * @metric_no_group: Should events written to events be grouped "{}" or + * global. Grouping is the default but due to multiplexi= ng the + * user may override. + * @events: an out argument string of events that need to be parsed and + * associated with the metric. For example, the metric "IPC" would + * create an events string like "{instructions,cycles}:W". + * @metric_list: The list that the metric or metric group are added to. + * @map: The map that is searched for metrics, most commonly the table for= the + * architecture perf is running upon. + */ +static int metricgroup__add_metric(const char *metric_name, bool metric_no= _group, struct strbuf *events, struct list_head *metric_list, struct pmu_events_map *map) @@ -1099,7 +1128,11 @@ static int metricgroup__add_metric(const char *metri= c, bool metric_no_group, int i, ret; bool has_match =3D false; =20 - map_for_each_metric(pe, i, map, metric) { + /* + * Iterate over all metrics seeing if metric matches either the name or + * group. When it does add the metric to the list. + */ + map_for_each_metric(pe, i, map, metric_name) { has_match =3D true; m =3D NULL; =20 @@ -1122,7 +1155,7 @@ static int metricgroup__add_metric(const char *metric= , bool metric_no_group, .fn =3D metricgroup__add_metric_sys_event_iter, .data =3D (void *) &(struct metricgroup_add_iter_data) { .metric_list =3D &list, - .metric =3D metric, + .metric_name =3D metric_name, .metric_no_group =3D metric_no_group, .ids =3D &ids, .has_match =3D &has_match, @@ -1161,6 +1194,22 @@ static int metricgroup__add_metric(const char *metri= c, bool metric_no_group, return ret; } =20 +/** + * metricgroup__add_metric_list - Find and add metrics, or metric groups, + * specified in a list. + * @list: the list of metrics or metric groups. For example, "IPC,CPI,TopD= ownL1" + * would match the IPC and CPI metrics, and TopDownL1 would match a= ll + * the metrics in the TopDownL1 group. + * @metric_no_group: Should events written to events be grouped "{}" or + * global. Grouping is the default but due to multiplexi= ng the + * user may override. + * @events: an out argument string of events that need to be parsed and + * associated with the metric. For example, the metric "IPC" would + * create an events string like "{instructions,cycles}:W". + * @metric_list: The list that metrics are added to. + * @map: The map that is searched for metrics, most commonly the table for= the + * architecture perf is running upon. + */ static int metricgroup__add_metric_list(const char *list, bool metric_no_g= roup, struct strbuf *events, struct list_head *metric_list, --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8083DC433F5 for ; Mon, 3 Oct 2022 07:35:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231520AbiJCHfL (ORCPT ); Mon, 3 Oct 2022 03:35:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231476AbiJCHdV (ORCPT ); Mon, 3 Oct 2022 03:33:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E1994F640; Mon, 3 Oct 2022 00:21:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AD601B80E7D; Mon, 3 Oct 2022 07:19:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02249C433C1; Mon, 3 Oct 2022 07:19:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781580; bh=hcALJk6w4RJCnEaUh4SaKtByjsv5qo91nSSo7OY8+j8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zi2ApA0RrwAcEPGy+gAH4lvQt6elVKE5VLaAwc+qmzkCN9g6sutajCo4PSMCDoRmY oG2Lys7DcsB3oVjGWBjCR3JXuiMawkJLLFNyEx+MQCNrnDm5eiIFQP/zVffqlSR1sp g2Gyvcq6/ABzh+9byHPEPKrc8uVQSBdqt5r3N/Vc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Rogers , Andi Kleen , Adrian Hunter , Alexander Antonov , Alexander Shishkin , Andrew Kilroy , Andrew Morton , Changbin Du , Denys Zagorui , Fabian Hemmer , Felix Fietkau , Heiko Carstens , Ingo Molnar , Jacob Keller , Jiapeng Chong , Jin Yao , Jiri Olsa , Joakim Zhang , John Garry , Kajol Jain , Kan Liang , Kees Kook , Mark Rutland , Namhyung Kim , Nicholas Fraser , Nick Desaulniers , Paul Clarke , Peter Zijlstra , Riccardo Mancini , Sami Tolvanen , ShihCheng Tu , Song Liu , Stephane Eranian , Sumanth Korikkar , Thomas Richter , Wan Jiabing , Zhen Lei , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.15 72/83] perf metric: Only add a referenced metric once Date: Mon, 3 Oct 2022 09:11:37 +0200 Message-Id: <20221003070723.796603884@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ian Rogers [ Upstream commit a3de76903dd0786a8661e9e6eb9054a7519e10e7 ] If a metric references other metrics then the same other metrics may be referenced more than once, but the events and metric ref are only needed once. An example of this is in tests/parse-metric.c where DCache_L2_Hits references the metric DCache_L2_All_Hits twice, once directly and once through DCache_L2_All. Signed-off-by: Ian Rogers Acked-by: Andi Kleen Cc: Adrian Hunter Cc: Alexander Antonov Cc: Alexander Shishkin Cc: Andrew Kilroy Cc: Andrew Morton Cc: Changbin Du Cc: Denys Zagorui Cc: Fabian Hemmer Cc: Felix Fietkau Cc: Heiko Carstens Cc: Ingo Molnar Cc: Jacob Keller Cc: Jiapeng Chong Cc: Jin Yao Cc: Jiri Olsa Cc: Joakim Zhang Cc: John Garry Cc: Kajol Jain Cc: Kan Liang Cc: Kees Kook Cc: Mark Rutland Cc: Namhyung Kim Cc: Nicholas Fraser Cc: Nick Desaulniers Cc: Paul Clarke Cc: Peter Zijlstra Cc: Riccardo Mancini Cc: Sami Tolvanen Cc: ShihCheng Tu Cc: Song Liu Cc: Stephane Eranian Cc: Sumanth Korikkar Cc: Thomas Richter Cc: Wan Jiabing Cc: Zhen Lei Link: https://lore.kernel.org/r/20211015172132.1162559-9-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo Stable-dep-of: 71c86cda750b ("perf parse-events: Remove "not supported" hyb= rid cache events") Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- tools/perf/util/metricgroup.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c index 2dc2a0dcf846..ec8195f1ab50 100644 --- a/tools/perf/util/metricgroup.c +++ b/tools/perf/util/metricgroup.c @@ -836,12 +836,18 @@ static int __add_metric(struct list_head *metric_list, *mp =3D m; } else { /* - * We got here for the referenced metric, via the - * recursive metricgroup__add_metric call, add - * it to the parent group. + * This metric was referenced in a metric higher in the + * tree. Check if the same metric is already resolved in the + * metric_refs list. */ m =3D *mp; =20 + list_for_each_entry(ref, &m->metric_refs, list) { + if (!strcmp(pe->metric_name, ref->metric_name)) + return 0; + } + + /*Add the new referenced metric to the pare the parent group. */ ref =3D malloc(sizeof(*ref)); if (!ref) return -ENOMEM; --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFCB3C433FE for ; Mon, 3 Oct 2022 07:29:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231259AbiJCH3p (ORCPT ); Mon, 3 Oct 2022 03:29:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230429AbiJCH2Z (ORCPT ); Mon, 3 Oct 2022 03:28:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6046165C3; Mon, 3 Oct 2022 00:19:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B9A4F60FBE; Mon, 3 Oct 2022 07:19:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4B08C433D7; Mon, 3 Oct 2022 07:19:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781583; bh=+U/7IA84oEAPfzBWLBWXdBsqQrJvwKuxeWtwTf6fQww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BylrFsrxTmzKurXwGj3wad2gfDhZoOgKf/tMn9NcqmxL8pZFa39/ZXllo41/DiODA kr/autIwfKiR/lqvdLzNhA4whVP1ScZ6StlAoIqHb6LpaHX+YvzR5i4n4gpTCK1UdN MvDs3idO1Qr5fIr3t84vB6XEdJMslauV8XW16Dbk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Rogers , Andi Kleen , Adrian Hunter , Alexander Antonov , Alexander Shishkin , Andrew Kilroy , Andrew Morton , Changbin Du , Denys Zagorui , Fabian Hemmer , Felix Fietkau , Heiko Carstens , Ingo Molnar , Jacob Keller , Jiapeng Chong , Jin Yao , Jiri Olsa , Joakim Zhang , John Garry , Kajol Jain , Kan Liang , Kees Kook , Mark Rutland , Namhyung Kim , Nicholas Fraser , Nick Desaulniers , Paul Clarke , Peter Zijlstra , Riccardo Mancini , Sami Tolvanen , ShihCheng Tu , Song Liu , Stephane Eranian , Sumanth Korikkar , Thomas Richter , Wan Jiabing , Zhen Lei , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.15 73/83] perf parse-events: Add const to evsel name Date: Mon, 3 Oct 2022 09:11:38 +0200 Message-Id: <20221003070723.822004135@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ian Rogers [ Upstream commit 8e8bbfb311a26a17834f1839e15e2c29ea5e58c6 ] The evsel name is strdup-ed before assignment and so can be const. A later change will add another similar string. Using const makes it clearer that these are not out arguments. Signed-off-by: Ian Rogers Acked-by: Andi Kleen Cc: Adrian Hunter Cc: Alexander Antonov Cc: Alexander Shishkin Cc: Andrew Kilroy Cc: Andrew Morton Cc: Changbin Du Cc: Denys Zagorui Cc: Fabian Hemmer Cc: Felix Fietkau Cc: Heiko Carstens Cc: Ingo Molnar Cc: Jacob Keller Cc: Jiapeng Chong Cc: Jin Yao Cc: Jiri Olsa Cc: Joakim Zhang Cc: John Garry Cc: Kajol Jain Cc: Kan Liang Cc: Kees Kook Cc: Mark Rutland Cc: Namhyung Kim Cc: Nicholas Fraser Cc: Nick Desaulniers Cc: Paul Clarke Cc: Peter Zijlstra Cc: Riccardo Mancini Cc: Sami Tolvanen Cc: ShihCheng Tu Cc: Song Liu Cc: Stephane Eranian Cc: Sumanth Korikkar Cc: Thomas Richter Cc: Wan Jiabing Cc: Zhen Lei Link: https://lore.kernel.org/r/20211015172132.1162559-14-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo Stable-dep-of: 71c86cda750b ("perf parse-events: Remove "not supported" hyb= rid cache events") Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- tools/perf/util/parse-events-hybrid.c | 15 +++++++++------ tools/perf/util/parse-events-hybrid.h | 6 ++++-- tools/perf/util/parse-events.c | 15 ++++++++------- tools/perf/util/parse-events.h | 7 ++++--- tools/perf/util/pmu.c | 2 +- tools/perf/util/pmu.h | 2 +- 6 files changed, 27 insertions(+), 20 deletions(-) diff --git a/tools/perf/util/parse-events-hybrid.c b/tools/perf/util/parse-= events-hybrid.c index b234d95fb10a..7e44deee1343 100644 --- a/tools/perf/util/parse-events-hybrid.c +++ b/tools/perf/util/parse-events-hybrid.c @@ -38,7 +38,7 @@ static void config_hybrid_attr(struct perf_event_attr *at= tr, =20 static int create_event_hybrid(__u32 config_type, int *idx, struct list_head *list, - struct perf_event_attr *attr, char *name, + struct perf_event_attr *attr, const char *name, struct list_head *config_terms, struct perf_pmu *pmu) { @@ -70,7 +70,7 @@ static int pmu_cmp(struct parse_events_state *parse_state, =20 static int add_hw_hybrid(struct parse_events_state *parse_state, struct list_head *list, struct perf_event_attr *attr, - char *name, struct list_head *config_terms) + const char *name, struct list_head *config_terms) { struct perf_pmu *pmu; int ret; @@ -94,7 +94,8 @@ static int add_hw_hybrid(struct parse_events_state *parse= _state, } =20 static int create_raw_event_hybrid(int *idx, struct list_head *list, - struct perf_event_attr *attr, char *name, + struct perf_event_attr *attr, + const char *name, struct list_head *config_terms, struct perf_pmu *pmu) { @@ -113,7 +114,7 @@ static int create_raw_event_hybrid(int *idx, struct lis= t_head *list, =20 static int add_raw_hybrid(struct parse_events_state *parse_state, struct list_head *list, struct perf_event_attr *attr, - char *name, struct list_head *config_terms) + const char *name, struct list_head *config_terms) { struct perf_pmu *pmu; int ret; @@ -138,7 +139,8 @@ static int add_raw_hybrid(struct parse_events_state *pa= rse_state, int parse_events__add_numeric_hybrid(struct parse_events_state *parse_stat= e, struct list_head *list, struct perf_event_attr *attr, - char *name, struct list_head *config_terms, + const char *name, + struct list_head *config_terms, bool *hybrid) { *hybrid =3D false; @@ -159,7 +161,8 @@ int parse_events__add_numeric_hybrid(struct parse_event= s_state *parse_state, } =20 int parse_events__add_cache_hybrid(struct list_head *list, int *idx, - struct perf_event_attr *attr, char *name, + struct perf_event_attr *attr, + const char *name, struct list_head *config_terms, bool *hybrid, struct parse_events_state *parse_state) diff --git a/tools/perf/util/parse-events-hybrid.h b/tools/perf/util/parse-= events-hybrid.h index f33bd67aa851..25a4a4f73f3a 100644 --- a/tools/perf/util/parse-events-hybrid.h +++ b/tools/perf/util/parse-events-hybrid.h @@ -11,11 +11,13 @@ int parse_events__add_numeric_hybrid(struct parse_events_state *parse_stat= e, struct list_head *list, struct perf_event_attr *attr, - char *name, struct list_head *config_terms, + const char *name, + struct list_head *config_terms, bool *hybrid); =20 int parse_events__add_cache_hybrid(struct list_head *list, int *idx, - struct perf_event_attr *attr, char *name, + struct perf_event_attr *attr, + const char *name, struct list_head *config_terms, bool *hybrid, struct parse_events_state *parse_state); diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index b93a36ffeb9e..aaeebf0752b7 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -347,7 +347,7 @@ static int parse_events__is_name_term(struct parse_even= ts_term *term) return term->type_term =3D=3D PARSE_EVENTS__TERM_TYPE_NAME; } =20 -static char *get_config_name(struct list_head *head_terms) +static const char *get_config_name(struct list_head *head_terms) { struct parse_events_term *term; =20 @@ -365,7 +365,7 @@ static struct evsel * __add_event(struct list_head *list, int *idx, struct perf_event_attr *attr, bool init_attr, - char *name, struct perf_pmu *pmu, + const char *name, struct perf_pmu *pmu, struct list_head *config_terms, bool auto_merge_stats, const char *cpu_list) { @@ -404,14 +404,14 @@ __add_event(struct list_head *list, int *idx, } =20 struct evsel *parse_events__add_event(int idx, struct perf_event_attr *att= r, - char *name, struct perf_pmu *pmu) + const char *name, struct perf_pmu *pmu) { return __add_event(NULL, &idx, attr, false, name, pmu, NULL, false, NULL); } =20 static int add_event(struct list_head *list, int *idx, - struct perf_event_attr *attr, char *name, + struct perf_event_attr *attr, const char *name, struct list_head *config_terms) { return __add_event(list, idx, attr, true, name, NULL, config_terms, @@ -474,7 +474,8 @@ int parse_events_add_cache(struct list_head *list, int = *idx, { struct perf_event_attr attr; LIST_HEAD(config_terms); - char name[MAX_NAME_LEN], *config_name; + char name[MAX_NAME_LEN]; + const char *config_name; int cache_type =3D -1, cache_op =3D -1, cache_result =3D -1; char *op_result[2] =3D { op_result1, op_result2 }; int i, n, ret; @@ -2038,7 +2039,7 @@ int parse_events__modifier_event(struct list_head *li= st, char *str, bool add) return 0; } =20 -int parse_events_name(struct list_head *list, char *name) +int parse_events_name(struct list_head *list, const char *name) { struct evsel *evsel; =20 @@ -3295,7 +3296,7 @@ char *parse_events_formats_error_string(char *additio= nal_terms) =20 struct evsel *parse_events__add_event_hybrid(struct list_head *list, int *= idx, struct perf_event_attr *attr, - char *name, struct perf_pmu *pmu, + const char *name, struct perf_pmu *pmu, struct list_head *config_terms) { return __add_event(list, idx, attr, true, name, pmu, diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index bf6e41aa9b6a..6ef506c1b29e 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h @@ -162,7 +162,7 @@ void parse_events_terms__purge(struct list_head *terms); void parse_events__clear_array(struct parse_events_array *a); int parse_events__modifier_event(struct list_head *list, char *str, bool a= dd); int parse_events__modifier_group(struct list_head *list, char *event_mod); -int parse_events_name(struct list_head *list, char *name); +int parse_events_name(struct list_head *list, const char *name); int parse_events_add_tracepoint(struct list_head *list, int *idx, const char *sys, const char *event, struct parse_events_error *error, @@ -200,7 +200,7 @@ int parse_events_add_pmu(struct parse_events_state *par= se_state, bool use_alias); =20 struct evsel *parse_events__add_event(int idx, struct perf_event_attr *att= r, - char *name, struct perf_pmu *pmu); + const char *name, struct perf_pmu *pmu); =20 int parse_events_multi_pmu_add(struct parse_events_state *parse_state, char *str, @@ -267,7 +267,8 @@ int perf_pmu__test_parse_init(void); =20 struct evsel *parse_events__add_event_hybrid(struct list_head *list, int *= idx, struct perf_event_attr *attr, - char *name, struct perf_pmu *pmu, + const char *name, + struct perf_pmu *pmu, struct list_head *config_terms); =20 #endif /* __PERF_PARSE_EVENTS_H */ diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index bdabd62170d2..c647b3633d1d 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -1906,7 +1906,7 @@ int perf_pmu__caps_parse(struct perf_pmu *pmu) } =20 void perf_pmu__warn_invalid_config(struct perf_pmu *pmu, __u64 config, - char *name) + const char *name) { struct perf_pmu_format *format; __u64 masks =3D 0, bits; diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h index 394898b07fd9..dd0736de32c8 100644 --- a/tools/perf/util/pmu.h +++ b/tools/perf/util/pmu.h @@ -134,7 +134,7 @@ int perf_pmu__convert_scale(const char *scale, char **e= nd, double *sval); int perf_pmu__caps_parse(struct perf_pmu *pmu); =20 void perf_pmu__warn_invalid_config(struct perf_pmu *pmu, __u64 config, - char *name); + const char *name); =20 bool perf_pmu__has_hybrid(void); int perf_pmu__match(char *pattern, char *name, char *tok); --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 960C0C433F5 for ; Mon, 3 Oct 2022 08:22:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229691AbiJCIWq (ORCPT ); Mon, 3 Oct 2022 04:22:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230224AbiJCIWF (ORCPT ); Mon, 3 Oct 2022 04:22:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE62F7A769; Mon, 3 Oct 2022 00:56:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 481F2B80E8C; Mon, 3 Oct 2022 07:19:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CF68C433D6; Mon, 3 Oct 2022 07:19:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781586; bh=fR8PO0eKNqHcM7WtHr582VKTe0KdCUnsZg4yAb+R4gg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=poXwQOuD/Q6KZ+k1RwFo0hy7mnFEdkQuBtMPedL6Gf9pKo57ZAQTilpBHIK4RHVz+ pMt/Eig3kwcfd6ZaC8vXRrQ2iV3zfinlDd7MrB1Of4XVDsAxPmr+o4q5SbdVSUC+sD QLvJElmKuhUWQE7q0UWk7L7rI1a90rURAsMv/+l0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Rogers , Andi Kleen , Adrian Hunter , Alexander Antonov , Alexander Shishkin , Andrew Kilroy , Andrew Morton , Changbin Du , Denys Zagorui , Fabian Hemmer , Felix Fietkau , Heiko Carstens , Ingo Molnar , Jacob Keller , Jiapeng Chong , Jin Yao , Jiri Olsa , Joakim Zhang , John Garry , Kajol Jain , Kan Liang , Kees Kook , Mark Rutland , Namhyung Kim , Nicholas Fraser , Nick Desaulniers , Paul Clarke , Peter Zijlstra , Riccardo Mancini , Sami Tolvanen , ShihCheng Tu , Song Liu , Stephane Eranian , Sumanth Korikkar , Thomas Richter , Wan Jiabing , Zhen Lei , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.15 74/83] perf parse-events: Add new "metric-id" term Date: Mon, 3 Oct 2022 09:11:39 +0200 Message-Id: <20221003070723.848985048@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ian Rogers [ Upstream commit 2b62b3a611715d3ca612e3225cf436277ed9648b ] Add a new "metric-id" term to events so that metric parsing can set an ID that can be reliably looked up. Metric parsing currently will turn a metric like "instructions/cycles" into a parse events string of "{instructions,cycles}:W". However, parse-events may change "instructions" into "instructions:u" if perf_event_paranoid=3D2. When this happens expr__resolve_id currently fails as stat-shadow adds the ID "instructions:u" to match with the counter value and the metric tries to look up the ID just "instructions". A later patch will use the new term. An example of the current problem: $ echo -1 > /proc/sys/kernel/perf_event_paranoid $ perf stat -M IPC /bin/true Performance counter stats for '/bin/true': 1,217,161 inst_retired.any # 0.97 IPC 1,250,389 cpu_clk_unhalted.thread 0.002064773 seconds time elapsed 0.002378000 seconds user 0.000000000 seconds sys $ echo 2 > /proc/sys/kernel/perf_event_paranoid $ perf stat -M IPC /bin/true Performance counter stats for '/bin/true': 150,298 inst_retired.any:u # nan IPC 187,095 cpu_clk_unhalted.thread:u 0.002042731 seconds time elapsed 0.000000000 seconds user 0.002377000 seconds sys Note: nan IPC is printed as an effect of "perf metric: Use NAN for missing event IDs." but earlier versions of perf just fail with a parse error and display no value. Signed-off-by: Ian Rogers Acked-by: Andi Kleen Cc: Adrian Hunter Cc: Alexander Antonov Cc: Alexander Shishkin Cc: Andrew Kilroy Cc: Andrew Morton Cc: Changbin Du Cc: Denys Zagorui Cc: Fabian Hemmer Cc: Felix Fietkau Cc: Heiko Carstens Cc: Ingo Molnar Cc: Jacob Keller Cc: Jiapeng Chong Cc: Jin Yao Cc: Jiri Olsa Cc: Joakim Zhang Cc: John Garry Cc: Kajol Jain Cc: Kan Liang Cc: Kees Kook Cc: Mark Rutland Cc: Namhyung Kim Cc: Nicholas Fraser Cc: Nick Desaulniers Cc: Paul Clarke Cc: Peter Zijlstra Cc: Riccardo Mancini Cc: Sami Tolvanen Cc: ShihCheng Tu Cc: Song Liu Cc: Stephane Eranian Cc: Sumanth Korikkar Cc: Thomas Richter Cc: Wan Jiabing Cc: Zhen Lei Link: https://lore.kernel.org/r/20211015172132.1162559-15-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo Stable-dep-of: 71c86cda750b ("perf parse-events: Remove "not supported" hyb= rid cache events") Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- tools/perf/util/evsel.c | 17 +++++ tools/perf/util/evsel.h | 2 + tools/perf/util/parse-events-hybrid.c | 25 ++++--- tools/perf/util/parse-events-hybrid.h | 4 +- tools/perf/util/parse-events.c | 95 ++++++++++++++++++--------- tools/perf/util/parse-events.h | 5 +- tools/perf/util/parse-events.l | 1 + tools/perf/util/pfm.c | 3 +- 8 files changed, 107 insertions(+), 45 deletions(-) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index c87f9974c0c1..1e43fac90fc8 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -410,6 +410,11 @@ struct evsel *evsel__clone(struct evsel *orig) if (evsel->filter =3D=3D NULL) goto out_err; } + if (orig->metric_id) { + evsel->metric_id =3D strdup(orig->metric_id); + if (evsel->metric_id =3D=3D NULL) + goto out_err; + } evsel->cgrp =3D cgroup__get(orig->cgrp); evsel->tp_format =3D orig->tp_format; evsel->handler =3D orig->handler; @@ -779,6 +784,17 @@ const char *evsel__name(struct evsel *evsel) return "unknown"; } =20 +const char *evsel__metric_id(const struct evsel *evsel) +{ + if (evsel->metric_id) + return evsel->metric_id; + + if (evsel->core.attr.type =3D=3D PERF_TYPE_SOFTWARE && evsel->tool_event) + return "duration_time"; + + return "unknown"; +} + const char *evsel__group_name(struct evsel *evsel) { return evsel->group_name ?: "anon group"; @@ -1432,6 +1448,7 @@ void evsel__exit(struct evsel *evsel) zfree(&evsel->group_name); zfree(&evsel->name); zfree(&evsel->pmu_name); + zfree(&evsel->metric_id); evsel__zero_per_pkg(evsel); hashmap__free(evsel->per_pkg_mask); evsel->per_pkg_mask =3D NULL; diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index 1f7edfa8568a..45476a888942 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h @@ -68,6 +68,7 @@ struct evsel { double scale; const char *unit; struct cgroup *cgrp; + const char *metric_id; enum perf_tool_event tool_event; /* parse modifier helper */ int exclude_GH; @@ -261,6 +262,7 @@ bool evsel__match_bpf_counter_events(const char *name); =20 int __evsel__hw_cache_type_op_res_name(u8 type, u8 op, u8 result, char *bf= , size_t size); const char *evsel__name(struct evsel *evsel); +const char *evsel__metric_id(const struct evsel *evsel); =20 const char *evsel__group_name(struct evsel *evsel); int evsel__group_desc(struct evsel *evsel, char *buf, size_t size); diff --git a/tools/perf/util/parse-events-hybrid.c b/tools/perf/util/parse-= events-hybrid.c index 7e44deee1343..9fc86971027b 100644 --- a/tools/perf/util/parse-events-hybrid.c +++ b/tools/perf/util/parse-events-hybrid.c @@ -39,6 +39,7 @@ static void config_hybrid_attr(struct perf_event_attr *at= tr, static int create_event_hybrid(__u32 config_type, int *idx, struct list_head *list, struct perf_event_attr *attr, const char *name, + const char *metric_id, struct list_head *config_terms, struct perf_pmu *pmu) { @@ -47,7 +48,7 @@ static int create_event_hybrid(__u32 config_type, int *id= x, __u64 config =3D attr->config; =20 config_hybrid_attr(attr, config_type, pmu->type); - evsel =3D parse_events__add_event_hybrid(list, idx, attr, name, + evsel =3D parse_events__add_event_hybrid(list, idx, attr, name, metric_id, pmu, config_terms); if (evsel) evsel->pmu_name =3D strdup(pmu->name); @@ -70,7 +71,8 @@ static int pmu_cmp(struct parse_events_state *parse_state, =20 static int add_hw_hybrid(struct parse_events_state *parse_state, struct list_head *list, struct perf_event_attr *attr, - const char *name, struct list_head *config_terms) + const char *name, const char *metric_id, + struct list_head *config_terms) { struct perf_pmu *pmu; int ret; @@ -84,7 +86,7 @@ static int add_hw_hybrid(struct parse_events_state *parse= _state, copy_config_terms(&terms, config_terms); ret =3D create_event_hybrid(PERF_TYPE_HARDWARE, &parse_state->idx, list, attr, name, - &terms, pmu); + metric_id, &terms, pmu); free_config_terms(&terms); if (ret) return ret; @@ -96,13 +98,14 @@ static int add_hw_hybrid(struct parse_events_state *par= se_state, static int create_raw_event_hybrid(int *idx, struct list_head *list, struct perf_event_attr *attr, const char *name, + const char *metric_id, struct list_head *config_terms, struct perf_pmu *pmu) { struct evsel *evsel; =20 attr->type =3D pmu->type; - evsel =3D parse_events__add_event_hybrid(list, idx, attr, name, + evsel =3D parse_events__add_event_hybrid(list, idx, attr, name, metric_id, pmu, config_terms); if (evsel) evsel->pmu_name =3D strdup(pmu->name); @@ -114,7 +117,8 @@ static int create_raw_event_hybrid(int *idx, struct lis= t_head *list, =20 static int add_raw_hybrid(struct parse_events_state *parse_state, struct list_head *list, struct perf_event_attr *attr, - const char *name, struct list_head *config_terms) + const char *name, const char *metric_id, + struct list_head *config_terms) { struct perf_pmu *pmu; int ret; @@ -127,7 +131,7 @@ static int add_raw_hybrid(struct parse_events_state *pa= rse_state, =20 copy_config_terms(&terms, config_terms); ret =3D create_raw_event_hybrid(&parse_state->idx, list, attr, - name, &terms, pmu); + name, metric_id, &terms, pmu); free_config_terms(&terms); if (ret) return ret; @@ -139,7 +143,7 @@ static int add_raw_hybrid(struct parse_events_state *pa= rse_state, int parse_events__add_numeric_hybrid(struct parse_events_state *parse_stat= e, struct list_head *list, struct perf_event_attr *attr, - const char *name, + const char *name, const char *metric_id, struct list_head *config_terms, bool *hybrid) { @@ -152,17 +156,18 @@ int parse_events__add_numeric_hybrid(struct parse_eve= nts_state *parse_state, =20 *hybrid =3D true; if (attr->type !=3D PERF_TYPE_RAW) { - return add_hw_hybrid(parse_state, list, attr, name, + return add_hw_hybrid(parse_state, list, attr, name, metric_id, config_terms); } =20 - return add_raw_hybrid(parse_state, list, attr, name, + return add_raw_hybrid(parse_state, list, attr, name, metric_id, config_terms); } =20 int parse_events__add_cache_hybrid(struct list_head *list, int *idx, struct perf_event_attr *attr, const char *name, + const char *metric_id, struct list_head *config_terms, bool *hybrid, struct parse_events_state *parse_state) @@ -183,7 +188,7 @@ int parse_events__add_cache_hybrid(struct list_head *li= st, int *idx, =20 copy_config_terms(&terms, config_terms); ret =3D create_event_hybrid(PERF_TYPE_HW_CACHE, idx, list, - attr, name, &terms, pmu); + attr, name, metric_id, &terms, pmu); free_config_terms(&terms); if (ret) return ret; diff --git a/tools/perf/util/parse-events-hybrid.h b/tools/perf/util/parse-= events-hybrid.h index 25a4a4f73f3a..cbc05fec02a2 100644 --- a/tools/perf/util/parse-events-hybrid.h +++ b/tools/perf/util/parse-events-hybrid.h @@ -11,13 +11,13 @@ int parse_events__add_numeric_hybrid(struct parse_events_state *parse_stat= e, struct list_head *list, struct perf_event_attr *attr, - const char *name, + const char *name, const char *metric_id, struct list_head *config_terms, bool *hybrid); =20 int parse_events__add_cache_hybrid(struct list_head *list, int *idx, struct perf_event_attr *attr, - const char *name, + const char *name, const char *metric_id, struct list_head *config_terms, bool *hybrid, struct parse_events_state *parse_state); diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index aaeebf0752b7..e62514577b97 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -342,12 +342,7 @@ const char *event_type(int type) return "unknown"; } =20 -static int parse_events__is_name_term(struct parse_events_term *term) -{ - return term->type_term =3D=3D PARSE_EVENTS__TERM_TYPE_NAME; -} - -static const char *get_config_name(struct list_head *head_terms) +static char *get_config_str(struct list_head *head_terms, int type_term) { struct parse_events_term *term; =20 @@ -355,17 +350,27 @@ static const char *get_config_name(struct list_head *= head_terms) return NULL; =20 list_for_each_entry(term, head_terms, list) - if (parse_events__is_name_term(term)) + if (term->type_term =3D=3D type_term) return term->val.str; =20 return NULL; } =20 +static char *get_config_metric_id(struct list_head *head_terms) +{ + return get_config_str(head_terms, PARSE_EVENTS__TERM_TYPE_METRIC_ID); +} + +static char *get_config_name(struct list_head *head_terms) +{ + return get_config_str(head_terms, PARSE_EVENTS__TERM_TYPE_NAME); +} + static struct evsel * __add_event(struct list_head *list, int *idx, struct perf_event_attr *attr, bool init_attr, - const char *name, struct perf_pmu *pmu, + const char *name, const char *metric_id, struct perf_pmu *pmu, struct list_head *config_terms, bool auto_merge_stats, const char *cpu_list) { @@ -394,6 +399,9 @@ __add_event(struct list_head *list, int *idx, if (name) evsel->name =3D strdup(name); =20 + if (metric_id) + evsel->metric_id =3D strdup(metric_id); + if (config_terms) list_splice_init(config_terms, &evsel->config_terms); =20 @@ -404,18 +412,21 @@ __add_event(struct list_head *list, int *idx, } =20 struct evsel *parse_events__add_event(int idx, struct perf_event_attr *att= r, - const char *name, struct perf_pmu *pmu) + const char *name, const char *metric_id, + struct perf_pmu *pmu) { - return __add_event(NULL, &idx, attr, false, name, pmu, NULL, false, - NULL); + return __add_event(/*list=3D*/NULL, &idx, attr, /*init_attr=3D*/false, na= me, + metric_id, pmu, /*config_terms=3D*/NULL, + /*auto_merge_stats=3D*/false, /*cpu_list=3D*/NULL); } =20 static int add_event(struct list_head *list, int *idx, struct perf_event_attr *attr, const char *name, - struct list_head *config_terms) + const char *metric_id, struct list_head *config_terms) { - return __add_event(list, idx, attr, true, name, NULL, config_terms, - false, NULL) ? 0 : -ENOMEM; + return __add_event(list, idx, attr, /*init_attr*/true, name, metric_id, + /*pmu=3D*/NULL, config_terms, + /*auto_merge_stats=3D*/false, /*cpu_list=3D*/NULL) ? 0 : -ENOMEM; } =20 static int add_event_tool(struct list_head *list, int *idx, @@ -427,8 +438,10 @@ static int add_event_tool(struct list_head *list, int = *idx, .config =3D PERF_COUNT_SW_DUMMY, }; =20 - evsel =3D __add_event(list, idx, &attr, true, NULL, NULL, NULL, false, - "0"); + evsel =3D __add_event(list, idx, &attr, /*init_attr=3D*/true, /*name=3D*/= NULL, + /*metric_id=3D*/NULL, /*pmu=3D*/NULL, + /*config_terms=3D*/NULL, /*auto_merge_stats=3D*/false, + /*cpu_list=3D*/"0"); if (!evsel) return -ENOMEM; evsel->tool_event =3D tool_event; @@ -475,7 +488,7 @@ int parse_events_add_cache(struct list_head *list, int = *idx, struct perf_event_attr attr; LIST_HEAD(config_terms); char name[MAX_NAME_LEN]; - const char *config_name; + const char *config_name, *metric_id; int cache_type =3D -1, cache_op =3D -1, cache_result =3D -1; char *op_result[2] =3D { op_result1, op_result2 }; int i, n, ret; @@ -540,13 +553,17 @@ int parse_events_add_cache(struct list_head *list, in= t *idx, return -ENOMEM; } =20 + metric_id =3D get_config_metric_id(head_config); ret =3D parse_events__add_cache_hybrid(list, idx, &attr, - config_name ? : name, &config_terms, + config_name ? : name, + metric_id, + &config_terms, &hybrid, parse_state); if (hybrid) goto out_free_terms; =20 - ret =3D add_event(list, idx, &attr, config_name ? : name, &config_terms); + ret =3D add_event(list, idx, &attr, config_name ? : name, metric_id, + &config_terms); out_free_terms: free_config_terms(&config_terms); return ret; @@ -1023,7 +1040,8 @@ int parse_events_add_breakpoint(struct list_head *lis= t, int *idx, attr.type =3D PERF_TYPE_BREAKPOINT; attr.sample_period =3D 1; =20 - return add_event(list, idx, &attr, NULL, NULL); + return add_event(list, idx, &attr, /*name=3D*/NULL, /*mertic_id=3D*/NULL, + /*config_terms=3D*/NULL); } =20 static int check_type_val(struct parse_events_term *term, @@ -1068,6 +1086,7 @@ static const char *config_term_names[__PARSE_EVENTS__= TERM_TYPE_NR] =3D { [PARSE_EVENTS__TERM_TYPE_PERCORE] =3D "percore", [PARSE_EVENTS__TERM_TYPE_AUX_OUTPUT] =3D "aux-output", [PARSE_EVENTS__TERM_TYPE_AUX_SAMPLE_SIZE] =3D "aux-sample-size", + [PARSE_EVENTS__TERM_TYPE_METRIC_ID] =3D "metric-id", }; =20 static bool config_term_shrinked; @@ -1090,6 +1109,7 @@ config_term_avail(int term_type, struct parse_events_= error *err) case PARSE_EVENTS__TERM_TYPE_CONFIG1: case PARSE_EVENTS__TERM_TYPE_CONFIG2: case PARSE_EVENTS__TERM_TYPE_NAME: + case PARSE_EVENTS__TERM_TYPE_METRIC_ID: case PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD: case PARSE_EVENTS__TERM_TYPE_PERCORE: return true; @@ -1180,6 +1200,9 @@ do { \ case PARSE_EVENTS__TERM_TYPE_NAME: CHECK_TYPE_VAL(STR); break; + case PARSE_EVENTS__TERM_TYPE_METRIC_ID: + CHECK_TYPE_VAL(STR); + break; case PARSE_EVENTS__TERM_TYPE_MAX_STACK: CHECK_TYPE_VAL(NUM); break; @@ -1449,6 +1472,7 @@ int parse_events_add_numeric(struct parse_events_stat= e *parse_state, { struct perf_event_attr attr; LIST_HEAD(config_terms); + const char *name, *metric_id; bool hybrid; int ret; =20 @@ -1465,14 +1489,16 @@ int parse_events_add_numeric(struct parse_events_st= ate *parse_state, return -ENOMEM; } =20 + name =3D get_config_name(head_config); + metric_id =3D get_config_metric_id(head_config); ret =3D parse_events__add_numeric_hybrid(parse_state, list, &attr, - get_config_name(head_config), + name, metric_id, &config_terms, &hybrid); if (hybrid) goto out_free_terms; =20 - ret =3D add_event(list, &parse_state->idx, &attr, - get_config_name(head_config), &config_terms); + ret =3D add_event(list, &parse_state->idx, &attr, name, metric_id, + &config_terms); out_free_terms: free_config_terms(&config_terms); return ret; @@ -1574,8 +1600,11 @@ int parse_events_add_pmu(struct parse_events_state *= parse_state, =20 if (!head_config) { attr.type =3D pmu->type; - evsel =3D __add_event(list, &parse_state->idx, &attr, true, NULL, - pmu, NULL, auto_merge_stats, NULL); + evsel =3D __add_event(list, &parse_state->idx, &attr, + /*init_attr=3D*/true, /*name=3D*/NULL, + /*metric_id=3D*/NULL, pmu, + /*config_terms=3D*/NULL, auto_merge_stats, + /*cpu_list=3D*/NULL); if (evsel) { evsel->pmu_name =3D name ? strdup(name) : NULL; evsel->use_uncore_alias =3D use_uncore_alias; @@ -1628,9 +1657,10 @@ int parse_events_add_pmu(struct parse_events_state *= parse_state, return -EINVAL; } =20 - evsel =3D __add_event(list, &parse_state->idx, &attr, true, - get_config_name(head_config), pmu, - &config_terms, auto_merge_stats, NULL); + evsel =3D __add_event(list, &parse_state->idx, &attr, /*init_attr=3D*/tru= e, + get_config_name(head_config), + get_config_metric_id(head_config), pmu, + &config_terms, auto_merge_stats, /*cpu_list=3D*/NULL); if (!evsel) return -ENOMEM; =20 @@ -3296,9 +3326,12 @@ char *parse_events_formats_error_string(char *additi= onal_terms) =20 struct evsel *parse_events__add_event_hybrid(struct list_head *list, int *= idx, struct perf_event_attr *attr, - const char *name, struct perf_pmu *pmu, + const char *name, + const char *metric_id, + struct perf_pmu *pmu, struct list_head *config_terms) { - return __add_event(list, idx, attr, true, name, pmu, - config_terms, false, NULL); + return __add_event(list, idx, attr, /*init_attr=3D*/true, name, metric_id, + pmu, config_terms, /*auto_merge_stats=3D*/false, + /*cpu_list=3D*/NULL); } diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index 6ef506c1b29e..9de27b7c9eec 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h @@ -87,6 +87,7 @@ enum { PARSE_EVENTS__TERM_TYPE_PERCORE, PARSE_EVENTS__TERM_TYPE_AUX_OUTPUT, PARSE_EVENTS__TERM_TYPE_AUX_SAMPLE_SIZE, + PARSE_EVENTS__TERM_TYPE_METRIC_ID, __PARSE_EVENTS__TERM_TYPE_NR, }; =20 @@ -200,7 +201,8 @@ int parse_events_add_pmu(struct parse_events_state *par= se_state, bool use_alias); =20 struct evsel *parse_events__add_event(int idx, struct perf_event_attr *att= r, - const char *name, struct perf_pmu *pmu); + const char *name, const char *metric_id, + struct perf_pmu *pmu); =20 int parse_events_multi_pmu_add(struct parse_events_state *parse_state, char *str, @@ -268,6 +270,7 @@ int perf_pmu__test_parse_init(void); struct evsel *parse_events__add_event_hybrid(struct list_head *list, int *= idx, struct perf_event_attr *attr, const char *name, + const char *metric_id, struct perf_pmu *pmu, struct list_head *config_terms); =20 diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l index 923849024b15..b752eb2c620a 100644 --- a/tools/perf/util/parse-events.l +++ b/tools/perf/util/parse-events.l @@ -295,6 +295,7 @@ no-overwrite { return term(yyscanner, PARSE_EVENTS__TE= RM_TYPE_NOOVERWRITE); } percore { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_PERCORE); } aux-output { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_AUX_OUTPUT); } aux-sample-size { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_AUX_SAMP= LE_SIZE); } +metric-id { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_METRIC_ID); } r{num_raw_hex} { return raw(yyscanner); } r0x{num_raw_hex} { return raw(yyscanner); } , { return ','; } diff --git a/tools/perf/util/pfm.c b/tools/perf/util/pfm.c index 756295dedccc..f0bcfcab1a93 100644 --- a/tools/perf/util/pfm.c +++ b/tools/perf/util/pfm.c @@ -87,7 +87,8 @@ int parse_libpfm_events_option(const struct option *opt, = const char *str, =20 pmu =3D perf_pmu__find_by_type((unsigned int)attr.type); evsel =3D parse_events__add_event(evlist->core.nr_entries, - &attr, q, pmu); + &attr, q, /*metric_id=3D*/NULL, + pmu); if (evsel =3D=3D NULL) goto error; =20 --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7F72C433F5 for ; Mon, 3 Oct 2022 07:30:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231378AbiJCHaU (ORCPT ); Mon, 3 Oct 2022 03:30:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231396AbiJCH3C (ORCPT ); Mon, 3 Oct 2022 03:29:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5543140CC; Mon, 3 Oct 2022 00:19:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E343AB8058E; Mon, 3 Oct 2022 07:19:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F5F8C433D6; Mon, 3 Oct 2022 07:19:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781588; bh=Ziz5AkeJLzdodRtgDtJK0okB+h7CejTTfQ1EpE9S5sI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eLbi+8CfNX3hB4cUoXNu+vEv5VYfIyGdF5s89dr7kYjGaTW7MVQHgO67q5E86635u 6+6N6rX91hW9ngWwzD4DduD6aKEgRVhPkurgKpbyYDOGrFqobVmQc0y3MpXAs6HKsE KiN2uLqXyKoEoIV0XH1TRXlH7wD1asYecS22pfd0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Rogers , Andi Kleen , Adrian Hunter , Alexander Antonov , Alexander Shishkin , Andrew Kilroy , Andrew Morton , Changbin Du , Denys Zagorui , Fabian Hemmer , Felix Fietkau , Heiko Carstens , Ingo Molnar , Jacob Keller , Jiapeng Chong , Jin Yao , Jiri Olsa , Joakim Zhang , John Garry , Kajol Jain , Kan Liang , Kees Kook , Mark Rutland , Namhyung Kim , Nicholas Fraser , Nick Desaulniers , Paul Clarke , Peter Zijlstra , Riccardo Mancini , Sami Tolvanen , ShihCheng Tu , Song Liu , Stephane Eranian , Sumanth Korikkar , Thomas Richter , Wan Jiabing , Zhen Lei , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.15 75/83] perf parse-events: Identify broken modifiers Date: Mon, 3 Oct 2022 09:11:40 +0200 Message-Id: <20221003070723.875461580@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ian Rogers [ Upstream commit eabd4523395e4a8f2b049165642801f2ab8ff893 ] Previously the broken modifier causes a usage message to printed but nothing else. After: $ perf stat -e 'cycles:kk' -a sleep 2 event syntax error: 'cycles:kk' \___ Bad modifier Run 'perf list' for a list of valid events Usage: perf stat [] [] -e, --event event selector. use 'perf list' to list availab= le events $ perf stat -e '{instructions,cycles}:kk' -a sleep 2 event syntax error: '..ns,cycles}:kk' \___ Bad modifier Run 'perf list' for a list of valid events Usage: perf stat [] [] -e, --event event selector. use 'perf list' to list availab= le events Signed-off-by: Ian Rogers Acked-by: Andi Kleen Cc: Adrian Hunter Cc: Alexander Antonov Cc: Alexander Shishkin Cc: Andrew Kilroy Cc: Andrew Morton Cc: Changbin Du Cc: Denys Zagorui Cc: Fabian Hemmer Cc: Felix Fietkau Cc: Heiko Carstens Cc: Ingo Molnar Cc: Jacob Keller Cc: Jiapeng Chong Cc: Jin Yao Cc: Jiri Olsa Cc: Joakim Zhang Cc: John Garry Cc: Kajol Jain Cc: Kan Liang Cc: Kees Kook Cc: Mark Rutland Cc: Namhyung Kim Cc: Nicholas Fraser Cc: Nick Desaulniers Cc: Paul Clarke Cc: Peter Zijlstra Cc: Riccardo Mancini Cc: Sami Tolvanen Cc: ShihCheng Tu Cc: Song Liu Cc: Stephane Eranian Cc: Sumanth Korikkar Cc: Thomas Richter Cc: Wan Jiabing Cc: Zhen Lei Link: https://lore.kernel.org/r/20211015172132.1162559-21-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo Stable-dep-of: 71c86cda750b ("perf parse-events: Remove "not supported" hyb= rid cache events") Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- tools/perf/util/parse-events.y | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y index d94e48e1ff9b..467a426205a0 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y @@ -183,6 +183,11 @@ group_def ':' PE_MODIFIER_EVENT err =3D parse_events__modifier_group(list, $3); free($3); if (err) { + struct parse_events_state *parse_state =3D _parse_state; + struct parse_events_error *error =3D parse_state->error; + + parse_events__handle_error(error, @3.first_column, + strdup("Bad modifier"), NULL); free_list_evsel(list); YYABORT; } @@ -240,6 +245,11 @@ event_name PE_MODIFIER_EVENT err =3D parse_events__modifier_event(list, $2, false); free($2); if (err) { + struct parse_events_state *parse_state =3D _parse_state; + struct parse_events_error *error =3D parse_state->error; + + parse_events__handle_error(error, @2.first_column, + strdup("Bad modifier"), NULL); free_list_evsel(list); YYABORT; } --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAC66C4332F for ; Mon, 3 Oct 2022 07:33:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231539AbiJCHdS (ORCPT ); Mon, 3 Oct 2022 03:33:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231386AbiJCHcn (ORCPT ); Mon, 3 Oct 2022 03:32:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DCD94F3B6; Mon, 3 Oct 2022 00:20:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ECF4460FBC; Mon, 3 Oct 2022 07:19:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB80FC433D7; Mon, 3 Oct 2022 07:19:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781591; bh=jkaeQLjLZ8db8u2ZWiG1R6jLh7hcsta+m1CShAqPCCY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Co757LxBlfG36SleNMVLYG7UUc7rwyqBtoazEpW6G2aCDv4B8G1G51TlPu55YjpG4 G5F1/qlO58vJ6s0jFZF4TyG43WH7Gv6Yj4k4KfUJ38M/dLNyuCIO1WshRTee4Htv4O oSMKR5REb11RxAsd+fmiokNFEPRUm7joD5jY8WbE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jin Yao , Alexander Shishkin , Andi Kleen , Jin Yao , Jiri Olsa , Kan Liang , Peter Zijlstra , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.15 76/83] perf list: Display hybrid PMU events with cpu type Date: Mon, 3 Oct 2022 09:11:41 +0200 Message-Id: <20221003070723.900495202@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jin Yao [ Upstream commit 0e0ae8742207c3b477cf0357b8115cec7b19612c ] Add a new option '--cputype' to 'perf list' to display core-only PMU events or atom-only PMU events. Each hybrid PMU event has been assigned with a PMU name, this patch compares the PMU name before listing the result. For example: perf list --cputype atom ... cache: core_reject_l2q.any [Counts the number of request that were not accepted into the L2Q = because the L2Q is FULL. Unit: cpu_atom] ... The "Unit: cpu_atom" is displayed in the brief description section to indicate this is an atom event. Signed-off-by: Jin Yao Cc: Alexander Shishkin Cc: Andi Kleen Cc: Jin Yao Cc: Jiri Olsa Cc: Kan Liang Cc: Peter Zijlstra Link: http://lore.kernel.org/lkml/20210903025239.22754-1-yao.jin@linux.inte= l.com Signed-off-by: Arnaldo Carvalho de Melo Stable-dep-of: 71c86cda750b ("perf parse-events: Remove "not supported" hyb= rid cache events") Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- tools/perf/Documentation/perf-list.txt | 4 +++ tools/perf/builtin-list.c | 42 ++++++++++++++++++-------- tools/perf/util/metricgroup.c | 7 ++++- tools/perf/util/metricgroup.h | 2 +- tools/perf/util/parse-events.c | 8 +++-- tools/perf/util/parse-events.h | 3 +- tools/perf/util/pmu.c | 29 +++++++++++++++--- tools/perf/util/pmu.h | 2 +- 8 files changed, 73 insertions(+), 24 deletions(-) diff --git a/tools/perf/Documentation/perf-list.txt b/tools/perf/Documentat= ion/perf-list.txt index 4c7db1da8fcc..4dc8d0af19df 100644 --- a/tools/perf/Documentation/perf-list.txt +++ b/tools/perf/Documentation/perf-list.txt @@ -39,6 +39,10 @@ any extra expressions computed by perf stat. --deprecated:: Print deprecated events. By default the deprecated events are hidden. =20 +--cputype:: +Print events applying cpu with this type for hybrid platform +(e.g. --cputype core or --cputype atom) + [[EVENT_MODIFIERS]] EVENT MODIFIERS --------------- diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c index 10ab5e40a34f..468958154ed9 100644 --- a/tools/perf/builtin-list.c +++ b/tools/perf/builtin-list.c @@ -12,6 +12,7 @@ =20 #include "util/parse-events.h" #include "util/pmu.h" +#include "util/pmu-hybrid.h" #include "util/debug.h" #include "util/metricgroup.h" #include @@ -20,13 +21,15 @@ =20 static bool desc_flag =3D true; static bool details_flag; +static const char *hybrid_type; =20 int cmd_list(int argc, const char **argv) { - int i; + int i, ret =3D 0; bool raw_dump =3D false; bool long_desc_flag =3D false; bool deprecated =3D false; + char *pmu_name =3D NULL; struct option list_options[] =3D { OPT_BOOLEAN(0, "raw-dump", &raw_dump, "Dump raw events"), OPT_BOOLEAN('d', "desc", &desc_flag, @@ -37,6 +40,9 @@ int cmd_list(int argc, const char **argv) "Print information on the perf event names and expressions used int= ernally by events."), OPT_BOOLEAN(0, "deprecated", &deprecated, "Print deprecated events."), + OPT_STRING(0, "cputype", &hybrid_type, "hybrid cpu type", + "Print events applying cpu with this type for hybrid platform " + "(e.g. core or atom)"), OPT_INCR(0, "debug", &verbose, "Enable debugging output"), OPT_END() @@ -56,10 +62,16 @@ int cmd_list(int argc, const char **argv) if (!raw_dump && pager_in_use()) printf("\nList of pre-defined events (to be used in -e):\n\n"); =20 + if (hybrid_type) { + pmu_name =3D perf_pmu__hybrid_type_to_pmu(hybrid_type); + if (!pmu_name) + pr_warning("WARNING: hybrid cputype is not supported!\n"); + } + if (argc =3D=3D 0) { print_events(NULL, raw_dump, !desc_flag, long_desc_flag, - details_flag, deprecated); - return 0; + details_flag, deprecated, pmu_name); + goto out; } =20 for (i =3D 0; i < argc; ++i) { @@ -82,25 +94,27 @@ int cmd_list(int argc, const char **argv) else if (strcmp(argv[i], "pmu") =3D=3D 0) print_pmu_events(NULL, raw_dump, !desc_flag, long_desc_flag, details_flag, - deprecated); + deprecated, pmu_name); else if (strcmp(argv[i], "sdt") =3D=3D 0) print_sdt_events(NULL, NULL, raw_dump); else if (strcmp(argv[i], "metric") =3D=3D 0 || strcmp(argv[i], "metrics"= ) =3D=3D 0) - metricgroup__print(true, false, NULL, raw_dump, details_flag); + metricgroup__print(true, false, NULL, raw_dump, details_flag, pmu_name); else if (strcmp(argv[i], "metricgroup") =3D=3D 0 || strcmp(argv[i], "met= ricgroups") =3D=3D 0) - metricgroup__print(false, true, NULL, raw_dump, details_flag); + metricgroup__print(false, true, NULL, raw_dump, details_flag, pmu_name); else if ((sep =3D strchr(argv[i], ':')) !=3D NULL) { int sep_idx; =20 sep_idx =3D sep - argv[i]; s =3D strdup(argv[i]); - if (s =3D=3D NULL) - return -1; + if (s =3D=3D NULL) { + ret =3D -1; + goto out; + } =20 s[sep_idx] =3D '\0'; print_tracepoint_events(s, s + sep_idx + 1, raw_dump); print_sdt_events(s, s + sep_idx + 1, raw_dump); - metricgroup__print(true, true, s, raw_dump, details_flag); + metricgroup__print(true, true, s, raw_dump, details_flag, pmu_name); free(s); } else { if (asprintf(&s, "*%s*", argv[i]) < 0) { @@ -116,12 +130,16 @@ int cmd_list(int argc, const char **argv) print_pmu_events(s, raw_dump, !desc_flag, long_desc_flag, details_flag, - deprecated); + deprecated, + pmu_name); print_tracepoint_events(NULL, s, raw_dump); print_sdt_events(NULL, s, raw_dump); - metricgroup__print(true, true, s, raw_dump, details_flag); + metricgroup__print(true, true, s, raw_dump, details_flag, pmu_name); free(s); } } - return 0; + +out: + free(pmu_name); + return ret; } diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c index ec8195f1ab50..9d172ac66062 100644 --- a/tools/perf/util/metricgroup.c +++ b/tools/perf/util/metricgroup.c @@ -11,6 +11,7 @@ #include "evsel.h" #include "strbuf.h" #include "pmu.h" +#include "pmu-hybrid.h" #include "expr.h" #include "rblist.h" #include @@ -616,7 +617,7 @@ static int metricgroup__print_sys_event_iter(struct pmu= _event *pe, void *data) } =20 void metricgroup__print(bool metrics, bool metricgroups, char *filter, - bool raw, bool details) + bool raw, bool details, const char *pmu_name) { struct pmu_events_map *map =3D pmu_events_map__find(); struct pmu_event *pe; @@ -642,6 +643,10 @@ void metricgroup__print(bool metrics, bool metricgroup= s, char *filter, break; if (!pe->metric_expr) continue; + if (pmu_name && perf_pmu__is_hybrid(pe->pmu) && + strcmp(pmu_name, pe->pmu)) { + continue; + } if (metricgroup__print_pmu_event(pe, metricgroups, filter, raw, details, &groups, metriclist) < 0) diff --git a/tools/perf/util/metricgroup.h b/tools/perf/util/metricgroup.h index cc4a92492a61..9deee6691f2e 100644 --- a/tools/perf/util/metricgroup.h +++ b/tools/perf/util/metricgroup.h @@ -53,7 +53,7 @@ int metricgroup__parse_groups_test(struct evlist *evlist, struct rblist *metric_events); =20 void metricgroup__print(bool metrics, bool groups, char *filter, - bool raw, bool details); + bool raw, bool details, const char *pmu_name); bool metricgroup__has_metric(const char *metric); int arch_get_runtimeparam(struct pmu_event *pe __maybe_unused); void metricgroup__rblist_exit(struct rblist *metric_events); diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index e62514577b97..533c4b216ae2 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -3034,7 +3034,8 @@ void print_symbol_events(const char *event_glob, unsi= gned type, * Print the help text for the event symbols: */ void print_events(const char *event_glob, bool name_only, bool quiet_flag, - bool long_desc, bool details_flag, bool deprecated) + bool long_desc, bool details_flag, bool deprecated, + const char *pmu_name) { print_symbol_events(event_glob, PERF_TYPE_HARDWARE, event_symbols_hw, PERF_COUNT_HW_MAX, name_only); @@ -3046,7 +3047,7 @@ void print_events(const char *event_glob, bool name_o= nly, bool quiet_flag, print_hwcache_events(event_glob, name_only); =20 print_pmu_events(event_glob, name_only, quiet_flag, long_desc, - details_flag, deprecated); + details_flag, deprecated, pmu_name); =20 if (event_glob !=3D NULL) return; @@ -3072,7 +3073,8 @@ void print_events(const char *event_glob, bool name_o= nly, bool quiet_flag, =20 print_sdt_events(NULL, NULL, name_only); =20 - metricgroup__print(true, true, NULL, name_only, details_flag); + metricgroup__print(true, true, NULL, name_only, details_flag, + pmu_name); =20 print_libpfm_events(name_only, long_desc); } diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index 9de27b7c9eec..46e9ec9588ec 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h @@ -221,7 +221,8 @@ void parse_events_evlist_error(struct parse_events_stat= e *parse_state, int idx, const char *str); =20 void print_events(const char *event_glob, bool name_only, bool quiet, - bool long_desc, bool details_flag, bool deprecated); + bool long_desc, bool details_flag, bool deprecated, + const char *pmu_name); =20 struct event_symbol { const char *symbol; diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index c647b3633d1d..79ee52faaf9b 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -1608,6 +1608,7 @@ static int cmp_sevent(const void *a, const void *b) { const struct sevent *as =3D a; const struct sevent *bs =3D b; + int ret; =20 /* Put extra events last */ if (!!as->desc !=3D !!bs->desc) @@ -1623,7 +1624,13 @@ static int cmp_sevent(const void *a, const void *b) if (as->is_cpu !=3D bs->is_cpu) return bs->is_cpu - as->is_cpu; =20 - return strcmp(as->name, bs->name); + ret =3D strcmp(as->name, bs->name); + if (!ret) { + if (as->pmu && bs->pmu) + return strcmp(as->pmu, bs->pmu); + } + + return ret; } =20 static void wordwrap(char *s, int start, int max, int corr) @@ -1653,7 +1660,8 @@ bool is_pmu_core(const char *name) } =20 void print_pmu_events(const char *event_glob, bool name_only, bool quiet_f= lag, - bool long_desc, bool details_flag, bool deprecated) + bool long_desc, bool details_flag, bool deprecated, + const char *pmu_name) { struct perf_pmu *pmu; struct perf_pmu_alias *alias; @@ -1679,10 +1687,16 @@ void print_pmu_events(const char *event_glob, bool = name_only, bool quiet_flag, pmu =3D NULL; j =3D 0; while ((pmu =3D perf_pmu__scan(pmu)) !=3D NULL) { + if (pmu_name && perf_pmu__is_hybrid(pmu->name) && + strcmp(pmu_name, pmu->name)) { + continue; + } + list_for_each_entry(alias, &pmu->aliases, list) { char *name =3D alias->desc ? alias->name : format_alias(buf, sizeof(buf), pmu, alias); - bool is_cpu =3D is_pmu_core(pmu->name); + bool is_cpu =3D is_pmu_core(pmu->name) || + perf_pmu__is_hybrid(pmu->name); =20 if (alias->deprecated && !deprecated) continue; @@ -1730,8 +1744,13 @@ void print_pmu_events(const char *event_glob, bool n= ame_only, bool quiet_flag, qsort(aliases, len, sizeof(struct sevent), cmp_sevent); for (j =3D 0; j < len; j++) { /* Skip duplicates */ - if (j > 0 && !strcmp(aliases[j].name, aliases[j - 1].name)) - continue; + if (j > 0 && !strcmp(aliases[j].name, aliases[j - 1].name)) { + if (!aliases[j].pmu || !aliases[j - 1].pmu || + !strcmp(aliases[j].pmu, aliases[j - 1].pmu)) { + continue; + } + } + if (name_only) { printf("%s ", aliases[j].name); continue; diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h index dd0736de32c8..57f7b4847fe5 100644 --- a/tools/perf/util/pmu.h +++ b/tools/perf/util/pmu.h @@ -111,7 +111,7 @@ struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu); bool is_pmu_core(const char *name); void print_pmu_events(const char *event_glob, bool name_only, bool quiet, bool long_desc, bool details_flag, - bool deprecated); + bool deprecated, const char *pmu_name); bool pmu_have_event(const char *pname, const char *name); =20 int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char= *fmt, ...) __scanf(3, 4); --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DB5BC4332F for ; Mon, 3 Oct 2022 07:31:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231352AbiJCHbP (ORCPT ); Mon, 3 Oct 2022 03:31:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231496AbiJCH3Q (ORCPT ); Mon, 3 Oct 2022 03:29:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86D03178A3; Mon, 3 Oct 2022 00:20:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BD39AB80E89; Mon, 3 Oct 2022 07:19:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CFAEC433D6; Mon, 3 Oct 2022 07:19:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781596; bh=HFxNYfsVUsm8M5vjB+4YNyHRnJJ7GKVdKvGrd/NnvvY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zEJkd0yBx6d3ttqsunetCbEQAo4O/PTzsJMUNzeIIpKjG43FjKC4whhAjArdPiSZc EyKXhX4Ze29MuFRD8TeWlp1LUf8zTmSxprPOnxPsa7kqX3IeooBBMhJ/EDhpt1ahr1 LoET+VYxt5M5a6inX+dJmLPYYTlX2L7OOq4c/qOM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Clark , Alexander Shishkin , Denis Nikitin , Jiri Olsa , Mark Rutland , Namhyung Kim , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.15 77/83] perf tools: Check vmlinux/kallsyms arguments in all tools Date: Mon, 3 Oct 2022 09:11:42 +0200 Message-Id: <20221003070723.925595482@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: James Clark [ Upstream commit 7cc72553ac03ec20afe2dec91dce4624ccd379b8 ] Only perf report checked the validity of these arguments so apply the same check to all tools that read them for consistency. Signed-off-by: James Clark Cc: Alexander Shishkin Cc: Denis Nikitin Cc: Jiri Olsa Cc: Mark Rutland Cc: Namhyung Kim Link: https://lore.kernel.org/r/20211018134844.2627174-3-james.clark@arm.com Signed-off-by: Arnaldo Carvalho de Melo Stable-dep-of: 71c86cda750b ("perf parse-events: Remove "not supported" hyb= rid cache events") Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- tools/perf/builtin-annotate.c | 4 ++++ tools/perf/builtin-c2c.c | 4 ++++ tools/perf/builtin-probe.c | 5 +++++ tools/perf/builtin-record.c | 4 ++++ tools/perf/builtin-sched.c | 4 ++++ tools/perf/builtin-script.c | 3 +++ tools/perf/builtin-top.c | 4 ++++ 7 files changed, 28 insertions(+) diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 05eb098cb0e3..490bb9b8cf17 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c @@ -591,6 +591,10 @@ int cmd_annotate(int argc, const char **argv) return ret; } =20 + ret =3D symbol__validate_sym_arguments(); + if (ret) + return ret; + if (quiet) perf_quiet_option(); =20 diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index e6f900c3accb..6d901ba6678f 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -2770,6 +2770,10 @@ static int perf_c2c__report(int argc, const char **a= rgv) if (c2c.stats_only) c2c.use_stdio =3D true; =20 + err =3D symbol__validate_sym_arguments(); + if (err) + goto out; + if (!input_name || !strlen(input_name)) input_name =3D "perf.data"; =20 diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index e1dd51f2874b..c31627af75d4 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c @@ -21,6 +21,7 @@ #include "util/build-id.h" #include "util/strlist.h" #include "util/strfilter.h" +#include "util/symbol.h" #include "util/symbol_conf.h" #include "util/debug.h" #include @@ -629,6 +630,10 @@ __cmd_probe(int argc, const char **argv) params.command =3D 'a'; } =20 + ret =3D symbol__validate_sym_arguments(); + if (ret) + return ret; + if (params.quiet) { if (verbose !=3D 0) { pr_err(" Error: -v and -q are exclusive.\n"); diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index b3509d9d20cc..dcb3ed24fc4a 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -2680,6 +2680,10 @@ int cmd_record(int argc, const char **argv) if (quiet) perf_quiet_option(); =20 + err =3D symbol__validate_sym_arguments(); + if (err) + return err; + /* Make system wide (-a) the default target. */ if (!argc && target__none(&rec->opts.target)) rec->opts.target.system_wide =3D true; diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 635a6b5a9ec9..4527f632ebe4 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -3538,6 +3538,7 @@ int cmd_sched(int argc, const char **argv) .fork_event =3D replay_fork_event, }; unsigned int i; + int ret; =20 for (i =3D 0; i < ARRAY_SIZE(sched.curr_pid); i++) sched.curr_pid[i] =3D -1; @@ -3598,6 +3599,9 @@ int cmd_sched(int argc, const char **argv) parse_options_usage(NULL, timehist_options, "n", true); return -EINVAL; } + ret =3D symbol__validate_sym_arguments(); + if (ret) + return ret; =20 return perf_sched__timehist(&sched); } else { diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index c6c40191933d..f346275c9d21 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -3839,6 +3839,9 @@ int cmd_script(int argc, const char **argv) data.path =3D input_name; data.force =3D symbol_conf.force; =20 + if (symbol__validate_sym_arguments()) + return -1; + if (argc > 1 && !strncmp(argv[0], "rec", strlen("rec"))) { rec_script_path =3D get_script_path(argv[1], RECORD_SUFFIX); if (!rec_script_path) diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index a3ae9176a83e..aa5190ecc72a 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -1618,6 +1618,10 @@ int cmd_top(int argc, const char **argv) if (argc) usage_with_options(top_usage, options); =20 + status =3D symbol__validate_sym_arguments(); + if (status) + goto out_delete_evlist; + if (annotate_check_args(&top.annotation_opts) < 0) goto out_delete_evlist; =20 --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B3C2C433F5 for ; Mon, 3 Oct 2022 07:31:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231400AbiJCHbB (ORCPT ); Mon, 3 Oct 2022 03:31:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231481AbiJCH3O (ORCPT ); Mon, 3 Oct 2022 03:29:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53308E1B; Mon, 3 Oct 2022 00:20:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 88D63B80E6E; Mon, 3 Oct 2022 07:20:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 889F3C433D6; Mon, 3 Oct 2022 07:19:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781599; bh=b7bbnqElYgS804lPafWtrg/sJe6H9zS9nTluDJR+eZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QLxpQHSlu3SebZJYuSWT/E77SS1m81Ic+bti2JdKP4e3Rwa8/yjBlZJT3jLCl/BuG CpYABwsO3jRfrsYmXLAlsyc0MfyPkE45Kzl6IMkCblo9p7wd2d3KZhwvCgIXfVjA0M gHsAv2vykBv1BAHqaXGdcTfi9GSCKWKaIoCwORP0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wei Li , Arnaldo Carvalho de Melo , Alexander Shishkin , Hanjun Guo , Jiri Olsa , Mark Rutland , Namhyung Kim , Rui Xiang , Sasha Levin Subject: [PATCH 5.15 78/83] perf tools: Enhance the matching of sub-commands abbreviations Date: Mon, 3 Oct 2022 09:11:43 +0200 Message-Id: <20221003070723.950614802@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wei Li [ Upstream commit ae0f4eb34fc3014f7eba78fab90a0e98e441a4cd ] We support short command 'rec*' for 'record' and 'rep*' for 'report' in lots of sub-commands, but the matching is not quite strict currnetly. It may be puzzling sometime, like we mis-type a 'recport' to report but it will perform 'record' in fact without any message. To fix this, add a check to ensure that the short cmd is valid prefix of the real command. Committer testing: [root@quaco ~]# perf c2c re sleep 1 Usage: perf c2c {record|report} -v, --verbose be more verbose (show counter open errors, etc) # perf c2c rec sleep 1 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.038 MB perf.data (16 samples) ] # perf c2c recport sleep 1 Usage: perf c2c {record|report} -v, --verbose be more verbose (show counter open errors, etc) # perf c2c record sleep 1 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.038 MB perf.data (15 samples) ] # perf c2c records sleep 1 Usage: perf c2c {record|report} -v, --verbose be more verbose (show counter open errors, etc) # Signed-off-by: Wei Li Tested-by: Arnaldo Carvalho de Melo Cc: Alexander Shishkin Cc: Hanjun Guo Cc: Jiri Olsa Cc: Mark Rutland Cc: Namhyung Kim Cc: Rui Xiang Link: http://lore.kernel.org/lkml/20220325092032.2956161-1-liwei391@huawei.= com Signed-off-by: Arnaldo Carvalho de Melo Stable-dep-of: 71c86cda750b ("perf parse-events: Remove "not supported" hyb= rid cache events") Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- tools/perf/builtin-c2c.c | 5 +++-- tools/perf/builtin-kmem.c | 2 +- tools/perf/builtin-kvm.c | 9 +++++---- tools/perf/builtin-lock.c | 5 +++-- tools/perf/builtin-mem.c | 5 +++-- tools/perf/builtin-sched.c | 4 ++-- tools/perf/builtin-script.c | 4 ++-- tools/perf/builtin-stat.c | 4 ++-- tools/perf/builtin-timechart.c | 3 ++- 9 files changed, 23 insertions(+), 18 deletions(-) diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c index 6d901ba6678f..ba798c64fed9 100644 --- a/tools/perf/builtin-c2c.c +++ b/tools/perf/builtin-c2c.c @@ -44,6 +44,7 @@ #include "../perf.h" #include "pmu.h" #include "pmu-hybrid.h" +#include "string2.h" =20 struct c2c_hists { struct hists hists; @@ -3026,9 +3027,9 @@ int cmd_c2c(int argc, const char **argv) if (!argc) usage_with_options(c2c_usage, c2c_options); =20 - if (!strncmp(argv[0], "rec", 3)) { + if (strlen(argv[0]) > 2 && strstarts("record", argv[0])) { return perf_c2c__record(argc, argv); - } else if (!strncmp(argv[0], "rep", 3)) { + } else if (strlen(argv[0]) > 2 && strstarts("report", argv[0])) { return perf_c2c__report(argc, argv); } else { usage_with_options(c2c_usage, c2c_options); diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index da03a341c63c..8595e6a92d39 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c @@ -1946,7 +1946,7 @@ int cmd_kmem(int argc, const char **argv) kmem_page =3D 1; } =20 - if (!strncmp(argv[0], "rec", 3)) { + if (strlen(argv[0]) > 2 && strstarts("record", argv[0])) { symbol__init(NULL); return __cmd_record(argc, argv); } diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index aa1b127ffb5b..38735c405573 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c @@ -24,6 +24,7 @@ #include "util/ordered-events.h" #include "util/kvm-stat.h" #include "ui/ui.h" +#include "util/string2.h" =20 #include #ifdef HAVE_TIMERFD_SUPPORT @@ -1500,10 +1501,10 @@ static int kvm_cmd_stat(const char *file_name, int = argc, const char **argv) goto perf_stat; } =20 - if (!strncmp(argv[1], "rec", 3)) + if (strlen(argv[1]) > 2 && strstarts("record", argv[1])) return kvm_events_record(&kvm, argc - 1, argv + 1); =20 - if (!strncmp(argv[1], "rep", 3)) + if (strlen(argv[1]) > 2 && strstarts("report", argv[1])) return kvm_events_report(&kvm, argc - 1 , argv + 1); =20 #ifdef HAVE_TIMERFD_SUPPORT @@ -1631,9 +1632,9 @@ int cmd_kvm(int argc, const char **argv) } } =20 - if (!strncmp(argv[0], "rec", 3)) + if (strlen(argv[0]) > 2 && strstarts("record", argv[0])) return __cmd_record(file_name, argc, argv); - else if (!strncmp(argv[0], "rep", 3)) + else if (strlen(argv[0]) > 2 && strstarts("report", argv[0])) return __cmd_report(file_name, argc, argv); else if (!strncmp(argv[0], "diff", 4)) return cmd_diff(argc, argv); diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c index d70131b7b1b1..24d402e84022 100644 --- a/tools/perf/builtin-lock.c +++ b/tools/perf/builtin-lock.c @@ -18,6 +18,7 @@ #include "util/session.h" #include "util/tool.h" #include "util/data.h" +#include "util/string2.h" =20 #include #include @@ -997,9 +998,9 @@ int cmd_lock(int argc, const char **argv) if (!argc) usage_with_options(lock_usage, lock_options); =20 - if (!strncmp(argv[0], "rec", 3)) { + if (strlen(argv[0]) > 2 && strstarts("record", argv[0])) { return __cmd_record(argc, argv); - } else if (!strncmp(argv[0], "report", 6)) { + } else if (strlen(argv[0]) > 2 && strstarts("report", argv[0])) { trace_handler =3D &report_lock_ops; if (argc) { argc =3D parse_options(argc, argv, diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c index fcf65a59bea2..9e435fd23503 100644 --- a/tools/perf/builtin-mem.c +++ b/tools/perf/builtin-mem.c @@ -20,6 +20,7 @@ #include "util/symbol.h" #include "util/pmu.h" #include "util/pmu-hybrid.h" +#include "util/string2.h" #include =20 #define MEM_OPERATION_LOAD 0x1 @@ -496,9 +497,9 @@ int cmd_mem(int argc, const char **argv) mem.input_name =3D "perf.data"; } =20 - if (!strncmp(argv[0], "rec", 3)) + if (strlen(argv[0]) > 2 && strstarts("record", argv[0])) return __cmd_record(argc, argv, &mem); - else if (!strncmp(argv[0], "rep", 3)) + else if (strlen(argv[0]) > 2 && strstarts("report", argv[0])) return report_events(argc, argv, &mem); else usage_with_options(mem_usage, mem_options); diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 4527f632ebe4..2cf806d66b1c 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -3554,7 +3554,7 @@ int cmd_sched(int argc, const char **argv) if (!strcmp(argv[0], "script")) return cmd_script(argc, argv); =20 - if (!strncmp(argv[0], "rec", 3)) { + if (strlen(argv[0]) > 2 && strstarts("record", argv[0])) { return __cmd_record(argc, argv); } else if (!strncmp(argv[0], "lat", 3)) { sched.tp_handler =3D &lat_ops; @@ -3574,7 +3574,7 @@ int cmd_sched(int argc, const char **argv) sched.tp_handler =3D &map_ops; setup_sorting(&sched, latency_options, latency_usage); return perf_sched__map(&sched); - } else if (!strncmp(argv[0], "rep", 3)) { + } else if (strlen(argv[0]) > 2 && strstarts("replay", argv[0])) { sched.tp_handler =3D &replay_ops; if (argc) { argc =3D parse_options(argc, argv, replay_options, replay_usage, 0); diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index f346275c9d21..4baaf5652a42 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -3842,13 +3842,13 @@ int cmd_script(int argc, const char **argv) if (symbol__validate_sym_arguments()) return -1; =20 - if (argc > 1 && !strncmp(argv[0], "rec", strlen("rec"))) { + if (argc > 1 && strlen(argv[0]) > 2 && strstarts("record", argv[0])) { rec_script_path =3D get_script_path(argv[1], RECORD_SUFFIX); if (!rec_script_path) return cmd_record(argc, argv); } =20 - if (argc > 1 && !strncmp(argv[0], "rep", strlen("rep"))) { + if (argc > 1 && strlen(argv[0]) > 2 && strstarts("report", argv[0])) { rep_script_path =3D get_script_path(argv[1], REPORT_SUFFIX); if (!rep_script_path) { fprintf(stderr, diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index abf88a1ad455..002eecc59536 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -2255,11 +2255,11 @@ int cmd_stat(int argc, const char **argv) } else stat_config.csv_sep =3D DEFAULT_SEPARATOR; =20 - if (argc && !strncmp(argv[0], "rec", 3)) { + if (argc && strlen(argv[0]) > 2 && strstarts("record", argv[0])) { argc =3D __cmd_record(argc, argv); if (argc < 0) return -1; - } else if (argc && !strncmp(argv[0], "rep", 3)) + } else if (argc && strlen(argv[0]) > 2 && strstarts("report", argv[0])) return __cmd_report(argc, argv); =20 interval =3D stat_config.interval; diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index 43bf4d67edb0..afce731cec16 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c @@ -35,6 +35,7 @@ #include "util/tool.h" #include "util/data.h" #include "util/debug.h" +#include "util/string2.h" #include =20 #ifdef LACKS_OPEN_MEMSTREAM_PROTOTYPE @@ -1983,7 +1984,7 @@ int cmd_timechart(int argc, const char **argv) return -1; } =20 - if (argc && !strncmp(argv[0], "rec", 3)) { + if (argc && strlen(argv[0]) > 2 && strstarts("record", argv[0])) { argc =3D parse_options(argc, argv, timechart_record_options, timechart_record_usage, PARSE_OPT_STOP_AT_NON_OPTION); --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7778AC433F5 for ; Mon, 3 Oct 2022 07:31:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231159AbiJCHbK (ORCPT ); Mon, 3 Oct 2022 03:31:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231488AbiJCH3P (ORCPT ); Mon, 3 Oct 2022 03:29:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41345193C4; Mon, 3 Oct 2022 00:20:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1826DB80E84; Mon, 3 Oct 2022 07:20:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7389FC433C1; Mon, 3 Oct 2022 07:20:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781601; bh=nbytP3D9KgG1Kq4uClmgzAzxcf7Tw7GRv1kkZmibIR4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yAOrygCb3L0U+SFIR1dSR/MX5D8NQvGPA/YUQreUMemDwVXLMClLKrqdGiQklK+9n 5xWQQ93P+TfEvgefL5DRlovIOLX8W4v5XoYvkKb1bN3wxUloxgHajSu3XT8W/aesva y6L0gQxm9fTVRXnybKSLdvCEnA8qmmkIakIsf0c0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fischer , Arnaldo Carvalho de Melo , Peter Zijlstra , Xing Zhengjun , Sasha Levin Subject: [PATCH 5.15 79/83] perf list: Print all available tool events Date: Mon, 3 Oct 2022 09:11:44 +0200 Message-Id: <20221003070723.978824952@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Fischer [ Upstream commit 75eafc970bd9d36d906960a81376549f5dc99696 ] Introduce names for the new tool events 'user_time' and 'system_time'. $ perf list ... duration_time [Tool event] user_time [Tool event] system_time [Tool event] ... Committer testing: Before: $ perf list | grep Tool duration_time [Tool event] $ After: $ perf list | grep Tool duration_time [Tool event] user_time [Tool event] system_time [Tool event] $ Signed-off-by: Florian Fischer Tested-by: Arnaldo Carvalho de Melo Cc: Peter Zijlstra Cc: Xing Zhengjun Link: http://lore.kernel.org/lkml/20220420174244.1741958-2-florian.fischer@= muhq.space Signed-off-by: Arnaldo Carvalho de Melo Stable-dep-of: 71c86cda750b ("perf parse-events: Remove "not supported" hyb= rid cache events") Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- tools/perf/util/evsel.c | 19 ++++++++++------ tools/perf/util/evsel.h | 1 + tools/perf/util/parse-events.c | 40 +++++++++++++++++++++++++++++----- 3 files changed, 47 insertions(+), 13 deletions(-) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 1e43fac90fc8..dbb27b61e0de 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -600,6 +600,17 @@ static int evsel__sw_name(struct evsel *evsel, char *b= f, size_t size) return r + evsel__add_modifiers(evsel, bf + r, size - r); } =20 +const char *evsel__tool_names[PERF_TOOL_MAX] =3D { + "duration_time", + "user_time", + "system_time", +}; + +static int evsel__tool_name(enum perf_tool_event ev, char *bf, size_t size) +{ + return scnprintf(bf, size, "%s", evsel__tool_names[ev]); +} + static int __evsel__bp_name(char *bf, size_t size, u64 addr, u64 type) { int r; @@ -726,12 +737,6 @@ static int evsel__raw_name(struct evsel *evsel, char *= bf, size_t size) return ret + evsel__add_modifiers(evsel, bf + ret, size - ret); } =20 -static int evsel__tool_name(char *bf, size_t size) -{ - int ret =3D scnprintf(bf, size, "duration_time"); - return ret; -} - const char *evsel__name(struct evsel *evsel) { char bf[128]; @@ -757,7 +762,7 @@ const char *evsel__name(struct evsel *evsel) =20 case PERF_TYPE_SOFTWARE: if (evsel->tool_event) - evsel__tool_name(bf, sizeof(bf)); + evsel__tool_name(evsel->tool_event, bf, sizeof(bf)); else evsel__sw_name(evsel, bf, sizeof(bf)); break; diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index 45476a888942..cd3e38ed3dfa 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h @@ -257,6 +257,7 @@ extern const char *evsel__hw_cache_op[PERF_COUNT_HW_CAC= HE_OP_MAX][EVSEL__MAX_ALI extern const char *evsel__hw_cache_result[PERF_COUNT_HW_CACHE_RESULT_MAX][= EVSEL__MAX_ALIASES]; extern const char *evsel__hw_names[PERF_COUNT_HW_MAX]; extern const char *evsel__sw_names[PERF_COUNT_SW_MAX]; +extern const char *evsel__tool_names[PERF_TOOL_MAX]; extern char *evsel__bpf_counter_events; bool evsel__match_bpf_counter_events(const char *name); =20 diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 533c4b216ae2..e6b51810e85c 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -156,6 +156,21 @@ struct event_symbol event_symbols_sw[PERF_COUNT_SW_MAX= ] =3D { }, }; =20 +struct event_symbol event_symbols_tool[PERF_TOOL_MAX] =3D { + [PERF_TOOL_DURATION_TIME] =3D { + .symbol =3D "duration_time", + .alias =3D "", + }, + [PERF_TOOL_USER_TIME] =3D { + .symbol =3D "user_time", + .alias =3D "", + }, + [PERF_TOOL_SYSTEM_TIME] =3D { + .symbol =3D "system_time", + .alias =3D "", + }, +}; + #define __PERF_EVENT_FIELD(config, name) \ ((config & PERF_EVENT_##name##_MASK) >> PERF_EVENT_##name##_SHIFT) =20 @@ -2934,21 +2949,34 @@ int print_hwcache_events(const char *event_glob, bo= ol name_only) return evt_num; } =20 -static void print_tool_event(const char *name, const char *event_glob, +static void print_tool_event(const struct event_symbol *syms, const char *= event_glob, bool name_only) { - if (event_glob && !strglobmatch(name, event_glob)) + if (syms->symbol =3D=3D NULL) + return; + + if (event_glob && !(strglobmatch(syms->symbol, event_glob) || + (syms->alias && strglobmatch(syms->alias, event_glob)))) return; + if (name_only) - printf("%s ", name); - else + printf("%s ", syms->symbol); + else { + char name[MAX_NAME_LEN]; + if (syms->alias && strlen(syms->alias)) + snprintf(name, MAX_NAME_LEN, "%s OR %s", syms->symbol, syms->alias); + else + strlcpy(name, syms->symbol, MAX_NAME_LEN); printf(" %-50s [%s]\n", name, "Tool event"); - + } } =20 void print_tool_events(const char *event_glob, bool name_only) { - print_tool_event("duration_time", event_glob, name_only); + // Start at 1 because the first enum entry symbols no tool event + for (int i =3D 1; i < PERF_TOOL_MAX; ++i) { + print_tool_event(event_symbols_tool + i, event_glob, name_only); + } if (pager_in_use()) printf("\n"); } --=20 2.35.1 From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C22E0C433F5 for ; Mon, 3 Oct 2022 07:31:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231270AbiJCHbS (ORCPT ); Mon, 3 Oct 2022 03:31:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231162AbiJCH3W (ORCPT ); Mon, 3 Oct 2022 03:29:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9571D192A8; Mon, 3 Oct 2022 00:20:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 368B360FA2; Mon, 3 Oct 2022 07:20:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4502FC433D6; Mon, 3 Oct 2022 07:20:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781604; bh=ltonZA8UZoNCsAd5zA4FMw/ErDxEugLoPZ/GEw1M94M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EYl2tKvB4i5v8REc5lPzRX5MqLFW2Mh8ZKim2uFRU2IvdpkR0KGY9Ftz0K/A2g+Dy cHkM9ZYkdctPkjRA4kNA7ihyDGiri4pRXYUIW2Ec5cz+R3iEYPhmmSMe7EpHxF3oEg THWRfESLaZQv+aFWYTLeEl2Uj6dTcq9KjQ5yCCPQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nadav Amit , "Peter Zijlstra (Intel)" , stable@kernel.org Subject: [PATCH 5.15 80/83] x86/alternative: Fix race in try_get_desc() Date: Mon, 3 Oct 2022 09:11:45 +0200 Message-Id: <20221003070724.006942646@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nadav Amit commit efd608fa7403ba106412b437f873929e2c862e28 upstream. I encountered some occasional crashes of poke_int3_handler() when kprobes are set, while accessing desc->vec. The text poke mechanism claims to have an RCU-like behavior, but it does not appear that there is any quiescent state to ensure that nobody holds reference to desc. As a result, the following race appears to be possible, which can lead to memory corruption. CPU0 CPU1 ---- ---- text_poke_bp_batch() -> smp_store_release(&bp_desc, &desc) [ notice that desc is on the stack ] poke_int3_handler() [ int3 might be kprobe's so sync events are do not help ] -> try_get_desc(descp=3D&bp_desc) desc =3D __READ_ONCE(bp_desc) if (!desc) [false, success] WRITE_ONCE(bp_desc, NULL); atomic_dec_and_test(&desc.refs) [ success, desc space on the stack is being reused and might have non-zero value. ] arch_atomic_inc_not_zero(&desc->refs) [ might succeed since desc points to stack memory that was freed and might be reused. ] Fix this issue with small backportable patch. Instead of trying to make RCU-like behavior for bp_desc, just eliminate the unnecessary level of indirection of bp_desc, and hold the whole descriptor as a global. Anyhow, there is only a single descriptor at any given moment. Fixes: 1f676247f36a4 ("x86/alternatives: Implement a better poke_int3_handl= er() completion scheme") Signed-off-by: Nadav Amit Signed-off-by: Peter Zijlstra (Intel) Cc: stable@kernel.org Link: https://lkml.kernel.org/r/20220920224743.3089-1-namit@vmware.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- arch/x86/kernel/alternative.c | 45 +++++++++++++++++++++----------------= ----- 1 file changed, 23 insertions(+), 22 deletions(-) --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -1200,22 +1200,23 @@ struct bp_patching_desc { atomic_t refs; }; =20 -static struct bp_patching_desc *bp_desc; +static struct bp_patching_desc bp_desc; =20 static __always_inline -struct bp_patching_desc *try_get_desc(struct bp_patching_desc **descp) +struct bp_patching_desc *try_get_desc(void) { - /* rcu_dereference */ - struct bp_patching_desc *desc =3D __READ_ONCE(*descp); + struct bp_patching_desc *desc =3D &bp_desc; =20 - if (!desc || !arch_atomic_inc_not_zero(&desc->refs)) + if (!arch_atomic_inc_not_zero(&desc->refs)) return NULL; =20 return desc; } =20 -static __always_inline void put_desc(struct bp_patching_desc *desc) +static __always_inline void put_desc(void) { + struct bp_patching_desc *desc =3D &bp_desc; + smp_mb__before_atomic(); arch_atomic_dec(&desc->refs); } @@ -1248,15 +1249,15 @@ noinstr int poke_int3_handler(struct pt_ =20 /* * Having observed our INT3 instruction, we now must observe - * bp_desc: + * bp_desc with non-zero refcount: * - * bp_desc =3D desc INT3 + * bp_desc.refs =3D 1 INT3 * WMB RMB - * write INT3 if (desc) + * write INT3 if (bp_desc.refs !=3D 0) */ smp_rmb(); =20 - desc =3D try_get_desc(&bp_desc); + desc =3D try_get_desc(); if (!desc) return 0; =20 @@ -1310,7 +1311,7 @@ noinstr int poke_int3_handler(struct pt_ ret =3D 1; =20 out_put: - put_desc(desc); + put_desc(); return ret; } =20 @@ -1341,18 +1342,20 @@ static int tp_vec_nr; */ static void text_poke_bp_batch(struct text_poke_loc *tp, unsigned int nr_e= ntries) { - struct bp_patching_desc desc =3D { - .vec =3D tp, - .nr_entries =3D nr_entries, - .refs =3D ATOMIC_INIT(1), - }; unsigned char int3 =3D INT3_INSN_OPCODE; unsigned int i; int do_sync; =20 lockdep_assert_held(&text_mutex); =20 - smp_store_release(&bp_desc, &desc); /* rcu_assign_pointer */ + bp_desc.vec =3D tp; + bp_desc.nr_entries =3D nr_entries; + + /* + * Corresponds to the implicit memory barrier in try_get_desc() to + * ensure reading a non-zero refcount provides up to date bp_desc data. + */ + atomic_set_release(&bp_desc.refs, 1); =20 /* * Corresponding read barrier in int3 notifier for making sure the @@ -1440,12 +1443,10 @@ static void text_poke_bp_batch(struct te text_poke_sync(); =20 /* - * Remove and synchronize_rcu(), except we have a very primitive - * refcount based completion. + * Remove and wait for refs to be zero. */ - WRITE_ONCE(bp_desc, NULL); /* RCU_INIT_POINTER */ - if (!atomic_dec_and_test(&desc.refs)) - atomic_cond_read_acquire(&desc.refs, !VAL); + if (!atomic_dec_and_test(&bp_desc.refs)) + atomic_cond_read_acquire(&bp_desc.refs, !VAL); } =20 static void text_poke_loc_init(struct text_poke_loc *tp, void *addr, From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48B75C43217 for ; Mon, 3 Oct 2022 07:35:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230350AbiJCHfA (ORCPT ); Mon, 3 Oct 2022 03:35:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231536AbiJCHdR (ORCPT ); Mon, 3 Oct 2022 03:33:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FFB551A3B; Mon, 3 Oct 2022 00:21:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 00B6F60FAF; Mon, 3 Oct 2022 07:20:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 095B5C433C1; Mon, 3 Oct 2022 07:20:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781607; bh=5MeWdv7QEq5qwHIqdXd8S1KtB/BKNxNsG/oQQXbg1Ew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uyk3sWN1ooNBsxO/HQuNvr+zQOtvo9kSI7py9A8A/oev2rLnFnRrW+wzhheAYP2c8 +Z/TyHMolJEPWxLWuqmh1+N+ErOh7IdhB0i12Egt+fpVoDZscurGDh89Asi//5FmH6 kkXSsfm7GGD9jRTWetK+xfz4k76PUNIShZGgykjg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Janes , Chris Wilson , Andi Shyti , Janusz Krzysztofik , Tvrtko Ursulin , Rodrigo Vivi Subject: [PATCH 5.15 81/83] drm/i915/gem: Really move i915_gem_context.link under ref protection Date: Mon, 3 Oct 2022 09:11:46 +0200 Message-Id: <20221003070724.033607469@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chris Wilson commit d119888b09bd567e07c6b93a07f175df88857e02 upstream. i915_perf assumes that it can use the i915_gem_context reference to protect its i915->gem.contexts.list iteration. However, this requires that we do not remove the context from the list until after we drop the final reference and release the struct. If, as currently, we remove the context from the list during context_close(), the link.next pointer may be poisoned while we are holding the context reference and cause a GPF: [ 4070.573157] i915 0000:00:02.0: [drm:i915_perf_open_ioctl [i915]] filteri= ng on ctx_id=3D0x1fffff ctx_id_mask=3D0x1fffff [ 4070.574881] general protection fault, probably for non-canonical address= 0xdead000000000100: 0000 [#1] PREEMPT SMP [ 4070.574897] CPU: 1 PID: 284392 Comm: amd_performance Tainted: G = E 5.17.9 #180 [ 4070.574903] Hardware name: Intel Corporation NUC7i5BNK/NUC7i5BNB, BIOS B= NKBL357.86A.0052.2017.0918.1346 09/18/2017 [ 4070.574907] RIP: 0010:oa_configure_all_contexts.isra.0+0x222/0x350 [i915] [ 4070.574982] Code: 08 e8 32 6e 10 e1 4d 8b 6d 50 b8 ff ff ff ff 49 83 ed = 50 f0 41 0f c1 04 24 83 f8 01 0f 84 e3 00 00 00 85 c0 0f 8e fa 00 00 00 <49= > 8b 45 50 48 8d 70 b0 49 8d 45 50 48 39 44 24 10 0f 85 34 fe ff [ 4070.574990] RSP: 0018:ffffc90002077b78 EFLAGS: 00010202 [ 4070.574995] RAX: 0000000000000002 RBX: 0000000000000002 RCX: 00000000000= 00000 [ 4070.575000] RDX: 0000000000000001 RSI: ffffc90002077b20 RDI: ffff88810dd= c7c68 [ 4070.575004] RBP: 0000000000000001 R08: ffff888103242648 R09: fffffffffff= ffffc [ 4070.575008] R10: ffffffff82c50bc0 R11: 0000000000025c80 R12: ffff888101b= f1860 [ 4070.575012] R13: dead0000000000b0 R14: ffffc90002077c04 R15: ffff88810be= 5cabc [ 4070.575016] FS: 00007f1ed50c0780(0000) GS:ffff88885ec80000(0000) knlGS:= 0000000000000000 [ 4070.575021] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 4070.575025] CR2: 00007f1ed5590280 CR3: 000000010ef6f005 CR4: 00000000003= 706e0 [ 4070.575029] Call Trace: [ 4070.575033] [ 4070.575037] lrc_configure_all_contexts+0x13e/0x150 [i915] [ 4070.575103] gen8_enable_metric_set+0x4d/0x90 [i915] [ 4070.575164] i915_perf_open_ioctl+0xbc0/0x1500 [i915] [ 4070.575224] ? asm_common_interrupt+0x1e/0x40 [ 4070.575232] ? i915_oa_init_reg_state+0x110/0x110 [i915] [ 4070.575290] drm_ioctl_kernel+0x85/0x110 [ 4070.575296] ? update_load_avg+0x5f/0x5e0 [ 4070.575302] drm_ioctl+0x1d3/0x370 [ 4070.575307] ? i915_oa_init_reg_state+0x110/0x110 [i915] [ 4070.575382] ? gen8_gt_irq_handler+0x46/0x130 [i915] [ 4070.575445] __x64_sys_ioctl+0x3c4/0x8d0 [ 4070.575451] ? __do_softirq+0xaa/0x1d2 [ 4070.575456] do_syscall_64+0x35/0x80 [ 4070.575461] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 4070.575467] RIP: 0033:0x7f1ed5c10397 [ 4070.575471] Code: 3c 1c e8 1c ff ff ff 85 c0 79 87 49 c7 c4 ff ff ff ff = 5b 5d 4c 89 e0 41 5c c3 66 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48= > 3d 01 f0 ff ff 73 01 c3 48 8b 0d a9 da 0d 00 f7 d8 64 89 01 48 [ 4070.575478] RSP: 002b:00007ffd65c8d7a8 EFLAGS: 00000246 ORIG_RAX: 000000= 0000000010 [ 4070.575484] RAX: ffffffffffffffda RBX: 0000000000000006 RCX: 00007f1ed5c= 10397 [ 4070.575488] RDX: 00007ffd65c8d7c0 RSI: 0000000040106476 RDI: 00000000000= 00006 [ 4070.575492] RBP: 00005620972f9c60 R08: 000000000000000a R09: 00000000000= 00005 [ 4070.575496] R10: 000000000000000d R11: 0000000000000246 R12: 00000000000= 0000a [ 4070.575500] R13: 000000000000000d R14: 0000000000000000 R15: 00007ffd65c= 8d7c0 [ 4070.575505] [ 4070.575507] Modules linked in: nls_ascii(E) nls_cp437(E) vfat(E) fat(E) = i915(E) x86_pkg_temp_thermal(E) intel_powerclamp(E) crct10dif_pclmul(E) crc= 32_pclmul(E) crc32c_intel(E) aesni_intel(E) crypto_simd(E) intel_gtt(E) cry= ptd(E) ttm(E) rapl(E) intel_cstate(E) drm_kms_helper(E) cfbfillrect(E) sysc= opyarea(E) cfbimgblt(E) intel_uncore(E) sysfillrect(E) mei_me(E) sysimgblt(= E) i2c_i801(E) fb_sys_fops(E) mei(E) intel_pch_thermal(E) i2c_smbus(E) cfbc= opyarea(E) video(E) button(E) efivarfs(E) autofs4(E) [ 4070.575549] ---[ end trace 0000000000000000 ]--- v3: fix incorrect syntax of spin_lock() replacing spin_lock_irqsave() v2: irqsave not required in a worker, neither conversion to irq safe elsewhere (Tvrtko), - perf: it's safe to call gen8_configure_context() even if context has been closed, no need to check, - drop unrelated cleanup (Andi, Tvrtko) Reported-by: Mark Janes Closes: https://gitlab.freedesktop.org/drm/intel/issues/6222 Fixes: f8246cf4d9a9 ("drm/i915/gem: Drop free_work for GEM contexts") Signed-off-by: Chris Wilson Reviewed-by: Andi Shyti Signed-off-by: Janusz Krzysztofik Cc: Tvrtko Ursulin Cc: # v5.12+ Signed-off-by: Andi Shyti Link: https://patchwork.freedesktop.org/patch/msgid/20220916092403.201355-3= -janusz.krzysztofik@linux.intel.com (cherry picked from commit ad3aa7c31efa5a09b0dba42e66cfdf77e0db7dc2) Signed-off-by: Rodrigo Vivi [janusz: backport] Signed-off-by: Janusz Krzysztofik Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/gpu/drm/i915/gem/i915_gem_context.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c @@ -997,6 +997,10 @@ void i915_gem_context_release(struct kre trace_i915_context_free(ctx); GEM_BUG_ON(!i915_gem_context_is_closed(ctx)); =20 + spin_lock(&ctx->i915->gem.contexts.lock); + list_del(&ctx->link); + spin_unlock(&ctx->i915->gem.contexts.lock); + if (ctx->syncobj) drm_syncobj_put(ctx->syncobj); =20 @@ -1228,10 +1232,6 @@ static void context_close(struct i915_ge */ lut_close(ctx); =20 - spin_lock(&ctx->i915->gem.contexts.lock); - list_del(&ctx->link); - spin_unlock(&ctx->i915->gem.contexts.lock); - mutex_unlock(&ctx->mutex); =20 /* From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 961A5C433FE for ; Mon, 3 Oct 2022 07:34:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231382AbiJCHez (ORCPT ); Mon, 3 Oct 2022 03:34:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231314AbiJCHdH (ORCPT ); Mon, 3 Oct 2022 03:33:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F12A4F02B; Mon, 3 Oct 2022 00:21:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A455660FBD; Mon, 3 Oct 2022 07:20:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FD5CC433D6; Mon, 3 Oct 2022 07:20:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781610; bh=1gUeMXGvlG3wk/DWkcHRFN1RbJh6rlH/eFsmuofcZWs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=svPP+d70+5cwGuClT8k95yzWdKh1SxwlE6RiRaCv6ZWF99mNcI+1Y6RiQvVCbTbf+ B3/jKeTiKTG8ssoA///3ZBsIXTSFd/V4lV69fZdNGwV0Q4TtbcP41szBYC/Gsx2I8i IMCB08zFkKQi1ykpZKeX80ZAz2tKPv++VZc6vwf4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Garry , Zhengjun Xing , Alexander Shishkin , Ian Rogers , Ingo Molnar , Jiri Olsa , Kan Liang , Mark Rutland , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo Subject: [PATCH 5.15 82/83] perf pmu: Fix alias events list Date: Mon, 3 Oct 2022 09:11:47 +0200 Message-Id: <20221003070724.059824448@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: John Garry commit e0257a01d6689c273a019756ed5e13911cc1bfed upstream. Commit 0e0ae8742207c3b4 ("perf list: Display hybrid PMU events with cpu type") changes the event list for uncore PMUs or arm64 heterogeneous CPU systems, such that duplicate aliases are incorrectly listed per PMU (which they should not be), like: # perf list ... unc_cbo_cache_lookup.any_es [Unit: uncore_cbox L3 Lookup any request that access cache and found line in E or S-state] unc_cbo_cache_lookup.any_es [Unit: uncore_cbox L3 Lookup any request that access cache and found line in E or S-state] unc_cbo_cache_lookup.any_i [Unit: uncore_cbox L3 Lookup any request that access cache and found line in I-state] unc_cbo_cache_lookup.any_i [Unit: uncore_cbox L3 Lookup any request that access cache and found line in I-state] ... Notice how the events are listed twice. The named commit changed how we remove duplicate events, in that events for different PMUs are not treated as duplicates. I suppose this is to handle how "Each hybrid pmu event has been assigned with a pmu name". Fix PMU alias listing by restoring behaviour to remove duplicates for non-hybrid PMUs. Fixes: 0e0ae8742207c3b4 ("perf list: Display hybrid PMU events with cpu typ= e") Signed-off-by: John Garry Tested-by: Zhengjun Xing Cc: Alexander Shishkin Cc: Ian Rogers Cc: Ingo Molnar Cc: Jiri Olsa Cc: Kan Liang Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Link: https://lore.kernel.org/r/1640103090-140490-1-git-send-email-john.gar= ry@huawei.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- tools/perf/util/pmu.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -1659,6 +1659,21 @@ bool is_pmu_core(const char *name) return !strcmp(name, "cpu") || is_arm_pmu_core(name); } =20 +static bool pmu_alias_is_duplicate(struct sevent *alias_a, + struct sevent *alias_b) +{ + /* Different names -> never duplicates */ + if (strcmp(alias_a->name, alias_b->name)) + return false; + + /* Don't remove duplicates for hybrid PMUs */ + if (perf_pmu__is_hybrid(alias_a->pmu) && + perf_pmu__is_hybrid(alias_b->pmu)) + return false; + + return true; +} + void print_pmu_events(const char *event_glob, bool name_only, bool quiet_f= lag, bool long_desc, bool details_flag, bool deprecated, const char *pmu_name) @@ -1744,12 +1759,8 @@ void print_pmu_events(const char *event_ qsort(aliases, len, sizeof(struct sevent), cmp_sevent); for (j =3D 0; j < len; j++) { /* Skip duplicates */ - if (j > 0 && !strcmp(aliases[j].name, aliases[j - 1].name)) { - if (!aliases[j].pmu || !aliases[j - 1].pmu || - !strcmp(aliases[j].pmu, aliases[j - 1].pmu)) { - continue; - } - } + if (j > 0 && pmu_alias_is_duplicate(&aliases[j], &aliases[j - 1])) + continue; =20 if (name_only) { printf("%s ", aliases[j].name); From nobody Sun Dec 14 02:01:22 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED4D9C433FE for ; Mon, 3 Oct 2022 07:36:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231676AbiJCHgT (ORCPT ); Mon, 3 Oct 2022 03:36:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231849AbiJCHen (ORCPT ); Mon, 3 Oct 2022 03:34:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67AEC52E77; Mon, 3 Oct 2022 00:22:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 367CE60F63; Mon, 3 Oct 2022 07:20:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24026C433D6; Mon, 3 Oct 2022 07:20:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781612; bh=13C3QloQDPqqF6W9Qir9Cbi40y10lnN/vsoL0fBFNHM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nq4LpLs0hc/A2R+TqHmXDwutsft9g+fBWA9S7VExpZMYCKZDB0DYJAPq0bzwOmPgr legHdBTfcHRi0B7k9gM0kYy5HSxEUBlA35qkS25pOHKAKHt4mbzrCy5K4KoZOi6Pyz ShoWDuN/u8AK/8OGwhrUCiVUH4jjLvhl0lDbNcrY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ian Rogers , Adrian Hunter , Alexander Shishkin , Andi Kleen , Florian Fischer , Ingo Molnar , James Clark , Jiri Olsa , John Garry , Kim Phillips , Madhavan Srinivasan , Mark Rutland , Namhyung Kim , Peter Zijlstra , Riccardo Mancini , Shunsuke Nakamura , Stephane Eranian , Xing Zhengjun , Arnaldo Carvalho de Melo Subject: [PATCH 5.15 83/83] perf evsel: Add tool event helpers Date: Mon, 3 Oct 2022 09:11:48 +0200 Message-Id: <20221003070724.087426771@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ian Rogers commit 79932d161fda7f2d18761ace5f25445f7b525741 upstream. Convert to and from a string. Fix evsel__tool_name() as array is off-by-1. Support more than just duration_time as a metric-id. Fixes: 75eafc970bd9d36d ("perf list: Print all available tool events") Signed-off-by: Ian Rogers Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Andi Kleen Cc: Florian Fischer Cc: Ingo Molnar Cc: James Clark Cc: Jiri Olsa Cc: John Garry Cc: Kim Phillips Cc: Madhavan Srinivasan Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Riccardo Mancini Cc: Shunsuke Nakamura Cc: Stephane Eranian Cc: Xing Zhengjun Link: https://lore.kernel.org/r/20220507053410.3798748-4-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Kelsey Steele Tested-by: Ron Economos Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- tools/perf/util/evsel.c | 41 +++++++++++++++++++++++++++++++---------- tools/perf/util/evsel.h | 11 +++++++++++ 2 files changed, 42 insertions(+), 10 deletions(-) --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -59,6 +59,33 @@ struct perf_missing_features perf_missin =20 static clockid_t clockid; =20 +static const char *const perf_tool_event__tool_names[PERF_TOOL_MAX] =3D { + NULL, + "duration_time", + "user_time", + "system_time", +}; + +const char *perf_tool_event__to_str(enum perf_tool_event ev) +{ + if (ev > PERF_TOOL_NONE && ev < PERF_TOOL_MAX) + return perf_tool_event__tool_names[ev]; + + return NULL; +} + +enum perf_tool_event perf_tool_event__from_str(const char *str) +{ + int i; + + perf_tool_event__for_each_event(i) { + if (!strcmp(str, perf_tool_event__tool_names[i])) + return i; + } + return PERF_TOOL_NONE; +} + + static int evsel__no_extra_init(struct evsel *evsel __maybe_unused) { return 0; @@ -600,15 +627,9 @@ static int evsel__sw_name(struct evsel * return r + evsel__add_modifiers(evsel, bf + r, size - r); } =20 -const char *evsel__tool_names[PERF_TOOL_MAX] =3D { - "duration_time", - "user_time", - "system_time", -}; - static int evsel__tool_name(enum perf_tool_event ev, char *bf, size_t size) { - return scnprintf(bf, size, "%s", evsel__tool_names[ev]); + return scnprintf(bf, size, "%s", perf_tool_event__to_str(ev)); } =20 static int __evsel__bp_name(char *bf, size_t size, u64 addr, u64 type) @@ -761,7 +782,7 @@ const char *evsel__name(struct evsel *ev break; =20 case PERF_TYPE_SOFTWARE: - if (evsel->tool_event) + if (evsel__is_tool(evsel)) evsel__tool_name(evsel->tool_event, bf, sizeof(bf)); else evsel__sw_name(evsel, bf, sizeof(bf)); @@ -794,8 +815,8 @@ const char *evsel__metric_id(const struc if (evsel->metric_id) return evsel->metric_id; =20 - if (evsel->core.attr.type =3D=3D PERF_TYPE_SOFTWARE && evsel->tool_event) - return "duration_time"; + if (evsel__is_tool(evsel)) + return perf_tool_event__to_str(evsel->tool_event); =20 return "unknown"; } --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h @@ -30,6 +30,12 @@ enum perf_tool_event { PERF_TOOL_DURATION_TIME =3D 1, }; =20 +const char *perf_tool_event__to_str(enum perf_tool_event ev); +enum perf_tool_event perf_tool_event__from_str(const char *str); + +#define perf_tool_event__for_each_event(ev) \ + for ((ev) =3D PERF_TOOL_DURATION_TIME; (ev) < PERF_TOOL_MAX; ev++) + /** struct evsel - event selector * * @evlist - evlist this evsel is in, if it is in one. @@ -265,6 +271,11 @@ int __evsel__hw_cache_type_op_res_name(u const char *evsel__name(struct evsel *evsel); const char *evsel__metric_id(const struct evsel *evsel); =20 +static inline bool evsel__is_tool(const struct evsel *evsel) +{ + return evsel->tool_event !=3D PERF_TOOL_NONE; +} + const char *evsel__group_name(struct evsel *evsel); int evsel__group_desc(struct evsel *evsel, char *buf, size_t size);