From patchwork Mon Sep 20 16:42:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 514369 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2331863jao; Mon, 20 Sep 2021 11:40:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyc3h5FidZSH1zWoM5m+TRd/H91Gu3EoG0ULebOeEek9RdM86d0wY/6y1St6P1HxwZGNxru X-Received: by 2002:a05:6e02:1c2c:: with SMTP id m12mr15348634ilh.114.1632163204316; Mon, 20 Sep 2021 11:40:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632163204; cv=none; d=google.com; s=arc-20160816; b=DyZnkc1PHfId2MOS8SWJ7vJ4eeoXxup0YdwgF1GR8wxKyxe7UDvSEG4ihPv7jXQXMG QN7CPHhtUw9W6VobxvzxpiRR6HArOeE5YICkUv40CYcVKrm/mY8W/yz3TLNm0V2T6l5p qdLMD4UYREs/gS3Bh/h3iUA0swa0rQJ5E1rTHVFBJ0vmBAzv9ofUsyxLtb5aUSZA61+o /XtyVDkJ7WgOcYwYEZrHTkFJarEXpiuBet//IqQQiKi63t4EDT0Od0PNJFwzWz62JGZd KBgXMHdoYyC6xC6fhDwFN6GcLcAU98b9HsdqLOWR+JAhyTsMOKdXtMC/zMWjTWG829me AdLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XpHvNzPmVh6zrA0PBaNnbPrNdLb6bxaq5NTWrEXUO0A=; b=ubOxMpFDGoX+xroqfc2C6PGoHoEx2FnaI4oJCXhMjpqQ2N97Wp5hwcDFepbq3TgY7e a7Vwb9u3Oa17vn5BE/HHx6XrYZ0m5MNYgl/bxIAjTt4Q23axLmqnuf98JXT9xwtOL9Lj xB2EWe41tg/QA4ryG1H7DaHJS9AqU8l9J7UUhJbB/4+kXtj2MYtIKxOLhTYAT+1ckMGU l0zllksv5aCeXp0y/24vcMZPw9qDpbFcLNoZLWMZ+xvgiXKd3q+sZb3tmCynVJaHCvZ5 yODnORkGxDnuv8t9miC8vgBLy/FfVZts9SJyS6fZ4bxf29FxVJM6InLHo3+QFJDyecvy noeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZqexsyE0; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y18si1268829iow.31.2021.09.20.11.40.03; Mon, 20 Sep 2021 11:40:04 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZqexsyE0; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353607AbhITSlR (ORCPT + 11 others); Mon, 20 Sep 2021 14:41:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:53066 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381484AbhITSiW (ORCPT ); Mon, 20 Sep 2021 14:38:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 14AD26331D; Mon, 20 Sep 2021 17:29:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158998; bh=YUVk19KBBd5oNKIWdem0ilUR52CnlfnPNYdNYsXsA3Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZqexsyE01t5IOVNHUKxl2V4KQmpQosetVEBDxO0NW1Ln+TMP84XFON4sONFEajPAx 40KDuBlFHIBg1IDZZG7Ft/j0nv0gKRdR6xubPTq7luBFWv+twS6wHxVMI4veeZwugK 4rJPfWhXMfAv7BbY3M5V2ZQTrnI8v2KQpG97fJEI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown , Catalin Marinas Subject: [PATCH 5.14 007/168] arm64/sve: Use correct size when reinitialising SVE state Date: Mon, 20 Sep 2021 18:42:25 +0200 Message-Id: <20210920163921.888344722@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163921.633181900@linuxfoundation.org> References: <20210920163921.633181900@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Mark Brown commit e35ac9d0b56e9efefaeeb84b635ea26c2839ea86 upstream. When we need a buffer for SVE register state we call sve_alloc() to make sure that one is there. In order to avoid repeated allocations and frees we keep the buffer around unless we change vector length and just memset() it to ensure a clean register state. The function that deals with this takes the task to operate on as an argument, however in the case where we do a memset() we initialise using the SVE state size for the current task rather than the task passed as an argument. This is only an issue in the case where we are setting the register state for a task via ptrace and the task being configured has a different vector length to the task tracing it. In the case where the buffer is larger in the traced process we will leak old state from the traced process to itself, in the case where the buffer is smaller in the traced process we will overflow the buffer and corrupt memory. Fixes: bc0ee4760364 ("arm64/sve: Core task context handling") Cc: # 4.15.x Signed-off-by: Mark Brown Link: https://lore.kernel.org/r/20210909165356.10675-1-broonie@kernel.org Signed-off-by: Catalin Marinas Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/fpsimd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c @@ -511,7 +511,7 @@ size_t sve_state_size(struct task_struct void sve_alloc(struct task_struct *task) { if (task->thread.sve_state) { - memset(task->thread.sve_state, 0, sve_state_size(current)); + memset(task->thread.sve_state, 0, sve_state_size(task)); return; } From patchwork Mon Sep 20 16:43:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 514370 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2331873jao; Mon, 20 Sep 2021 11:40:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+79JlpkBBxw4Xj5+sb/lDNaR1NzQdXLaw8Z9qi+z72Xdra8Yt16SGL99dQyLapBcUqDOy X-Received: by 2002:a05:6e02:8a7:: with SMTP id a7mr19399295ilt.246.1632163205045; Mon, 20 Sep 2021 11:40:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632163205; cv=none; d=google.com; s=arc-20160816; b=AsCEi3xfPPE19KU+j8YmRIj4z049/DYLoR2WdyXCKKxLB1YiLR3CaJ0jng1YPBNl02 Rn1Pbp1R9HtackequCCj0PUAdtrSOlPXg1mSHLlDIw9R3Kd+TUFBtGpfeSdI/rb6m6qv fSNVauSV2uMwhAm54EOF1qX5WWhdxoPS4nuLy7LlBiRfAsSx4JNgwTIuAVMO+OZAI/TA X26jbwbny3uKFHGQPk3Bi/UJy9EdRsC8alo9bhllSMAjyIiVjKb/4Wr23RYe8rvuW89A hR4iHnNqShYCpObTx7lFPeTCXynRm1UiyZ8173ifku2V1yHzoqyX1jLeegk0RidET+fN F4LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5LVVb1OKWgZwWclewhf2/rH2mWzxqottqgEso//iu/E=; b=teKEuuiYfCdSDtdnTWOrrSIltIw+6gdugKi6f6tmxyh0RESnqHLD4l5PukC7sOTsut 6kCzypizwOZyzCOz00vQ95k/mpWvVbVtove+sYEOczV8BrEE5ji6Rxz/QrI2kO4a8qw7 MK4sTxJPvfClH70pN+6VOPK/0b2oy8ZEtPo5DTVxqP+jv9kSIKuK+0Aeug70KOGjyy+B dIf3LukzQJtqcX0yDrYgHJBjN8KWd/NnSHSVcmi6KhkrvhQGqhVI8Knv7gpmxRG6bfb3 SB+fKfJc5VQuUgAzs4YbfJ9H96KEu1wMn+B2VeHHZf3pXZ06eSRyB3tft4kvgCfFO4hx F+zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Dht1A681; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y18si1268829iow.31.2021.09.20.11.40.04; Mon, 20 Sep 2021 11:40:05 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Dht1A681; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353642AbhITSlT (ORCPT + 11 others); Mon, 20 Sep 2021 14:41:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:56242 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381810AbhITSjY (ORCPT ); Mon, 20 Sep 2021 14:39:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7D81A6332F; Mon, 20 Sep 2021 17:30:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632159037; bh=Yo7QJlKkuJiBVS14uvsKjHFdFVdEYs0VGor2xfgVqFA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dht1A681gOiG99u3OE/GuvZHwbuaXwO+nSdMynyOiT/ESv8wSQz+ijbSFb3Czm9uK QhXJZzs1uG1hiDWHlUgd2GAVSEPS5Hwnugg18kiPdEl2sQYyujHTsV2oRnQBP+BnAn YHSgWzZDHfVhj2o7wSEwyUlGySh9kzUgrENz5eSI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Enric Balletbo i Serra , Linus Torvalds Subject: [PATCH 5.14 047/168] drm/rockchip: cdn-dp-core: Make cdn_dp_core_resume __maybe_unused Date: Mon, 20 Sep 2021 18:43:05 +0200 Message-Id: <20210920163923.187989654@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163921.633181900@linuxfoundation.org> References: <20210920163921.633181900@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Arnd Bergmann commit 040b8907ccf1c78d020aca29800036565d761d73 upstream. With the new static annotation, the compiler warns when the functions are actually unused: drivers/gpu/drm/rockchip/cdn-dp-core.c:1123:12: error: 'cdn_dp_resume' defined but not used [-Werror=unused-function] 1123 | static int cdn_dp_resume(struct device *dev) | ^~~~~~~~~~~~~ Mark them __maybe_unused to suppress that warning as well. [ Not so 'new' static annotations any more, and I removed the part of the patch that added __maybe_unused to cdn_dp_suspend(), because it's used by the shutdown/remove code. So only the resume function ends up possibly unused if CONFIG_PM isn't set - Linus ] Fixes: 7c49abb4c2f8 ("drm/rockchip: cdn-dp-core: Make cdn_dp_core_suspend/resume static") Signed-off-by: Arnd Bergmann Reviewed-by: Enric Balletbo i Serra Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/rockchip/cdn-dp-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c @@ -1123,7 +1123,7 @@ static int cdn_dp_suspend(struct device return ret; } -static int cdn_dp_resume(struct device *dev) +static __maybe_unused int cdn_dp_resume(struct device *dev) { struct cdn_dp_device *dp = dev_get_drvdata(dev); From patchwork Mon Sep 20 16:43:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 514371 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2332658jao; Mon, 20 Sep 2021 11:40:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWkZPL8Z9w0f0ge7zsVijxHxELqB6H65Gy5tqWsoVOAgV3yCUFZCHsMmbPbDAVRaFrgmzR X-Received: by 2002:a92:d3c1:: with SMTP id c1mr19025051ilh.223.1632163254059; Mon, 20 Sep 2021 11:40:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632163254; cv=none; d=google.com; s=arc-20160816; b=dzIgR0S+CIarFKc+HX/Rg0xMNdooeDB4v89UZNn0Dkzfv2rBVuUOXeAp3rXTCd3sIR MUGvxQ63zFjJ0D/SJi4fDAdNmu84T2UkeHJH87ldzcpa2UoOOzY1adD3dAoTyjlr6nHn ybUIpXNLrp11gJBUFtS4x4Kn5aW+ISooDCbyAfwlRX9dTp6UkuBC0mtcppdnH/OWpsWF e1iajhHiZDDNyZFn8k8U4OD7FdPIgQds5xkS6+q2av7h9vFrx1lq4iBJAB12NBzsYHgl E2bFhRNqGDNnHx4hr/4+EJezHZtYe7FEOXhMKpz+F7YcLa8NXLinF8ctRwKtFjAdCGI6 ySSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8aV1SM7MTjHwSHejGGxKampTf8JbC60NtJ0Fm7O6zTI=; b=rHZFytJ3t28PW0R88n6gTRr2A3mr/RfTK7sN4t83R19uIVZaS5dYqRHcGQgX6OAM04 oICVTszYdCIx3lgpnS4WutTii17lR/kSSpWcqsaJEVW9QQNIPVvGaFm9VnkqzXYawi0r okrZYiUsVo29qnzgD1pdhLQ0Tebrh2hj7GuO+FZ3W//1wj0KCIg2mQVA+3ZfE4EtgdxD Fo75kPsy1AoHFnbIJKzrbhSkMaVdQ99RsYNTXGgRUITFAtGXTerMvVyMrUI4CquaTcLp 01kAkXUCrBxTJNj/lC81yC2cTs1Id+W978mcFFMgKe0qqQRNI7Z6tmieMSSuzlFqfLGu /pRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YMSXFpJC; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c20si4517836ilu.11.2021.09.20.11.40.53; Mon, 20 Sep 2021 11:40:54 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YMSXFpJC; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349277AbhITSmS (ORCPT + 11 others); Mon, 20 Sep 2021 14:42:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:56448 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382301AbhITSkR (ORCPT ); Mon, 20 Sep 2021 14:40:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8664C63331; Mon, 20 Sep 2021 17:31:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632159064; bh=aU5jjJkB3VmCgVUlzT1/mI1oGjuuEmcURWIZ7K3uIXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YMSXFpJCFUtIsI8/2tMDZdWO8ODqISSpU9YOdEYZeovecwpOSS7CsjDVGoJVX9Fv0 Ed9W2WB/mFLMUNti0PnJmgB/IGu1NKTjU5zwrqOExp0FLKL4xfsKZiRhCbWnnFYOZf vz/u14aQjSXbFDfhZg/M3r7gHKM2XudLPJeVONEs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Elder , "David S. Miller" Subject: [PATCH 5.14 058/168] net: ipa: initialize all filter table slots Date: Mon, 20 Sep 2021 18:43:16 +0200 Message-Id: <20210920163923.548389478@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163921.633181900@linuxfoundation.org> References: <20210920163921.633181900@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Alex Elder commit b5c102238cea985d8126b173d06b9e1de88037ee upstream. There is an off-by-one problem in ipa_table_init_add(), when initializing filter tables. In that function, the number of filter table entries is determined based on the number of set bits in the filter map. However that count does *not* include the extra "slot" in the filter table that holds the filter map itself. Meanwhile, ipa_table_addr() *does* include the filter map in the memory it returns, but because the count it's provided doesn't include it, it includes one too few table entries. Fix this by including the extra slot for the filter map in the count computed in ipa_table_init_add(). Note: ipa_filter_reset_table() does not have this problem; it resets filter table entries one by one, but does not overwrite the filter bitmap. Fixes: 2b9feef2b6c2 ("soc: qcom: ipa: filter and routing tables") Signed-off-by: Alex Elder Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ipa/ipa_table.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/ipa/ipa_table.c +++ b/drivers/net/ipa/ipa_table.c @@ -430,7 +430,8 @@ static void ipa_table_init_add(struct gs * table region determines the number of entries it has. */ if (filter) { - count = hweight32(ipa->filter_map); + /* Include one extra "slot" to hold the filter map itself */ + count = 1 + hweight32(ipa->filter_map); hash_count = hash_mem->size ? count : 0; } else { count = mem->size / sizeof(__le64); From patchwork Mon Sep 20 16:43:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 514372 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2335327jao; Mon, 20 Sep 2021 11:43:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwS+zLQZi5nvFvn0U/xavHuhIC5tYyMF4n1RMwT/xeC/qZ4DwBtYL6SeTHKU1pQElQfoSlp X-Received: by 2002:a92:de41:: with SMTP id e1mr19222057ilr.85.1632163423935; Mon, 20 Sep 2021 11:43:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632163423; cv=none; d=google.com; s=arc-20160816; b=lkab9cZFctXhHC3FkNGjrHssY/ugAKvQufOT2mwgzH/TnBmOsyGT+zNuwJH84tR/mq S9+NYmP75a0KoFTgnrrY37k1dn6w9eU2K5Kj6OekOctrA3AvdWxiFJ1E66shS9/PQ1zy //F6EXTyfCDMkhVpqAkmBwDC6lJ4naUPwfIorHDAQqcNlE1FphOZHS1FruIk5Z5qFcUD Giz3EOK0TyhcViO6D2qwnzIhvHOf2wwtwohePQZnlsfZzmuA1kr7I6+y5qDuYiMAdHg3 CaH9IfuVun2vk4XMouLrzQBj7kKV9ysK8flsNcli3KNHU3alFUMa0XlieGn+0OCpbs// h/UA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oUhlSxvxF0r6cffUkyEMDkcvvSfUib8XOAwcH5mPdfQ=; b=IVJjKUpLwaH91q8xybbBdMiGITCJsvYofzj5BYk0s6kDk5aopVQBQn6Biibc6ifGKk VqzUOmsRUQxkb4+R4ewTwVl6V/xrlJ1Q5Rl26q6msuyXNqe1iwh+yISzmKc8wEJamb8/ I4mJasSBplz40TAKDb3+4fnQdD0g1vaKMf6uMbOIw85w6CnPeV8k0iDur5lO2gb1NiaH x6EKHPZOLYASmle/u0l9P8eLrxpZnLCRD6EyKAhY2uVCs9JoxJqAj7GSE1q3dptoS1zC fOyIzc+3faIm5pN8cbOQKAWcC7H7rf9pjtqhxznM1X88WEFS/hlVVuOdmp+vdsv38zBD JOSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Y2/vMmmX"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j11si1898626ils.94.2021.09.20.11.43.43; Mon, 20 Sep 2021 11:43:43 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Y2/vMmmX"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353787AbhITSpJ (ORCPT + 11 others); Mon, 20 Sep 2021 14:45:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:55616 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382859AbhITSmb (ORCPT ); Mon, 20 Sep 2021 14:42:31 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 25F036334B; Mon, 20 Sep 2021 17:32:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632159135; bh=GnPecZJGuwV53OXbZHobSnBO4x7RYDRMd7dyX5YOZV0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y2/vMmmXCVzISpl5iDMzAh+/59o86+Vuz84C+5HzscVSNq5op8I0ck+WZQah8HCfF AzAWeEDKgLA76VtLhXankP+DCtksLUzYdBy2r0TJA488Kn4ZAA73MFs/erqetSV04f LHi34/ij0kWiH3KWu1nU0Vr0OxVUkD0/+PzuQy/k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathieu Poirier , Anibal Limon , Loic Poulain , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.14 091/168] remoteproc: qcom: wcnss: Fix race with iris probe Date: Mon, 20 Sep 2021 18:43:49 +0200 Message-Id: <20210920163924.625790337@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163921.633181900@linuxfoundation.org> References: <20210920163921.633181900@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Bjorn Andersson [ Upstream commit 1fcef985c8bdd542c43da0d87bd9d51980c3859b ] The remoteproc driver is split between the responsibilities of getting the SoC-internal ARM core up and running and the external RF (aka "Iris") part configured. In order to satisfy the regulator framework's need of a struct device * to look up supplies this was implemented as two different drivers, using of_platform_populate() in the remoteproc part to probe the iris part. Unfortunately it's possible that the iris part probe defers on yet not available regulators and an attempt to start the remoteproc will have to be rejected, until this has been resolved. But there's no useful mechanism of knowing when this would be. Instead replace the of_platform_populate() and the iris probe with a function that rolls its own struct device, with the relevant of_node associated that is enough to acquire regulators and clocks specified in the DT node and that may propagate the EPROBE_DEFER back to the wcnss device's probe. Acked-by: Mathieu Poirier Reported-by: Anibal Limon Reported-by: Loic Poulain Tested-by: Anibal Limon Link: https://lore.kernel.org/r/20210312002251.3273013-1-bjorn.andersson@linaro.org Signed-off-by: Bjorn Andersson Signed-off-by: Sasha Levin --- drivers/remoteproc/qcom_wcnss.c | 49 +++-------- drivers/remoteproc/qcom_wcnss.h | 4 +- drivers/remoteproc/qcom_wcnss_iris.c | 120 +++++++++++++++++---------- 3 files changed, 89 insertions(+), 84 deletions(-) -- 2.30.2 diff --git a/drivers/remoteproc/qcom_wcnss.c b/drivers/remoteproc/qcom_wcnss.c index f1cbc6b2edbb..ebadc6c08e11 100644 --- a/drivers/remoteproc/qcom_wcnss.c +++ b/drivers/remoteproc/qcom_wcnss.c @@ -142,18 +142,6 @@ static const struct wcnss_data pronto_v2_data = { .num_vregs = 1, }; -void qcom_wcnss_assign_iris(struct qcom_wcnss *wcnss, - struct qcom_iris *iris, - bool use_48mhz_xo) -{ - mutex_lock(&wcnss->iris_lock); - - wcnss->iris = iris; - wcnss->use_48mhz_xo = use_48mhz_xo; - - mutex_unlock(&wcnss->iris_lock); -} - static int wcnss_load(struct rproc *rproc, const struct firmware *fw) { struct qcom_wcnss *wcnss = (struct qcom_wcnss *)rproc->priv; @@ -639,12 +627,20 @@ static int wcnss_probe(struct platform_device *pdev) goto detach_pds; } + wcnss->iris = qcom_iris_probe(&pdev->dev, &wcnss->use_48mhz_xo); + if (IS_ERR(wcnss->iris)) { + ret = PTR_ERR(wcnss->iris); + goto detach_pds; + } + ret = rproc_add(rproc); if (ret) - goto detach_pds; + goto remove_iris; - return of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); + return 0; +remove_iris: + qcom_iris_remove(wcnss->iris); detach_pds: wcnss_release_pds(wcnss); free_rproc: @@ -657,7 +653,7 @@ static int wcnss_remove(struct platform_device *pdev) { struct qcom_wcnss *wcnss = platform_get_drvdata(pdev); - of_platform_depopulate(&pdev->dev); + qcom_iris_remove(wcnss->iris); rproc_del(wcnss->rproc); @@ -686,28 +682,7 @@ static struct platform_driver wcnss_driver = { }, }; -static int __init wcnss_init(void) -{ - int ret; - - ret = platform_driver_register(&wcnss_driver); - if (ret) - return ret; - - ret = platform_driver_register(&qcom_iris_driver); - if (ret) - platform_driver_unregister(&wcnss_driver); - - return ret; -} -module_init(wcnss_init); - -static void __exit wcnss_exit(void) -{ - platform_driver_unregister(&qcom_iris_driver); - platform_driver_unregister(&wcnss_driver); -} -module_exit(wcnss_exit); +module_platform_driver(wcnss_driver); MODULE_DESCRIPTION("Qualcomm Peripheral Image Loader for Wireless Subsystem"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/remoteproc/qcom_wcnss.h b/drivers/remoteproc/qcom_wcnss.h index 62c8682d0a92..6d01ee6afa7f 100644 --- a/drivers/remoteproc/qcom_wcnss.h +++ b/drivers/remoteproc/qcom_wcnss.h @@ -17,9 +17,9 @@ struct wcnss_vreg_info { bool super_turbo; }; +struct qcom_iris *qcom_iris_probe(struct device *parent, bool *use_48mhz_xo); +void qcom_iris_remove(struct qcom_iris *iris); int qcom_iris_enable(struct qcom_iris *iris); void qcom_iris_disable(struct qcom_iris *iris); -void qcom_wcnss_assign_iris(struct qcom_wcnss *wcnss, struct qcom_iris *iris, bool use_48mhz_xo); - #endif diff --git a/drivers/remoteproc/qcom_wcnss_iris.c b/drivers/remoteproc/qcom_wcnss_iris.c index 169acd305ae3..09720ddddc85 100644 --- a/drivers/remoteproc/qcom_wcnss_iris.c +++ b/drivers/remoteproc/qcom_wcnss_iris.c @@ -17,7 +17,7 @@ #include "qcom_wcnss.h" struct qcom_iris { - struct device *dev; + struct device dev; struct clk *xo_clk; @@ -75,7 +75,7 @@ int qcom_iris_enable(struct qcom_iris *iris) ret = clk_prepare_enable(iris->xo_clk); if (ret) { - dev_err(iris->dev, "failed to enable xo clk\n"); + dev_err(&iris->dev, "failed to enable xo clk\n"); goto disable_regulators; } @@ -93,43 +93,90 @@ void qcom_iris_disable(struct qcom_iris *iris) regulator_bulk_disable(iris->num_vregs, iris->vregs); } -static int qcom_iris_probe(struct platform_device *pdev) +static const struct of_device_id iris_of_match[] = { + { .compatible = "qcom,wcn3620", .data = &wcn3620_data }, + { .compatible = "qcom,wcn3660", .data = &wcn3660_data }, + { .compatible = "qcom,wcn3660b", .data = &wcn3680_data }, + { .compatible = "qcom,wcn3680", .data = &wcn3680_data }, + {} +}; + +static void qcom_iris_release(struct device *dev) +{ + struct qcom_iris *iris = container_of(dev, struct qcom_iris, dev); + + of_node_put(iris->dev.of_node); + kfree(iris); +} + +struct qcom_iris *qcom_iris_probe(struct device *parent, bool *use_48mhz_xo) { + const struct of_device_id *match; const struct iris_data *data; - struct qcom_wcnss *wcnss; + struct device_node *of_node; struct qcom_iris *iris; int ret; int i; - iris = devm_kzalloc(&pdev->dev, sizeof(struct qcom_iris), GFP_KERNEL); - if (!iris) - return -ENOMEM; + of_node = of_get_child_by_name(parent->of_node, "iris"); + if (!of_node) { + dev_err(parent, "No child node \"iris\" found\n"); + return ERR_PTR(-EINVAL); + } + + iris = kzalloc(sizeof(*iris), GFP_KERNEL); + if (!iris) { + of_node_put(of_node); + return ERR_PTR(-ENOMEM); + } + + device_initialize(&iris->dev); + iris->dev.parent = parent; + iris->dev.release = qcom_iris_release; + iris->dev.of_node = of_node; + + dev_set_name(&iris->dev, "%s.iris", dev_name(parent)); + + ret = device_add(&iris->dev); + if (ret) { + put_device(&iris->dev); + return ERR_PTR(ret); + } + + match = of_match_device(iris_of_match, &iris->dev); + if (!match) { + dev_err(&iris->dev, "no matching compatible for iris\n"); + ret = -EINVAL; + goto err_device_del; + } - data = of_device_get_match_data(&pdev->dev); - wcnss = dev_get_drvdata(pdev->dev.parent); + data = match->data; - iris->xo_clk = devm_clk_get(&pdev->dev, "xo"); + iris->xo_clk = devm_clk_get(&iris->dev, "xo"); if (IS_ERR(iris->xo_clk)) { - if (PTR_ERR(iris->xo_clk) != -EPROBE_DEFER) - dev_err(&pdev->dev, "failed to acquire xo clk\n"); - return PTR_ERR(iris->xo_clk); + ret = PTR_ERR(iris->xo_clk); + if (ret != -EPROBE_DEFER) + dev_err(&iris->dev, "failed to acquire xo clk\n"); + goto err_device_del; } iris->num_vregs = data->num_vregs; - iris->vregs = devm_kcalloc(&pdev->dev, + iris->vregs = devm_kcalloc(&iris->dev, iris->num_vregs, sizeof(struct regulator_bulk_data), GFP_KERNEL); - if (!iris->vregs) - return -ENOMEM; + if (!iris->vregs) { + ret = -ENOMEM; + goto err_device_del; + } for (i = 0; i < iris->num_vregs; i++) iris->vregs[i].supply = data->vregs[i].name; - ret = devm_regulator_bulk_get(&pdev->dev, iris->num_vregs, iris->vregs); + ret = devm_regulator_bulk_get(&iris->dev, iris->num_vregs, iris->vregs); if (ret) { - dev_err(&pdev->dev, "failed to get regulators\n"); - return ret; + dev_err(&iris->dev, "failed to get regulators\n"); + goto err_device_del; } for (i = 0; i < iris->num_vregs; i++) { @@ -143,34 +190,17 @@ static int qcom_iris_probe(struct platform_device *pdev) data->vregs[i].load_uA); } - qcom_wcnss_assign_iris(wcnss, iris, data->use_48mhz_xo); - - return 0; -} + *use_48mhz_xo = data->use_48mhz_xo; -static int qcom_iris_remove(struct platform_device *pdev) -{ - struct qcom_wcnss *wcnss = dev_get_drvdata(pdev->dev.parent); + return iris; - qcom_wcnss_assign_iris(wcnss, NULL, false); +err_device_del: + device_del(&iris->dev); - return 0; + return ERR_PTR(ret); } -static const struct of_device_id iris_of_match[] = { - { .compatible = "qcom,wcn3620", .data = &wcn3620_data }, - { .compatible = "qcom,wcn3660", .data = &wcn3660_data }, - { .compatible = "qcom,wcn3660b", .data = &wcn3680_data }, - { .compatible = "qcom,wcn3680", .data = &wcn3680_data }, - {} -}; -MODULE_DEVICE_TABLE(of, iris_of_match); - -struct platform_driver qcom_iris_driver = { - .probe = qcom_iris_probe, - .remove = qcom_iris_remove, - .driver = { - .name = "qcom-iris", - .of_match_table = iris_of_match, - }, -}; +void qcom_iris_remove(struct qcom_iris *iris) +{ + device_del(&iris->dev); +} From patchwork Mon Sep 20 16:43:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 514374 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2336941jao; Mon, 20 Sep 2021 11:45:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxWFfSTmBG3eUc0Nj6A0ws/aCLzL0pQxE4tmyr9dpDsvKyHP079Ug1jt+kgKZdC/DZkL8B X-Received: by 2002:a05:6402:455:: with SMTP id p21mr30546310edw.309.1632163550144; Mon, 20 Sep 2021 11:45:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632163550; cv=none; d=google.com; s=arc-20160816; b=eaCF0rfC+uzKIQfo5Uxs5KZRRhjDsdEp5SHwxKuTyPdxyTVM0YfSawD+oGenOOfjWU PDuP7ZZbAMUDTanpioTjQUPZhfGnwK86P0tRoji+tornHorNr0+LIiWEetJscDs2sii8 BcqgBb6Owk6IXSVfqgCE7x/f+8JqAshe3tvGYvODsmwoxwgjXuKtilaNCxyjJo3/gKBo bxfIRnzujRuzBlt9SB6iGhlkVTlaLcMFVo6x98wmy8Fsod+Eivsv5HQBWZ2Kw3DBRevV CP9oG2JoR69xW/AqoOmhIMc+eFGfMO70D2bYic0/dHkWP5EnJLijYIc7OXuQfuKVt5Ko uttA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=37/l0SBR8uZHMtRiH8pB0Pq7pNH3maNCBuoUK1lfXMo=; b=LSNgw0+R78CV2yaGPUW9q6BY+kmm1cnNGDnXhbsfwpt8rWX9bt488GUzziIhBDXuHL 6aMe6K5tPp3O6/v3Cq57+/YzT0Cx+g0Ncw1hf/bn4MVQLAg/QrZ+7A5mQWGMDwwViPUt uk33ep8rCfsCHRhGQD/idqSu4WhQmkdTHcFUpz916GsUVMhcC4sfEq0WPulxyt6CTBJ1 PAISB0aIO6jCLd1LMPmZb+z+83ZKH/GdPwMg4scjWy6kHzw8n3IXPTOAUV9uafgBP/4w RbaMn9HCQIUZhtkdoGshs7uE1l1EE7gYDikskcLPDhFMelsvXyxIDlJ1aeCiwqteKa0P DM7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hDCgseZO; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cn17si8069409edb.188.2021.09.20.11.45.49; Mon, 20 Sep 2021 11:45:50 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hDCgseZO; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354551AbhITSrO (ORCPT + 11 others); Mon, 20 Sep 2021 14:47:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:59828 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383114AbhITSoL (ORCPT ); Mon, 20 Sep 2021 14:44:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 526C16334A; Mon, 20 Sep 2021 17:32:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632159137; bh=r9bKAP/Db2Ctbq5jkaSZAU9PRMN3GIB1qKROsvayfJs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hDCgseZOgElcyPqVrvwTKIrUyVV0LMd6m5/RKWuX0FUvSl+aZuP95klNh0yJz6HL7 i8IhHqSKEJMODpqA1CbWPTSM1OS1ZXEaMYyuEnCOS+acreTQud5L79iGtkq+4dQK3M Pxcyefssne3Q/335WO7tmzlPwkfyF8w07BVwx8Dk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, phone-devel@vger.kernel.org, Linus Walleij , Lee Jones , Sasha Levin Subject: [PATCH 5.14 092/168] mfd: db8500-prcmu: Adjust map to reality Date: Mon, 20 Sep 2021 18:43:50 +0200 Message-Id: <20210920163924.657418197@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163921.633181900@linuxfoundation.org> References: <20210920163921.633181900@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Linus Walleij [ Upstream commit ec343111c056ec3847800302f6dbc57281f833fa ] These are the actual frequencies reported by the PLL, so let's report these. The roundoffs are inappropriate, we should round to the frequency that the clock will later report. Drop some whitespace at the same time. Cc: phone-devel@vger.kernel.org Signed-off-by: Linus Walleij Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- drivers/mfd/db8500-prcmu.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) -- 2.30.2 diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c index 3bde7fda755f..dea4e4e8bed5 100644 --- a/drivers/mfd/db8500-prcmu.c +++ b/drivers/mfd/db8500-prcmu.c @@ -1622,22 +1622,20 @@ static long round_clock_rate(u8 clock, unsigned long rate) } static const unsigned long db8500_armss_freqs[] = { - 200000000, - 400000000, - 800000000, + 199680000, + 399360000, + 798720000, 998400000 }; /* The DB8520 has slightly higher ARMSS max frequency */ static const unsigned long db8520_armss_freqs[] = { - 200000000, - 400000000, - 800000000, + 199680000, + 399360000, + 798720000, 1152000000 }; - - static long round_armss_rate(unsigned long rate) { unsigned long freq = 0; From patchwork Mon Sep 20 16:44:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 514380 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2344903jao; Mon, 20 Sep 2021 11:56:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVwt7GKJqOk5bXrWzqrF1LhIb0ITvjrozLzeUkGTykpd0lmy3YOA16qAgKr6vQKKINoshr X-Received: by 2002:a17:906:6c87:: with SMTP id s7mr29934838ejr.186.1632164199270; Mon, 20 Sep 2021 11:56:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632164199; cv=none; d=google.com; s=arc-20160816; b=v210mgyKdQIYCF2yq5e1UuVgFNzG+5TV+e1MAywKVeLwt7l3O0VQcp6MHY5wJX8SF2 1KUTEJZ1heJyMsnnvF6N9LVR9ZGiUL0PtSqx3O/KgADsucePYTYVjVna6VEbKOiK1ciT 28M9yqq7fx1459PKDF1FT5s8WR2KHR7c7haL47s1mVuigsqkqEbG17+ZbOxgqxfXM/mG UFxrHvwdT4wqs4E3NhrwmAa/BI1TauwPun7cOUH8E86D+WI21opRXYA9RqNOr9DJMlnH QIhKngZqwlWvQWAxTaMlIjb2A999dQtzSnoQ7cQLD4KeDoJCHLEi5rq4iSrbqcJ7UAHX n9ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b+CB7V4x79rqHA08lLGi0JzStbEjBvg9W3WpuSj4BN0=; b=TqohK1E2KDLWDTcDKxMa+1USlEtwodQw/+ZGyiLY1oBE1PKpuWi69zIy9nCq0TBn0i GZGRk/8C7LIlG4f/nYk1b9qgZeePBXqmthQDMqz+mSYGz13XtEe7BXe10YSmCXs95+CL +zqXfArXj9qZ20u8T/c5PxmSjti6mEDuW4DFK92sffeKZBlopu/3nNZ3pYq5xW+TkLQu m/gUisOPjPiesWBni5qXfAX9eYgCyiJoc+cOPQNE3P/lgaAAXK4bPgQNTEZUgbMVOVF2 iSv+n0MRLvoZGFeI+k2gERBWixq5jdgAUF8nHtHXxPk2ztVSAe7uyqc9crqrkIXxJXtf LK8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H28BmjKD; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y6si3332003edl.608.2021.09.20.11.56.39; Mon, 20 Sep 2021 11:56:39 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H28BmjKD; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387275AbhITS5A (ORCPT + 11 others); Mon, 20 Sep 2021 14:57:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:59830 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384475AbhITSsQ (ORCPT ); Mon, 20 Sep 2021 14:48:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1DA9061361; Mon, 20 Sep 2021 17:33:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632159224; bh=P2LzhxgiADc6JDLSjbcXwytINfBo65K4kTBrzXO9+A8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H28BmjKDl+ShcowXix4QpvDyOjgY1/i6YvxfjAIoaDpWFx2itjrW9Z4m3yrVKY0Xs rIKQ87r0EWvFYVe2YvWRU7kbodSw2q92lQos5YryaYXzZ5BoUVeGUiMw7eR79SFXki WHnsKvjNvt26Rbg8zwU2Oh3OxuYgwsDczWgY/odk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masami Hiramatsu , "Steven Rostedt (VMware)" , Sasha Levin Subject: [PATCH 5.14 102/168] tracing/probes: Reject events which have the same name of existing one Date: Mon, 20 Sep 2021 18:44:00 +0200 Message-Id: <20210920163924.992956769@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163921.633181900@linuxfoundation.org> References: <20210920163921.633181900@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Masami Hiramatsu [ Upstream commit 8e242060c6a4947e8ae7d29794af6a581db08841 ] Since kprobe_events and uprobe_events only check whether the other same-type probe event has the same name or not, if the user gives the same name of the existing tracepoint event (or the other type of probe events), it silently fails to create the tracefs entry (but registered.) as below. /sys/kernel/tracing # ls events/task/task_rename enable filter format hist id trigger /sys/kernel/tracing # echo p:task/task_rename vfs_read >> kprobe_events [ 113.048508] Could not create tracefs 'task_rename' directory /sys/kernel/tracing # cat kprobe_events p:task/task_rename vfs_read To fix this issue, check whether the existing events have the same name or not in trace_probe_register_event_call(). If exists, it rejects to register the new event. Link: https://lkml.kernel.org/r/162936876189.187130.17558311387542061930.stgit@devnote2 Signed-off-by: Masami Hiramatsu Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Sasha Levin --- kernel/trace/trace_kprobe.c | 6 +++++- kernel/trace/trace_probe.c | 25 +++++++++++++++++++++++++ kernel/trace/trace_probe.h | 1 + kernel/trace/trace_uprobe.c | 6 +++++- 4 files changed, 36 insertions(+), 2 deletions(-) -- 2.30.2 diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c index ea6178cb5e33..032191977e34 100644 --- a/kernel/trace/trace_kprobe.c +++ b/kernel/trace/trace_kprobe.c @@ -647,7 +647,11 @@ static int register_trace_kprobe(struct trace_kprobe *tk) /* Register new event */ ret = register_kprobe_event(tk); if (ret) { - pr_warn("Failed to register probe event(%d)\n", ret); + if (ret == -EEXIST) { + trace_probe_log_set_index(0); + trace_probe_log_err(0, EVENT_EXIST); + } else + pr_warn("Failed to register probe event(%d)\n", ret); goto end; } diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c index 15413ad7cef2..0e29bb14fc8b 100644 --- a/kernel/trace/trace_probe.c +++ b/kernel/trace/trace_probe.c @@ -1029,11 +1029,36 @@ error: return ret; } +static struct trace_event_call * +find_trace_event_call(const char *system, const char *event_name) +{ + struct trace_event_call *tp_event; + const char *name; + + list_for_each_entry(tp_event, &ftrace_events, list) { + if (!tp_event->class->system || + strcmp(system, tp_event->class->system)) + continue; + name = trace_event_name(tp_event); + if (!name || strcmp(event_name, name)) + continue; + return tp_event; + } + + return NULL; +} + int trace_probe_register_event_call(struct trace_probe *tp) { struct trace_event_call *call = trace_probe_event_call(tp); int ret; + lockdep_assert_held(&event_mutex); + + if (find_trace_event_call(trace_probe_group_name(tp), + trace_probe_name(tp))) + return -EEXIST; + ret = register_trace_event(&call->event); if (!ret) return -ENODEV; diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h index 227d518e5ba5..9f14186d132e 100644 --- a/kernel/trace/trace_probe.h +++ b/kernel/trace/trace_probe.h @@ -399,6 +399,7 @@ extern int traceprobe_define_arg_fields(struct trace_event_call *event_call, C(NO_EVENT_NAME, "Event name is not specified"), \ C(EVENT_TOO_LONG, "Event name is too long"), \ C(BAD_EVENT_NAME, "Event name must follow the same rules as C identifiers"), \ + C(EVENT_EXIST, "Given group/event name is already used by another event"), \ C(RETVAL_ON_PROBE, "$retval is not available on probe"), \ C(BAD_STACK_NUM, "Invalid stack number"), \ C(BAD_ARG_NUM, "Invalid argument number"), \ diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index 9b50869a5ddb..957244ee07c8 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c @@ -514,7 +514,11 @@ static int register_trace_uprobe(struct trace_uprobe *tu) ret = register_uprobe_event(tu); if (ret) { - pr_warn("Failed to register probe event(%d)\n", ret); + if (ret == -EEXIST) { + trace_probe_log_set_index(0); + trace_probe_log_err(0, EVENT_EXIST); + } else + pr_warn("Failed to register probe event(%d)\n", ret); goto end; } From patchwork Mon Sep 20 16:44:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 514373 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2336495jao; Mon, 20 Sep 2021 11:45:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwl/Rx2+SQUJIDSff0j5wZ3qOesXAi1eTjsPaeBZd84+nTEMbmHy5Ui1rfjpfOsUaqC+OjB X-Received: by 2002:a17:907:20cb:: with SMTP id qq11mr29239676ejb.488.1632163516257; Mon, 20 Sep 2021 11:45:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632163516; cv=none; d=google.com; s=arc-20160816; b=lxEk5n0Bw9GRxZcx2eTqk0B/qGsk9OIGjY3R/u1UnGorAEBhJw49RyJO40zdSxR9Vt lja3fPhnfjzdsDs9Tk5bf851aJ15/Puzwz4s4iJJ01ltyr6UZOHVfihmAkHxBw8RIxtF wB7FVSyuZD3qXlQ47rxksXOYLt/rvc69Bq1ZrwcCFB6jccdaLwyWWFdNK5Ue4ZqeStgE 3cP9wMkJKRXexqkYgLC9h7F//gf/upfdyIx6rlC5YEGmZ8Ud21bY9bc+y8jDE6TlOKT0 CF+LzergZQ0F2m28aR7+XsDhlamPWFNRzQ0MRAHIPO7TkqVYaQ0ux5KBvUzv8kat/D0s X+JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=34ujAlPILJF3zX+kpkVxTZIwkR1tgKy3A1MnpfUAWt4=; b=f4XI4u0oWUKcKpFCjBaZY2GbrB9B9vjKSwBKjQV45vcIzovcw9XLbMUw55Ix4Gd2fu Wx8S25WrpQGjlbP7xxecV0/2NeM1RpFRenTS2kfx0rzjkiU1Q7oc/hgVkHKa2M+GCeCF ZBpdDbbgCTcKm+mNCOftvhQnoIenPSgCwYun4ir4p6cee9uaQBgd41cZ2LMQBD//2vaL hcioCpjVZD8zsNy6asOAtmkZuYuL6cErS9KT6sD0hNAszAK0KNGN6gt7zCV9Ro39tqF3 soCubQo09aGGPv2R5JSvO4zMFpcR/P/0z+vuoHQxptbmUSlwCoVoOunZIID9DQy11KeW szjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kmSifqKx; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b13si11716020ede.572.2021.09.20.11.45.16; Mon, 20 Sep 2021 11:45:16 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kmSifqKx; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384125AbhITSqi (ORCPT + 11 others); Mon, 20 Sep 2021 14:46:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:59876 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383439AbhITSoc (ORCPT ); Mon, 20 Sep 2021 14:44:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B09E36335B; Mon, 20 Sep 2021 17:32:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632159179; bh=/ylWhQgWilVG54d1ELp7na5y0xNTpbUxviz6hlHmaiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kmSifqKx4IVZo4AOFDFeVkXOPE23RhJdgJo3Ce5ad9MFSCNjtny2RmxYcxZLRIi/h YuD+6W4NNy2zoLInjfzdoMv7+iXKGh1WtTfl4bOrERtHKxpkRxG4NAHIKCqPruii/R dJ0Gpo9DD9zvtHhxj7h52Fz+b0hazfFrNKRbqp+k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Davide Zini , Paolo Valente , Jens Axboe , Sasha Levin Subject: [PATCH 5.14 113/168] block, bfq: honor already-setup queue merges Date: Mon, 20 Sep 2021 18:44:11 +0200 Message-Id: <20210920163925.352279771@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163921.633181900@linuxfoundation.org> References: <20210920163921.633181900@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Paolo Valente [ Upstream commit 2d52c58b9c9bdae0ca3df6a1eab5745ab3f7d80b ] The function bfq_setup_merge prepares the merging between two bfq_queues, say bfqq and new_bfqq. To this goal, it assigns bfqq->new_bfqq = new_bfqq. Then, each time some I/O for bfqq arrives, the process that generated that I/O is disassociated from bfqq and associated with new_bfqq (merging is actually a redirection). In this respect, bfq_setup_merge increases new_bfqq->ref in advance, adding the number of processes that are expected to be associated with new_bfqq. Unfortunately, the stable-merging mechanism interferes with this setup. After bfqq->new_bfqq has been set by bfq_setup_merge, and before all the expected processes have been associated with bfqq->new_bfqq, bfqq may happen to be stably merged with a different queue than the current bfqq->new_bfqq. In this case, bfqq->new_bfqq gets changed. So, some of the processes that have been already accounted for in the ref counter of the previous new_bfqq will not be associated with that queue. This creates an unbalance, because those references will never be decremented. This commit fixes this issue by reestablishing the previous, natural behaviour: once bfqq->new_bfqq has been set, it will not be changed until all expected redirections have occurred. Signed-off-by: Davide Zini Signed-off-by: Paolo Valente Link: https://lore.kernel.org/r/20210802141352.74353-2-paolo.valente@linaro.org Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- block/bfq-iosched.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) -- 2.30.2 diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 9360c65169ff..3a1038b6eeb3 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -2662,6 +2662,15 @@ bfq_setup_merge(struct bfq_queue *bfqq, struct bfq_queue *new_bfqq) * are likely to increase the throughput. */ bfqq->new_bfqq = new_bfqq; + /* + * The above assignment schedules the following redirections: + * each time some I/O for bfqq arrives, the process that + * generated that I/O is disassociated from bfqq and + * associated with new_bfqq. Here we increases new_bfqq->ref + * in advance, adding the number of processes that are + * expected to be associated with new_bfqq as they happen to + * issue I/O. + */ new_bfqq->ref += process_refs; return new_bfqq; } @@ -2724,6 +2733,10 @@ bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq, { struct bfq_queue *in_service_bfqq, *new_bfqq; + /* if a merge has already been setup, then proceed with that first */ + if (bfqq->new_bfqq) + return bfqq->new_bfqq; + /* * Check delayed stable merge for rotational or non-queueing * devs. For this branch to be executed, bfqq must not be @@ -2825,9 +2838,6 @@ bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq, if (bfq_too_late_for_merging(bfqq)) return NULL; - if (bfqq->new_bfqq) - return bfqq->new_bfqq; - if (!io_struct || unlikely(bfqq == &bfqd->oom_bfqq)) return NULL; From patchwork Mon Sep 20 16:44:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 514377 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2338311jao; Mon, 20 Sep 2021 11:47:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJg7LPl/nhqV2TmuoYL3AMC//WpYbPnsTWI03AjJJdEX9Xtit69o6LGsWQqBY8TYlIhnI+ X-Received: by 2002:a05:6402:2917:: with SMTP id ee23mr30516209edb.207.1632163647335; Mon, 20 Sep 2021 11:47:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632163647; cv=none; d=google.com; s=arc-20160816; b=e3miKaJfBdKIxX4mxrLmHuABSml0e4g1c+0NxSpbugM17eJVIDZbu5qqiUNurxJHIE gQEEmhiUBuJXZ1rxx3HURSG6iWc+WbGcMILq8cHC/Fu9/A1b3ix3/bvLw/Z+dbaPaoEI j34fzL2RGCWrIUp3lQ/N0Ze4weUQN4BhVjfwPYMTa59yTysLjGbWTSs/LXF298uSTO7J vAjNOkDnAf3RdC9dSiuqs/y1m+u/B8VHk+Wnzd9He9PDMwHqmNxgEnSMKCYY8xt9evTA PRmATYIDw6dy5awEsRZay4FZS8P541gDqLuXMQzWTyHy7wdVwuOADZBcxm0CX3n2Klda y2sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8a/qteVCVMJ87b9DF0LmjQYROwxCMWOlJfUE+xRdp4w=; b=dWa5pToUxygAWn60N3kyQvGvjidgXKkXxsbKHVcftHJs/JMIkwNsOcrSwnim9idYLH 5gzBPNgus48jsZkacJzy+wkAVwiqFuYTGIVKDwIHi3bDQtwuHLmjnaYp7IFf9iGKiUHw Zuv6i11u3OjG0I/CVDg22ixHR/uPQaF5pV97ErYZVFss2fDvhsLIPYj+ZQx6EpV0vZSu utxSZ3bSLwneBxLn7ooV6cr+GrAFdcu9yaS1qOvpWfzyE98CUblgg3vfj/iNB7th+uA5 V6OhyCKT7801sdQgeT0IVSk3cV6QueYYLh/K/5I7QEAAMHhCc/KI2uUqx5RJ2v5rV0Xr zDiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RI6YPIOy; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f29si18802075ejj.403.2021.09.20.11.47.26; Mon, 20 Sep 2021 11:47:27 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RI6YPIOy; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354450AbhITSsw (ORCPT + 11 others); Mon, 20 Sep 2021 14:48:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:33244 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383999AbhITSqU (ORCPT ); Mon, 20 Sep 2021 14:46:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7078963360; Mon, 20 Sep 2021 17:33:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632159200; bh=6AOpt5nzNFC31BkTqC9tNzGbwV675RFYmdUiW4tChoQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RI6YPIOyDy4KEtv8CV1LlGnF+0K0D6MCovP30/bVvvoiGQk3fq13mWCFbLuhjUehH 1y6EWxPWJlI6Lx77ZyirUV50BJW8ErmGJeEJm81XDH+1Ok7aTtiRHYnNd9FNwD9oLs 6VPoqrQxMigWA2LwnTW4qvfq/Vv+uumA4/yYn0rY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephan Gerhold , newbyte@disroot.org, Daniel Thompson , Linus Walleij , Lee Jones , Sasha Levin Subject: [PATCH 5.14 122/168] backlight: ktd253: Stabilize backlight Date: Mon, 20 Sep 2021 18:44:20 +0200 Message-Id: <20210920163925.671764275@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163921.633181900@linuxfoundation.org> References: <20210920163921.633181900@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Linus Walleij [ Upstream commit daa37361518bf2d1f591bbdaa7c68b2a43d7af48 ] Remove interrupt disablement during backlight setting. It is way to dangerous and makes platforms instable by having it miss vblank IRQs leading to the graphics derailing. The code is using ndelay() which is not available on platforms such as ARM and will result in 32 * udelay(1) which is substantial. Add some code to detect if an interrupt occurs during the tight loop and in that case just redo it from the top. Fixes: 5317f37e48b9 ("backlight: Add Kinetic KTD253 backlight driver") Cc: Stephan Gerhold Reported-by: newbyte@disroot.org Reviewed-by: Daniel Thompson Signed-off-by: Linus Walleij Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- drivers/video/backlight/ktd253-backlight.c | 75 ++++++++++++++++------ 1 file changed, 55 insertions(+), 20 deletions(-) -- 2.30.2 diff --git a/drivers/video/backlight/ktd253-backlight.c b/drivers/video/backlight/ktd253-backlight.c index a7df5bcca9da..37aa5a669530 100644 --- a/drivers/video/backlight/ktd253-backlight.c +++ b/drivers/video/backlight/ktd253-backlight.c @@ -25,6 +25,7 @@ #define KTD253_T_LOW_NS (200 + 10) /* Additional 10ns as safety factor */ #define KTD253_T_HIGH_NS (200 + 10) /* Additional 10ns as safety factor */ +#define KTD253_T_OFF_CRIT_NS 100000 /* 100 us, now it doesn't look good */ #define KTD253_T_OFF_MS 3 struct ktd253_backlight { @@ -34,13 +35,50 @@ struct ktd253_backlight { u16 ratio; }; +static void ktd253_backlight_set_max_ratio(struct ktd253_backlight *ktd253) +{ + gpiod_set_value_cansleep(ktd253->gpiod, 1); + ndelay(KTD253_T_HIGH_NS); + /* We always fall back to this when we power on */ +} + +static int ktd253_backlight_stepdown(struct ktd253_backlight *ktd253) +{ + /* + * These GPIO operations absolutely can NOT sleep so no _cansleep + * suffixes, and no using GPIO expanders on slow buses for this! + * + * The maximum number of cycles of the loop is 32 so the time taken + * should nominally be: + * (T_LOW_NS + T_HIGH_NS + loop_time) * 32 + * + * Architectures do not always support ndelay() and we will get a few us + * instead. If we get to a critical time limit an interrupt has likely + * occured in the low part of the loop and we need to restart from the + * top so we have the backlight in a known state. + */ + u64 ns; + + ns = ktime_get_ns(); + gpiod_set_value(ktd253->gpiod, 0); + ndelay(KTD253_T_LOW_NS); + gpiod_set_value(ktd253->gpiod, 1); + ns = ktime_get_ns() - ns; + if (ns >= KTD253_T_OFF_CRIT_NS) { + dev_err(ktd253->dev, "PCM on backlight took too long (%llu ns)\n", ns); + return -EAGAIN; + } + ndelay(KTD253_T_HIGH_NS); + return 0; +} + static int ktd253_backlight_update_status(struct backlight_device *bl) { struct ktd253_backlight *ktd253 = bl_get_data(bl); int brightness = backlight_get_brightness(bl); u16 target_ratio; u16 current_ratio = ktd253->ratio; - unsigned long flags; + int ret; dev_dbg(ktd253->dev, "new brightness/ratio: %d/32\n", brightness); @@ -62,37 +100,34 @@ static int ktd253_backlight_update_status(struct backlight_device *bl) } if (current_ratio == 0) { - gpiod_set_value_cansleep(ktd253->gpiod, 1); - ndelay(KTD253_T_HIGH_NS); - /* We always fall back to this when we power on */ + ktd253_backlight_set_max_ratio(ktd253); current_ratio = KTD253_MAX_RATIO; } - /* - * WARNING: - * The loop to set the correct current level is performed - * with interrupts disabled as it is timing critical. - * The maximum number of cycles of the loop is 32 - * so the time taken will be (T_LOW_NS + T_HIGH_NS + loop_time) * 32, - */ - local_irq_save(flags); while (current_ratio != target_ratio) { /* * These GPIO operations absolutely can NOT sleep so no * _cansleep suffixes, and no using GPIO expanders on * slow buses for this! */ - gpiod_set_value(ktd253->gpiod, 0); - ndelay(KTD253_T_LOW_NS); - gpiod_set_value(ktd253->gpiod, 1); - ndelay(KTD253_T_HIGH_NS); - /* After 1/32 we loop back to 32/32 */ - if (current_ratio == KTD253_MIN_RATIO) + ret = ktd253_backlight_stepdown(ktd253); + if (ret == -EAGAIN) { + /* + * Something disturbed the backlight setting code when + * running so we need to bring the PWM back to a known + * state. This shouldn't happen too much. + */ + gpiod_set_value_cansleep(ktd253->gpiod, 0); + msleep(KTD253_T_OFF_MS); + ktd253_backlight_set_max_ratio(ktd253); + current_ratio = KTD253_MAX_RATIO; + } else if (current_ratio == KTD253_MIN_RATIO) { + /* After 1/32 we loop back to 32/32 */ current_ratio = KTD253_MAX_RATIO; - else + } else { current_ratio--; + } } - local_irq_restore(flags); ktd253->ratio = current_ratio; dev_dbg(ktd253->dev, "new ratio set to %d/32\n", target_ratio); From patchwork Mon Sep 20 16:44:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 514375 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2338011jao; Mon, 20 Sep 2021 11:47:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/MiUOgtmNe9dcLidvBHZgYA0+YTRx6BdqFMU3wDP40tkhMRNLHVZehSuud5wtU1IApYt9 X-Received: by 2002:a05:6402:143b:: with SMTP id c27mr15057195edx.224.1632163626946; Mon, 20 Sep 2021 11:47:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632163626; cv=none; d=google.com; s=arc-20160816; b=RrJOUYEuAbYK8iUISbzgiN+jiiHkSIatSW0YTu9UGGseFFhMwI9j52fia+e9MNtB1K CVQS6a9pTT/j7Q2ObMnGv1hun0rJcAzn9OZ70X7ihWH7O1Bpn3BT2blb6gppoy0IKwvB QDdjM/8bft6IWSL/Ilu0deVm6Qt2lq+uBjIMi9QQoyPrhYF2lbXjaEwIYeBFGziOdfJe cLIqfJzTAm6RuTqhzsTVqouGAGg8yPyEjatuK1OzWH5WMN9VPZKDQWOokFpft25X5CT5 0wJYLhOiuNJ/XUbEJgaKTPSiw/4hwaQA1e0tLFKO6AgPxA3JDTX13y6itFYF8kI30lHm EgVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HKL3F1oDwhJmHD95lXpuFSYWItAq26hF2I7NfcMbDkI=; b=uNspLHaHl/OZcOLN3WXj2AL0C739HrGzOVBlF/H6sKsmjOo2L40cMQbbpASXd6260t JEyKn/tggUKK9we08mvRgD1KuzE222ihYhQY2avoFZ8Zq0EGHod34Zclt9P28/82Vsvm Z3OBht6vEdNSJ0qMFdxJHQ5Pkok/g/EDKhs3Zf9+0DCLtPQ202SUSvm93UCGIK6XbeB5 TUOduGJQ657S/brFdnNpigLNbcn2UYlTC4fvvfiJ6nUShT2pTc94k5Z0WYziuCpuKkot lbqOuvwZUgcFhgpfdhIXXUZE1DpFaJUwCoc/TGMyFXrDD+1V0QC3yLPHVi6/Du+xu3qY HEqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=utNnSxlL; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y20si14446786edc.166.2021.09.20.11.47.06; Mon, 20 Sep 2021 11:47:06 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=utNnSxlL; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384637AbhITSsc (ORCPT + 11 others); Mon, 20 Sep 2021 14:48:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:33380 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384049AbhITSq3 (ORCPT ); Mon, 20 Sep 2021 14:46:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A63EB61B00; Mon, 20 Sep 2021 17:33:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632159205; bh=J++Xue/OUKFhVvOxY3tDh0wvNGzwBHc61OJQ/vIxcDI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=utNnSxlLUDbghXRzPou4ztxtm+xSqsWAY8eKYbbQHXNixkopNHdDxL5mpSXwXpxHn hLCKAF4vLW8iCFm1R2ckzuvl3S6+kRml4sERBYmDKWAgPoyJ3VHN4VUmxGRRLnp02L cSq66nF03uw+72mqNYoj1viXngxGb0r6ZGziAWNo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , Rob Herring , Lorenzo Pieralisi , Bjorn Helgaas , Srinath Mannam , Roman Bacik , Bharat Gooty , Abhishek Shah , Jitendra Bhivare , Ray Jui , Florian Fainelli , BCM Kernel Feedback , Scott Branden , Sasha Levin Subject: [PATCH 5.14 124/168] PCI: of: Dont fail devm_pci_alloc_host_bridge() on missing ranges Date: Mon, 20 Sep 2021 18:44:22 +0200 Message-Id: <20210920163925.737206408@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163921.633181900@linuxfoundation.org> References: <20210920163921.633181900@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Rob Herring [ Upstream commit d277f6e88c88729b1d57d40bbfb00d0bfc961972 ] Commit 669cbc708122 ("PCI: Move DT resource setup into devm_pci_alloc_host_bridge()") made devm_pci_alloc_host_bridge() fail on any DT resource parsing errors, but Broadcom iProc uses devm_pci_alloc_host_bridge() on BCMA bus devices that don't have DT resources. In particular, there is no 'ranges' property. Fix iProc by making 'ranges' optional. If 'ranges' is required by a platform, there's going to be more errors latter on if it is missing. Link: https://lore.kernel.org/r/20210803215656.3803204-1-robh@kernel.org Fixes: 669cbc708122 ("PCI: Move DT resource setup into devm_pci_alloc_host_bridge()") Reported-by: Rafał Miłecki Tested-by: Rafał Miłecki Signed-off-by: Rob Herring Signed-off-by: Lorenzo Pieralisi Acked-by: Bjorn Helgaas Cc: Srinath Mannam Cc: Roman Bacik Cc: Bharat Gooty Cc: Abhishek Shah Cc: Jitendra Bhivare Cc: Ray Jui Cc: Florian Fainelli Cc: BCM Kernel Feedback Cc: Scott Branden Cc: Bjorn Helgaas Cc: Lorenzo Pieralisi Signed-off-by: Sasha Levin --- drivers/pci/of.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.30.2 diff --git a/drivers/pci/of.c b/drivers/pci/of.c index a143b02b2dcd..d84381ce82b5 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -310,7 +310,7 @@ static int devm_of_pci_get_host_bridge_resources(struct device *dev, /* Check for ranges property */ err = of_pci_range_parser_init(&parser, dev_node); if (err) - goto failed; + return 0; dev_dbg(dev, "Parsing ranges property...\n"); for_each_of_pci_range(&parser, &range) { From patchwork Mon Sep 20 16:44:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 514376 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2338070jao; Mon, 20 Sep 2021 11:47:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVHM5nOxq4JWbw1LsREHa1UxG4eOq0Ywvq1vV8MsJ2FL63wI2SbpHXPXNSdPscFPz3rX5A X-Received: by 2002:a05:6402:358f:: with SMTP id y15mr29838504edc.67.1632163630296; Mon, 20 Sep 2021 11:47:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632163630; cv=none; d=google.com; s=arc-20160816; b=Ng5ytljrAzuSfxqWK7uQqvFiwfK8CnTr7tPC3Ju8ZtfxShzmkSsR4SvBRTcFO9nOiw afgSL0Kgii86pxIYRjBUhaknmWWYmmjTGg+GZBFuTZY2UqNcD27is4pOr8Q6SxHsU/p2 PVMnLNRyPduiRv6q44lJniFBbghvl46XrPUgBidkArRrRQ/t2y9caO9ioSV5CZIQjFNt 3rZ5aOXzIe+YrLl1N4863EJgsLPq4Kcm90S4oPcio68O3Q/wpIO4HUTEZXAz86yEZ+aH Cz7X9gF5HmU1K4hBp+CxcYiqyIQWeh54V6K8Hftc0OiQ9s5YsgW8pM/HxDmWLg3Qv4by NbBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KchsrLwXX54Dvfldy/gP/UtblKXwOYw58PaYddA0PXs=; b=kboh4uYQfHgL0BvGX3VIlSDBZOCJLVqUPqprwaVfmiYFJTE4fYAe0AqoztP+HtZRJv YHgTk+Or/y9N11JbznT87+WnMb5iZilbXChsW0vcqadYDIV0oE4mJ04FNbmQh1hSDggp iyjtsLUrW0GfPeqw6b/f3e4ilOXY3d4KmIVQ9MpUwTWap0ESB3+7/0UAGaBGbP28exoF ZF7lX7hMg9l22IttfllUnNPBnr3WIvOFH920gcCV1un68XUiC04xUqQIjwZPFXKpRpVK ZFE1NVJ0PISnWDNrGKewnc1pua2fmIRqAIM7Sc8kp9WQISEb6DSbbe3WKYBqYW4wFrlT 02lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uyxL9mY4; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y20si14446786edc.166.2021.09.20.11.47.10; Mon, 20 Sep 2021 11:47:10 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uyxL9mY4; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354383AbhITSsf (ORCPT + 11 others); Mon, 20 Sep 2021 14:48:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:33542 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384095AbhITSqc (ORCPT ); Mon, 20 Sep 2021 14:46:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D350061B04; Mon, 20 Sep 2021 17:33:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632159209; bh=12eTKTrgXoNsliTpBIj9AqdcGCF3gdeRnknu9J4fK+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uyxL9mY4mYLrNFN2/xfkjxSThPYWEgMXLtxCpHhNTEpjNjbDMgD791NXt3FxflRBi VIwkMeE+TTEOwBp88qDDOXA/4RIFOngMr7l0ZInZXm090MVeH7PVZiOi+sk7y4Uly1 o4x5wEdZUxpOXrqFpfPxxCIR1YFFOCeb9uPslgOk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , Rob Herring , Lorenzo Pieralisi , Srinath Mannam , Roman Bacik , Bharat Gooty , Abhishek Shah , Jitendra Bhivare , Ray Jui , Florian Fainelli , BCM Kernel Feedback , Scott Branden , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Bjorn Helgaas , Sasha Levin Subject: [PATCH 5.14 125/168] PCI: iproc: Fix BCMA probe resource handling Date: Mon, 20 Sep 2021 18:44:23 +0200 Message-Id: <20210920163925.767828626@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163921.633181900@linuxfoundation.org> References: <20210920163921.633181900@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Rob Herring [ Upstream commit aeaea8969b402e0081210cc9144404d13996efed ] In commit 7ef1c871da16 ("PCI: iproc: Use pci_parse_request_of_pci_ranges()"), calling devm_request_pci_bus_resources() was dropped from the common iProc probe code, but is still needed for BCMA bus probing. Without it, there will be lots of warnings like this: pci 0000:00:00.0: BAR 8: no space for [mem size 0x00c00000] pci 0000:00:00.0: BAR 8: failed to assign [mem size 0x00c00000] Add back calling devm_request_pci_bus_resources() and adding the resources to pci_host_bridge.windows for BCMA bus probe. Link: https://lore.kernel.org/r/20210803215656.3803204-2-robh@kernel.org Fixes: 7ef1c871da16 ("PCI: iproc: Use pci_parse_request_of_pci_ranges()") Reported-by: Rafał Miłecki Tested-by: Rafał Miłecki Signed-off-by: Rob Herring Signed-off-by: Lorenzo Pieralisi Cc: Srinath Mannam Cc: Roman Bacik Cc: Bharat Gooty Cc: Abhishek Shah Cc: Jitendra Bhivare Cc: Ray Jui Cc: Florian Fainelli Cc: BCM Kernel Feedback Cc: Scott Branden Cc: Lorenzo Pieralisi Cc: "Krzysztof Wilczyński" Cc: Bjorn Helgaas Signed-off-by: Sasha Levin --- drivers/pci/controller/pcie-iproc-bcma.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) -- 2.30.2 diff --git a/drivers/pci/controller/pcie-iproc-bcma.c b/drivers/pci/controller/pcie-iproc-bcma.c index 56b8ee7bf330..f918c713afb0 100644 --- a/drivers/pci/controller/pcie-iproc-bcma.c +++ b/drivers/pci/controller/pcie-iproc-bcma.c @@ -35,7 +35,6 @@ static int iproc_pcie_bcma_probe(struct bcma_device *bdev) { struct device *dev = &bdev->dev; struct iproc_pcie *pcie; - LIST_HEAD(resources); struct pci_host_bridge *bridge; int ret; @@ -60,19 +59,16 @@ static int iproc_pcie_bcma_probe(struct bcma_device *bdev) pcie->mem.end = bdev->addr_s[0] + SZ_128M - 1; pcie->mem.name = "PCIe MEM space"; pcie->mem.flags = IORESOURCE_MEM; - pci_add_resource(&resources, &pcie->mem); + pci_add_resource(&bridge->windows, &pcie->mem); + ret = devm_request_pci_bus_resources(dev, &bridge->windows); + if (ret) + return ret; pcie->map_irq = iproc_pcie_bcma_map_irq; - ret = iproc_pcie_setup(pcie, &resources); - if (ret) { - dev_err(dev, "PCIe controller setup failed\n"); - pci_free_resource_list(&resources); - return ret; - } - bcma_set_drvdata(bdev, pcie); - return 0; + + return iproc_pcie_setup(pcie, &bridge->windows); } static void iproc_pcie_bcma_remove(struct bcma_device *bdev) From patchwork Mon Sep 20 16:44:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 514379 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2344372jao; Mon, 20 Sep 2021 11:55:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxpHT0DCoR7N1kA1uUybLI5fTjgX/Wnkb1KsmF9uIyJSNAWkMgknMKC2TKERgnEuiIGDUI X-Received: by 2002:aa7:c744:: with SMTP id c4mr30864058eds.0.1632164151127; Mon, 20 Sep 2021 11:55:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632164151; cv=none; d=google.com; s=arc-20160816; b=ZjwYiww9bm0ypxMGDz+cXc2hJEgulI3ho4iN1SDjwmU4qFU+TJdYw1l4pTQSTY0Rpq FerM6E2ssBlMWKgV/JAjWP/IXHp9BwSEClT4XFpezuCLcEDRBLA5VKK+5aB3xUSsJ7lo TH+uHu776G25KXCGKtNrgxcv+KS0Ox/tVhaoWRkoESWfvNueaKxfPQ5fvdeScde7E9Tv jETEoln62J/W+FG3dECNODLiuemK3HZnpuyodR3qP2RurB5tFT+Y+kzjZB4zn9f4O4rd stdv57wKy1/J3kP9NNliuIKbjphs1C4Mf96uI++mXfmqeUUXiqMFb0yx/WQ9+5088Pzd PzfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=kBArGHZud2zWs8hcJCNce6rXm/UOvcLSYTO+74IiKxc=; b=wv0KWLhm1E+sTjJB5f1K3HPBF+XAtZ6cAFe1cbm5KmG+5a/FkNXsc2kyfGDhLDGAOE A6/t7HrZSLzxJkp4fKrzLFMRVjUozOFRh/f+Tho7Qb2DaNTHlzgJ55498rDbUnCjPvhn zaMkF2TQuuiC3BNxBO0Yq/sIPnbvBmC94zc/uFRMuOf/o0+RaqcCM6V0t4gV2bQZL0yP 5RTwyCmxL4l6aDcJ58qJgU4RufOmk642z7yEykWQCAeulofCgNHQzw1CVxrp20aKcYNc y6Flj7PwLBrEsCLbwY/9X3tALdR9Ap33pEk933f0lM+XuqkWKk97g225yJO0XFGZbDiM 3UdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="E75AM/uo"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 6si17997049ejm.251.2021.09.20.11.55.50; Mon, 20 Sep 2021 11:55:51 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="E75AM/uo"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387267AbhITS45 (ORCPT + 11 others); Mon, 20 Sep 2021 14:56:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:33192 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384540AbhITSsT (ORCPT ); Mon, 20 Sep 2021 14:48:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C8C476336D; Mon, 20 Sep 2021 17:33:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632159233; bh=9CdTvvhUJ6fs+lcYEoDJc3pDm6ZWgqub8UHDzlaahfA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E75AM/uoddO5tBXo7RaHy2s/4NdxokNJPrVetH1wOMPZcQ71E8jWTlIE9Udy26vcF axotCiePTzAKkWZrFHoxKSwA7gwQNL1VY1NKII/mFAUl77/vegDXGgvnMtHvgNNSfy 40EjM8UhpL4lo5f37LS97qTwTJD3hOuxV/zkDdCM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masami Hiramatsu , "Steven Rostedt (VMware)" , Sasha Levin Subject: [PATCH 5.14 130/168] tracing/boot: Fix a hist trigger dependency for boot time tracing Date: Mon, 20 Sep 2021 18:44:28 +0200 Message-Id: <20210920163925.940856792@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163921.633181900@linuxfoundation.org> References: <20210920163921.633181900@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Masami Hiramatsu [ Upstream commit 6fe7c745f2acb73e4cc961d7f91125eef5a8861f ] Fixes a build error when CONFIG_HIST_TRIGGERS=n with boot-time tracing. Since the trigger_process_regex() is defined only when CONFIG_HIST_TRIGGERS=y, if it is disabled, the 'actions' event option also must be disabled. Link: https://lkml.kernel.org/r/162856123376.203126.582144262622247352.stgit@devnote2 Fixes: 81a59555ff15 ("tracing/boot: Add per-event settings") Signed-off-by: Masami Hiramatsu Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Sasha Levin --- kernel/trace/trace_boot.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) -- 2.30.2 diff --git a/kernel/trace/trace_boot.c b/kernel/trace/trace_boot.c index 94ef2d099e32..d713714cba67 100644 --- a/kernel/trace/trace_boot.c +++ b/kernel/trace/trace_boot.c @@ -205,12 +205,15 @@ trace_boot_init_one_event(struct trace_array *tr, struct xbc_node *gnode, pr_err("Failed to apply filter: %s\n", buf); } - xbc_node_for_each_array_value(enode, "actions", anode, p) { - if (strlcpy(buf, p, ARRAY_SIZE(buf)) >= ARRAY_SIZE(buf)) - pr_err("action string is too long: %s\n", p); - else if (trigger_process_regex(file, buf) < 0) - pr_err("Failed to apply an action: %s\n", buf); - } + if (IS_ENABLED(CONFIG_HIST_TRIGGERS)) { + xbc_node_for_each_array_value(enode, "actions", anode, p) { + if (strlcpy(buf, p, ARRAY_SIZE(buf)) >= ARRAY_SIZE(buf)) + pr_err("action string is too long: %s\n", p); + else if (trigger_process_regex(file, buf) < 0) + pr_err("Failed to apply an action: %s\n", buf); + } + } else if (xbc_node_find_value(enode, "actions", NULL)) + pr_err("Failed to apply event actions because CONFIG_HIST_TRIGGERS is not set.\n"); if (xbc_node_find_value(enode, "enable", NULL)) { if (trace_event_enable_disable(file, 1, 0) < 0) From patchwork Mon Sep 20 16:44:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 514378 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2344020jao; Mon, 20 Sep 2021 11:55:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9jGz1vZSnzPMCRFRLp7/yOqqCkA7ztW+7dcdpp/sKnDE+12eSh/OLp07oRh5xstOCaVY9 X-Received: by 2002:a17:906:1806:: with SMTP id v6mr30666342eje.420.1632164123992; Mon, 20 Sep 2021 11:55:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632164123; cv=none; d=google.com; s=arc-20160816; b=fxLKgsQGGoDHGqlaJBKQIO2OEbfXYsedNn/hHqrU1yiQWWD2kE8ZvrUR7ezkv5jrZ0 Yxe7XhuotNasVh8XfsWOX/31csHycMzONrb9k99XByXunM2QfY4P5ASrCjAxfXWFXSd1 3HLEpwPguq1I8dwhmD1Qh+Vrk+CEcGhrWcN4yZW+O3pQiGuzBpZ5pOPT0fwiAaJlXmeG ovFxysJK/okDXziRquZS9QS8DUljuHRtQDXCyd7zjZBc3IIy+kYE4ARbxYCo4ziJniUt tQE1jNMvZozmlGyYEr3o+7vCJ3sUwLPUQX2rYLrbEAZJ93jRnqEyHUBpZRHuCbnnJKHO F/Lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WomSFrkev5k7qBxar9lrs0GMJFgQoGcp4SwObsbq9yA=; b=jXhLFxBzTBIQYvlFkLP4kP/wtLXdjiU4qC3M3ZdiImMZs3CBJUx6OJ/csoEn8ZXFaN 1Cchk+m52IqXOUsXmG27F0vIeLsPmUIJvi9c96XyM7zu5AIrf0XXtUFjzmYLCOgL2yF7 qexzRtLGRrDlUHvMrrjZjc/RqhsH9fWHp6tfANkIniNYxc92cH8Pzol9PylsrQPf+3Cv ld0H2HOv0Sm2eQ0Tnur+r0FAFBo+xWgIWJv9eOW51KLWNrkrFvqtyiFrjPTDmc44i32P yFacrSMO2Oc/prDbbJ3Op3E+npLrjDnRMdjX4bED7ueMYfWYFbuuTG+zYvZIvZgxrdIx C7Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sJIqLvf3; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 6si17997049ejm.251.2021.09.20.11.55.23; Mon, 20 Sep 2021 11:55:23 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sJIqLvf3; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1387232AbhITS4l (ORCPT + 11 others); Mon, 20 Sep 2021 14:56:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:33540 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383438AbhITSsd (ORCPT ); Mon, 20 Sep 2021 14:48:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 685E96337A; Mon, 20 Sep 2021 17:34:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632159252; bh=wxfST2Fog1zgK7JmnzSoNEyc7dj48I3zfUBseGYCqaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sJIqLvf3F4+dbwzivJ/Iwp8uqQwqdIvF93YcmI3i//2FsJjwsmpZ3uFdsxgsqLW1P GX7Nxr/Hl5NDjbT+WU6S5MjP+EkvrIh2QdA5AlOAYMcMEu8U5/GTZJQoPy+Ku3HWLV T7mqpkkWZIKRZmgMMF8mI4HuDUGzeUmife1wgmCs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, DENG Qingfang , Mauri Sandberg , Linus Walleij , Florian Fainelli , "David S. Miller" , Sasha Levin Subject: [PATCH 5.14 147/168] net: dsa: tag_rtl4_a: Fix egress tags Date: Mon, 20 Sep 2021 18:44:45 +0200 Message-Id: <20210920163926.489089758@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163921.633181900@linuxfoundation.org> References: <20210920163921.633181900@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Linus Walleij [ Upstream commit 0e90dfa7a8d817db755c7b5d89d77b9c485e4180 ] I noticed that only port 0 worked on the RTL8366RB since we started to use custom tags. It turns out that the format of egress custom tags is actually different from ingress custom tags. While the lower bits just contain the port number in ingress tags, egress tags need to indicate destination port by setting the bit for the corresponding port. It was working on port 0 because port 0 added 0x00 as port number in the lower bits, and if you do this the packet appears at all ports, including the intended port. Ooops. Fix this and all ports work again. Use the define for shifting the "type A" into place while we're at it. Tested on the D-Link DIR-685 by sending traffic to each of the ports in turn. It works. Fixes: 86dd9868b878 ("net: dsa: tag_rtl4_a: Support also egress tags") Cc: DENG Qingfang Cc: Mauri Sandberg Signed-off-by: Linus Walleij Reviewed-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/dsa/tag_rtl4_a.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.30.2 diff --git a/net/dsa/tag_rtl4_a.c b/net/dsa/tag_rtl4_a.c index 57c46b4ab2b3..e34b80fa52e1 100644 --- a/net/dsa/tag_rtl4_a.c +++ b/net/dsa/tag_rtl4_a.c @@ -54,9 +54,10 @@ static struct sk_buff *rtl4a_tag_xmit(struct sk_buff *skb, p = (__be16 *)tag; *p = htons(RTL4_A_ETHERTYPE); - out = (RTL4_A_PROTOCOL_RTL8366RB << 12) | (2 << 8); - /* The lower bits is the port number */ - out |= (u8)dp->index; + out = (RTL4_A_PROTOCOL_RTL8366RB << RTL4_A_PROTOCOL_SHIFT) | (2 << 8); + /* The lower bits indicate the port number */ + out |= BIT(dp->index); + p = (__be16 *)(tag + 2); *p = htons(out);