* [PATCH AUTOSEL 4.19 2/7] tools/power turbostat: Fix Bzy_MHz documentation typo
2024-04-22 23:20 [PATCH AUTOSEL 4.19 1/7] tools/power turbostat: Fix added raw MSR output Sasha Levin
@ 2024-04-22 23:20 ` Sasha Levin
2024-04-22 23:20 ` [PATCH AUTOSEL 4.19 3/7] btrfs: make btrfs_clear_delalloc_extent() free delalloc reserve Sasha Levin
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2024-04-22 23:20 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: Peng Liu, Len Brown, Sasha Levin, lenb, linux-pm
From: Peng Liu <liupeng17@lenovo.com>
[ Upstream commit 0b13410b52c4636aacb6964a4253a797c0fa0d16 ]
The code calculates Bzy_MHz by multiplying TSC_delta * APERF_delta/MPERF_delta
The man page erroneously showed that TSC_delta was divided.
Signed-off-by: Peng Liu <liupeng17@lenovo.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
tools/power/x86/turbostat/turbostat.8 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/power/x86/turbostat/turbostat.8 b/tools/power/x86/turbostat/turbostat.8
index a6db83a88e852..25a560c41321d 100644
--- a/tools/power/x86/turbostat/turbostat.8
+++ b/tools/power/x86/turbostat/turbostat.8
@@ -318,7 +318,7 @@ below the processor's base frequency.
Busy% = MPERF_delta/TSC_delta
-Bzy_MHz = TSC_delta/APERF_delta/MPERF_delta/measurement_interval
+Bzy_MHz = TSC_delta*APERF_delta/MPERF_delta/measurement_interval
Note that these calculations depend on TSC_delta, so they
are not reliable during intervals when TSC_MHz is not running at the base frequency.
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH AUTOSEL 4.19 3/7] btrfs: make btrfs_clear_delalloc_extent() free delalloc reserve
2024-04-22 23:20 [PATCH AUTOSEL 4.19 1/7] tools/power turbostat: Fix added raw MSR output Sasha Levin
2024-04-22 23:20 ` [PATCH AUTOSEL 4.19 2/7] tools/power turbostat: Fix Bzy_MHz documentation typo Sasha Levin
@ 2024-04-22 23:20 ` Sasha Levin
2024-04-22 23:20 ` [PATCH AUTOSEL 4.19 4/7] btrfs: always clear PERTRANS metadata during commit Sasha Levin
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2024-04-22 23:20 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Boris Burkov, Qu Wenruo, David Sterba, Sasha Levin, clm, josef,
linux-btrfs
From: Boris Burkov <boris@bur.io>
[ Upstream commit 3c6f0c5ecc8910d4ffb0dfe85609ebc0c91c8f34 ]
Currently, this call site in btrfs_clear_delalloc_extent() only converts
the reservation. We are marking it not delalloc, so I don't think it
makes sense to keep the rsv around. This is a path where we are not
sure to join a transaction, so it leads to incorrect free-ing during
umount.
Helps with the pass rate of generic/269 and generic/475.
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Boris Burkov <boris@bur.io>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index e4a4074ef33da..7f675862ffb0e 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1906,7 +1906,7 @@ static void btrfs_clear_bit_hook(void *private_data,
*/
if (*bits & EXTENT_CLEAR_META_RESV &&
root != fs_info->tree_root)
- btrfs_delalloc_release_metadata(inode, len, false);
+ btrfs_delalloc_release_metadata(inode, len, true);
/* For sanity tests. */
if (btrfs_is_testing(fs_info))
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH AUTOSEL 4.19 4/7] btrfs: always clear PERTRANS metadata during commit
2024-04-22 23:20 [PATCH AUTOSEL 4.19 1/7] tools/power turbostat: Fix added raw MSR output Sasha Levin
2024-04-22 23:20 ` [PATCH AUTOSEL 4.19 2/7] tools/power turbostat: Fix Bzy_MHz documentation typo Sasha Levin
2024-04-22 23:20 ` [PATCH AUTOSEL 4.19 3/7] btrfs: make btrfs_clear_delalloc_extent() free delalloc reserve Sasha Levin
@ 2024-04-22 23:20 ` Sasha Levin
2024-04-22 23:20 ` [PATCH AUTOSEL 4.19 5/7] scsi: target: Fix SELinux error when systemd-modules loads the target module Sasha Levin
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2024-04-22 23:20 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Boris Burkov, Qu Wenruo, David Sterba, Sasha Levin, clm, josef,
linux-btrfs
From: Boris Burkov <boris@bur.io>
[ Upstream commit 6e68de0bb0ed59e0554a0c15ede7308c47351e2d ]
It is possible to clear a root's IN_TRANS tag from the radix tree, but
not clear its PERTRANS, if there is some error in between. Eliminate
that possibility by moving the free up to where we clear the tag.
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Boris Burkov <boris@bur.io>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/btrfs/transaction.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index a34c0436ebb1d..df9b209bf1b2d 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1271,6 +1271,7 @@ static noinline int commit_fs_roots(struct btrfs_trans_handle *trans)
radix_tree_tag_clear(&fs_info->fs_roots_radix,
(unsigned long)root->root_key.objectid,
BTRFS_ROOT_TRANS_TAG);
+ btrfs_qgroup_free_meta_all_pertrans(root);
spin_unlock(&fs_info->fs_roots_radix_lock);
btrfs_free_log(trans, root);
@@ -1295,7 +1296,6 @@ static noinline int commit_fs_roots(struct btrfs_trans_handle *trans)
if (ret2)
return ret2;
spin_lock(&fs_info->fs_roots_radix_lock);
- btrfs_qgroup_free_meta_all_pertrans(root);
}
}
spin_unlock(&fs_info->fs_roots_radix_lock);
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH AUTOSEL 4.19 5/7] scsi: target: Fix SELinux error when systemd-modules loads the target module
2024-04-22 23:20 [PATCH AUTOSEL 4.19 1/7] tools/power turbostat: Fix added raw MSR output Sasha Levin
` (2 preceding siblings ...)
2024-04-22 23:20 ` [PATCH AUTOSEL 4.19 4/7] btrfs: always clear PERTRANS metadata during commit Sasha Levin
@ 2024-04-22 23:20 ` Sasha Levin
2024-04-22 23:20 ` [PATCH AUTOSEL 4.19 6/7] selftests: timers: Fix valid-adjtimex signed left-shift undefined behavior Sasha Levin
2024-04-22 23:20 ` [PATCH AUTOSEL 4.19 7/7] iommu: mtk: fix module autoloading Sasha Levin
5 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2024-04-22 23:20 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Maurizio Lombardi, Mike Christie, Martin K . Petersen,
Sasha Levin, linux-scsi, target-devel
From: Maurizio Lombardi <mlombard@redhat.com>
[ Upstream commit 97a54ef596c3fd24ec2b227ba8aaf2cf5415e779 ]
If the systemd-modules service loads the target module, the credentials of
that userspace process will be used to validate the access to the target db
directory. SELinux will prevent it, reporting an error like the following:
kernel: audit: type=1400 audit(1676301082.205:4): avc: denied { read }
for pid=1020 comm="systemd-modules" name="target" dev="dm-3"
ino=4657583 scontext=system_u:system_r:systemd_modules_load_t:s0
tcontext=system_u:object_r:targetd_etc_rw_t:s0 tclass=dir permissive=0
Fix the error by using the kernel credentials to access the db directory
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Link: https://lore.kernel.org/r/20240215143944.847184-2-mlombard@redhat.com
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/target/target_core_configfs.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index f6b1549f41422..10fbfa7df46ab 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -3240,6 +3240,8 @@ static int __init target_core_init_configfs(void)
{
struct configfs_subsystem *subsys = &target_core_fabrics;
struct t10_alua_lu_gp *lu_gp;
+ struct cred *kern_cred;
+ const struct cred *old_cred;
int ret;
pr_debug("TARGET_CORE[0]: Loading Generic Kernel Storage"
@@ -3316,11 +3318,21 @@ static int __init target_core_init_configfs(void)
if (ret < 0)
goto out;
+ /* We use the kernel credentials to access the target directory */
+ kern_cred = prepare_kernel_cred(&init_task);
+ if (!kern_cred) {
+ ret = -ENOMEM;
+ goto out;
+ }
+ old_cred = override_creds(kern_cred);
target_init_dbroot();
+ revert_creds(old_cred);
+ put_cred(kern_cred);
return 0;
out:
+ target_xcopy_release_pt();
configfs_unregister_subsystem(subsys);
core_dev_release_virtual_lun0();
rd_module_exit();
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH AUTOSEL 4.19 6/7] selftests: timers: Fix valid-adjtimex signed left-shift undefined behavior
2024-04-22 23:20 [PATCH AUTOSEL 4.19 1/7] tools/power turbostat: Fix added raw MSR output Sasha Levin
` (3 preceding siblings ...)
2024-04-22 23:20 ` [PATCH AUTOSEL 4.19 5/7] scsi: target: Fix SELinux error when systemd-modules loads the target module Sasha Levin
@ 2024-04-22 23:20 ` Sasha Levin
2024-04-22 23:20 ` [PATCH AUTOSEL 4.19 7/7] iommu: mtk: fix module autoloading Sasha Levin
5 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2024-04-22 23:20 UTC (permalink / raw)
To: linux-kernel, stable
Cc: John Stultz, Lee Jones, Muhammad Usama Anjum, Thomas Gleixner,
Sasha Levin, shuah, nathan, linux-kselftest, llvm
From: John Stultz <jstultz@google.com>
[ Upstream commit 076361362122a6d8a4c45f172ced5576b2d4a50d ]
The struct adjtimex freq field takes a signed value who's units are in
shifted (<<16) parts-per-million.
Unfortunately for negative adjustments, the straightforward use of:
freq = ppm << 16 trips undefined behavior warnings with clang:
valid-adjtimex.c:66:6: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
-499<<16,
~~~~^
valid-adjtimex.c:67:6: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
-450<<16,
~~~~^
..
Fix it by using a multiply by (1 << 16) instead of shifting negative values
in the valid-adjtimex test case. Align the values for better readability.
Reported-by: Lee Jones <joneslee@google.com>
Reported-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Signed-off-by: John Stultz <jstultz@google.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Link: https://lore.kernel.org/r/20240409202222.2830476-1-jstultz@google.com
Link: https://lore.kernel.org/lkml/0c6d4f0d-2064-4444-986b-1d1ed782135f@collabora.com/
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../testing/selftests/timers/valid-adjtimex.c | 73 +++++++++----------
1 file changed, 36 insertions(+), 37 deletions(-)
diff --git a/tools/testing/selftests/timers/valid-adjtimex.c b/tools/testing/selftests/timers/valid-adjtimex.c
index 48b9a803235a8..d13ebde203221 100644
--- a/tools/testing/selftests/timers/valid-adjtimex.c
+++ b/tools/testing/selftests/timers/valid-adjtimex.c
@@ -21,9 +21,6 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
-
-
-
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
@@ -62,45 +59,47 @@ int clear_time_state(void)
#define NUM_FREQ_OUTOFRANGE 4
#define NUM_FREQ_INVALID 2
+#define SHIFTED_PPM (1 << 16)
+
long valid_freq[NUM_FREQ_VALID] = {
- -499<<16,
- -450<<16,
- -400<<16,
- -350<<16,
- -300<<16,
- -250<<16,
- -200<<16,
- -150<<16,
- -100<<16,
- -75<<16,
- -50<<16,
- -25<<16,
- -10<<16,
- -5<<16,
- -1<<16,
+ -499 * SHIFTED_PPM,
+ -450 * SHIFTED_PPM,
+ -400 * SHIFTED_PPM,
+ -350 * SHIFTED_PPM,
+ -300 * SHIFTED_PPM,
+ -250 * SHIFTED_PPM,
+ -200 * SHIFTED_PPM,
+ -150 * SHIFTED_PPM,
+ -100 * SHIFTED_PPM,
+ -75 * SHIFTED_PPM,
+ -50 * SHIFTED_PPM,
+ -25 * SHIFTED_PPM,
+ -10 * SHIFTED_PPM,
+ -5 * SHIFTED_PPM,
+ -1 * SHIFTED_PPM,
-1000,
- 1<<16,
- 5<<16,
- 10<<16,
- 25<<16,
- 50<<16,
- 75<<16,
- 100<<16,
- 150<<16,
- 200<<16,
- 250<<16,
- 300<<16,
- 350<<16,
- 400<<16,
- 450<<16,
- 499<<16,
+ 1 * SHIFTED_PPM,
+ 5 * SHIFTED_PPM,
+ 10 * SHIFTED_PPM,
+ 25 * SHIFTED_PPM,
+ 50 * SHIFTED_PPM,
+ 75 * SHIFTED_PPM,
+ 100 * SHIFTED_PPM,
+ 150 * SHIFTED_PPM,
+ 200 * SHIFTED_PPM,
+ 250 * SHIFTED_PPM,
+ 300 * SHIFTED_PPM,
+ 350 * SHIFTED_PPM,
+ 400 * SHIFTED_PPM,
+ 450 * SHIFTED_PPM,
+ 499 * SHIFTED_PPM,
};
long outofrange_freq[NUM_FREQ_OUTOFRANGE] = {
- -1000<<16,
- -550<<16,
- 550<<16,
- 1000<<16,
+ -1000 * SHIFTED_PPM,
+ -550 * SHIFTED_PPM,
+ 550 * SHIFTED_PPM,
+ 1000 * SHIFTED_PPM,
};
#define LONG_MAX (~0UL>>1)
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH AUTOSEL 4.19 7/7] iommu: mtk: fix module autoloading
2024-04-22 23:20 [PATCH AUTOSEL 4.19 1/7] tools/power turbostat: Fix added raw MSR output Sasha Levin
` (4 preceding siblings ...)
2024-04-22 23:20 ` [PATCH AUTOSEL 4.19 6/7] selftests: timers: Fix valid-adjtimex signed left-shift undefined behavior Sasha Levin
@ 2024-04-22 23:20 ` Sasha Levin
2024-04-23 11:39 ` Pavel Machek
5 siblings, 1 reply; 9+ messages in thread
From: Sasha Levin @ 2024-04-22 23:20 UTC (permalink / raw)
To: linux-kernel, stable
Cc: Krzysztof Kozlowski, Joerg Roedel, Sasha Levin, yong.wu, joro,
will, matthias.bgg, angelogioacchino.delregno, iommu,
linux-mediatek, linux-arm-kernel
From: Krzysztof Kozlowski <krzk@kernel.org>
[ Upstream commit 7537e31df80cb58c27f3b6fef702534ea87a5957 ]
Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded
based on the alias from of_device_id table.
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Link: https://lore.kernel.org/r/20240410164109.233308-1-krzk@kernel.org
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/iommu/mtk_iommu.c | 1 +
drivers/iommu/mtk_iommu_v1.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index 7304ad88f1263..93a47302d6cfc 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -761,6 +761,7 @@ static const struct of_device_id mtk_iommu_of_ids[] = {
{ .compatible = "mediatek,mt8173-m4u", .data = (void *)M4U_MT8173},
{}
};
+MODULE_DEVICE_TABLE(of, mtk_iommu_of_ids);
static struct platform_driver mtk_iommu_driver = {
.probe = mtk_iommu_probe,
diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
index 94b16cacb80fc..709a2ab1d4cf7 100644
--- a/drivers/iommu/mtk_iommu_v1.c
+++ b/drivers/iommu/mtk_iommu_v1.c
@@ -541,6 +541,7 @@ static const struct of_device_id mtk_iommu_of_ids[] = {
{ .compatible = "mediatek,mt2701-m4u", },
{}
};
+MODULE_DEVICE_TABLE(of, mtk_iommu_v1_of_ids);
static const struct component_master_ops mtk_iommu_com_ops = {
.bind = mtk_iommu_bind,
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH AUTOSEL 4.19 7/7] iommu: mtk: fix module autoloading
2024-04-22 23:20 ` [PATCH AUTOSEL 4.19 7/7] iommu: mtk: fix module autoloading Sasha Levin
@ 2024-04-23 11:39 ` Pavel Machek
2024-05-09 12:46 ` Sasha Levin
0 siblings, 1 reply; 9+ messages in thread
From: Pavel Machek @ 2024-04-23 11:39 UTC (permalink / raw)
To: Sasha Levin
Cc: linux-kernel, stable, Krzysztof Kozlowski, Joerg Roedel, yong.wu,
joro, will, matthias.bgg, angelogioacchino.delregno, iommu,
linux-mediatek, linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 378 bytes --]
Hi!
> [ Upstream commit 7537e31df80cb58c27f3b6fef702534ea87a5957 ]
>
> Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded
> based on the alias from of_device_id table.
This patch is queued for 4.19 and 5.15, but not 5.10. I believe that's
wrong.
Best regards,
Pavel
--
People of Russia, stop Putin before his war on Ukraine escalates.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH AUTOSEL 4.19 7/7] iommu: mtk: fix module autoloading
2024-04-23 11:39 ` Pavel Machek
@ 2024-05-09 12:46 ` Sasha Levin
0 siblings, 0 replies; 9+ messages in thread
From: Sasha Levin @ 2024-05-09 12:46 UTC (permalink / raw)
To: Pavel Machek
Cc: linux-kernel, stable, Krzysztof Kozlowski, Joerg Roedel, yong.wu,
joro, will, matthias.bgg, angelogioacchino.delregno, iommu,
linux-mediatek, linux-arm-kernel
On Tue, Apr 23, 2024 at 01:39:03PM +0200, Pavel Machek wrote:
>Hi!
>
>> [ Upstream commit 7537e31df80cb58c27f3b6fef702534ea87a5957 ]
>>
>> Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded
>> based on the alias from of_device_id table.
>
>This patch is queued for 4.19 and 5.15, but not 5.10. I believe that's
>wrong.
Heh, this is funny. It fails to build on 5.10:
drivers/iommu/mtk_iommu.c:872:1: warning: data definition has no type or storage class
872 | MODULE_DEVICE_TABLE(of, mtk_iommu_of_ids);
| ^~~~~~~~~~~~~~~~~~~
drivers/iommu/mtk_iommu.c:872:1: error: type defaults to 'int' in declaration of 'MODULE_DEVICE_TABLE' [-Werror=implicit-int]
drivers/iommu/mtk_iommu.c:872:1: warning: parameter names (without types) in function declaration
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:286: drivers/iommu/mtk_iommu.o] Error 1
But not on any of the older trees.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 9+ messages in thread