6.7.11-rc1 review
Subsystems (12)
Sasha Levin
maintainerPATCH 115/713 md/raid1: record nonrot rdevs while adding/removing rdevs to conf
In reply to Sasha LevinFrom: Yu Kuai <[email protected]>
[ Upstream commit 2c27d09d3a76b33629d2e681bf8b774f776ade7f ]
For raid1, each read will iterate all the rdevs from conf and check if any rdev is non-rotational, then choose rdev with minimal IO inflight if so, or rdev with closest distance otherwise.
Disk nonrot info can be changed through sysfs entry:
/sys/block/[disk_name]/queue/rotational
However, consider that this should only be used for testing, and user really shouldn't do this in real life. Record the number of non-rotational disks in conf, to avoid checking each rdev in IO fast path and simplify read_balance() a little bit.
Stable-dep-of: 257ac239ffcf ("md/raid1: fix choose next idle in read_balance()")
--- drivers/md/md.h | 1 + drivers/md/raid1.c | 17 ++++++++++------- drivers/md/raid1.h | 1 + 3 files changed, 12 insertions(+), 7 deletions(-)
drivers/md/md.h +1 -0
@@ -207,6 +207,7 @@ enum flag_bits {* check if there is collision between raid1 * serial bios. */ + Nonrot, /* non-rotational device (SSD) */ }; static inline int is_badblock(struct md_rdev *rdev, sector_t s, int sectors,
drivers/md/raid1.c +10 -7
@@ -601,7 +601,6 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sectint sectors;int best_good_sectors;int best_disk, best_dist_disk, best_pending_disk; -int has_nonrot_disk;int disk;sector_t best_dist;unsigned int min_pending;
@@ -622,7 +621,6 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect best_pending_disk =-1 ; min_pending =UINT_MAX ; best_good_sectors =0 ; - has_nonrot_disk =0 ; choose_next_idle =0 ;clear_bit (R1BIO_FailFast, &r1_bio->state);
@@ -639,7 +637,6 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sectsector_t first_bad;int bad_sectors;unsigned int pending; -bool nonrot; rdev = conf->mirrors[disk].rdev; if (r1_bio->bios[disk] == IO_BLOCKED
@@ -705,8 +702,6 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect/* At least two disks to choose from so failfast is OK */ set_bit (R1BIO_FailFast, &r1_bio->state); - nonrot =bdev_nonrot (rdev->bdev); - has_nonrot_disk |= nonrot; pending =atomic_read (&rdev->nr_pending); dist =abs (this_sector - conf->mirrors[disk].head_position);if (choose_first) {
@@ -733,7 +728,7 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect* small, but not a big deal since when the second disk * starts IO, the first disk is likely still busy. */ -if (nonrot && opt_iosize >0 && +if (test_bit (Nonrot, &rdev->flags) && opt_iosize >0 && mirror->seq_start != MaxSector && mirror->next_seq_sect > opt_iosize && mirror->next_seq_sect - opt_iosize >=
@@ -765,7 +760,7 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect* mixed ratation/non-rotational disks depending on workload. */ if (best_disk ==-1 ) { -if (has_nonrot_disk || min_pending ==0 ) +if (READ_ONCE (conf->nonrot_disks) || min_pending ==0 ) best_disk = best_pending_disk;else best_disk = best_dist_disk;
@@ -1772,6 +1767,11 @@ static bool raid1_add_conf(struct r1conf *conf, struct md_rdev *rdev, int disk,if (info->rdev)return false; +if (bdev_nonrot (rdev->bdev)) { +set_bit (Nonrot, &rdev->flags); +WRITE_ONCE (conf->nonrot_disks, conf->nonrot_disks +1 ); + } + rdev->raid_disk = disk; info->head_position =0 ; info->seq_start = MaxSector;
@@ -1795,6 +1795,9 @@ static bool raid1_remove_conf(struct r1conf *conf, int disk) rdev->mddev->degraded < conf->raid_disks)return false; +if (test_and_clear_bit (Nonrot, &rdev->flags)) +WRITE_ONCE (conf->nonrot_disks, conf->nonrot_disks -1 ); +WRITE_ONCE (info->rdev,NULL );return true; }
drivers/md/raid1.h +1 -0
@@ -71,6 +71,7 @@ struct r1conf {* allow for replacements. */ int raid_disks; +int nonrot_disks;spinlock_t device_lock;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 116/713 md/raid1: fix choose next idle in read_balance()
In reply to Sasha LevinFrom: Yu Kuai <[email protected]>
[ Upstream commit 257ac239ffcfd097a9a0732bf5095fb00164f334 ]
Commit 12cee5a8a29e ("md/raid1: prevent merging too large request") add the case choose next idle in read_balance():
read_balance:
for_each_rdev
if(next_seq_sect == this_sector || dist == 0)
-> sequential reads
best_disk = disk;
if (...)
choose_next_idle = 1
continue;
for_each_rdev
-> iterate next rdev
if (pending == 0)
best_disk = disk;
-> choose the next idle disk
break;
if (choose_next_idle)
-> keep using this rdev if there are no other idle disk contine
However, commit 2e52d449bcec ("md/raid1: add failfast handling for reads.") remove the code:
- /* If device is idle, use it */
- if (pending == 0) {
- best_disk = disk;
- break;
- }
Hence choose next idle will never work now, fix this problem by following:
1) don't set best_disk in this case, read_balance() will choose the best disk after iterating all the disks;
2) add 'pending' so that other idle disk will be chosen;
3) add a new local variable 'sequential_disk' to record the disk, and if there is no other idle disk, 'sequential_disk' will be chosen;
--- drivers/md/raid1.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-)
drivers/md/raid1.c +22 -10
@@ -600,13 +600,12 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sectconst sector_t this_sector = r1_bio->sector;int sectors;int best_good_sectors; -int best_disk, best_dist_disk, best_pending_disk; +int best_disk, best_dist_disk, best_pending_disk, sequential_disk;int disk;sector_t best_dist;unsigned int min_pending;struct md_rdev *rdev;int choose_first; -int choose_next_idle;/* * Check if we can balance. We can balance on the whole
@@ -617,11 +616,11 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect sectors = r1_bio->sectors; best_disk =-1 ; best_dist_disk =-1 ; + sequential_disk =-1 ; best_dist = MaxSector; best_pending_disk =-1 ; min_pending =UINT_MAX ; best_good_sectors =0 ; - choose_next_idle =0 ;clear_bit (R1BIO_FailFast, &r1_bio->state); if ((conf->mddev->recovery_cp < this_sector + sectors) ||
@@ -714,7 +713,6 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sectint opt_iosize =bdev_io_opt (rdev->bdev) >>9 ;struct raid1_info *mirror = &conf->mirrors[disk]; - best_disk = disk;/* * If buffered sequential IO size exceeds optimal * iosize, check if there is idle disk. If yes, choose
@@ -733,15 +731,22 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect mirror->next_seq_sect > opt_iosize && mirror->next_seq_sect - opt_iosize >= mirror->seq_start) { - choose_next_idle =1 ; -continue ; +/* +* Add 'pending' to avoid choosing this disk if +* there is other idle disk. +*/ + pending++; +/* +* If there is no other idle disk, this disk +* will be chosen. +*/ + sequential_disk = disk; + } else { + best_disk = disk; +break ; } -break ; } -if (choose_next_idle) -continue ; -if (min_pending > pending) { min_pending = pending; best_pending_disk = disk;
@@ -753,6 +758,13 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect } } +/* +* sequential IO size exceeds optimal iosize, however, there is no other +* idle disk, so choose the sequential disk. +*/ +if (best_disk ==-1 && min_pending !=0 ) + best_disk = sequential_disk; +/* * If all disks are rotational, choose the closest disk. If any disk is * non-rotational, choose the disk with less pending request even the
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 117/713 io_uring/net: unify how recvmsg and sendmsg copy in the msghdr
In reply to Sasha LevinFrom: Jens Axboe <[email protected]>
[ Upstream commit 52307ac4f2b507f60bae6df5be938d35e199c688 ]
For recvmsg, we roll our own since we support buffer selections. This isn't the case for sendmsg right now, but in preparation for doing so, make the recvmsg copy helpers generic so we can call them from the sendmsg side as well.
Stable-dep-of: 8ede3db5061b ("io_uring/net: fix overflow check in io_recvmsg_mshot_prep()")
--- io_uring/net.c | 271 ++++++++++++++++++++++++++----------------------- 1 file changed, 142 insertions(+), 129 deletions(-)
io_uring/net.c +142 -129
@@ -204,16 +204,150 @@ static int io_setup_async_msg(struct io_kiocb *req,return -EAGAIN ; } +static bool io_recvmsg_multishot_overflow (struct io_async_msghdr *iomsg) +{ +int hdr; + +if (iomsg->namelen <0 ) +return true; +if (check_add_overflow ((int )sizeof (struct io_uring_recvmsg_out ), + iomsg->namelen, &hdr)) +return true; +if (check_add_overflow (hdr, (int )iomsg->controllen, &hdr)) +return true; + +return false; +} + +#ifdef CONFIG_COMPAT +static int __io_compat_msg_copy_hdr (struct io_kiocb *req, +struct io_async_msghdr *iomsg, +struct sockaddr __user **addr,int ddir) +{ + struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg); +struct compat_msghdr msg; +struct compat_iovec __user *uiov; +int ret; + +if (copy_from_user (&msg, sr->umsg_compat,sizeof (msg))) +return -EFAULT ; + + ret =__get_compat_msghdr (&iomsg->msg, &msg, addr); +if (ret) +return ret; + + uiov =compat_ptr (msg.msg_iov); +if (req->flags &REQ_F_BUFFER_SELECT ) { +compat_ssize_t clen; + + iomsg->free_iov =NULL ; +if (msg.msg_iovlen ==0 ) { + sr->len =0 ; + }else if (msg.msg_iovlen >1 ) { +return -EINVAL ; + }else { +if (!access_ok (uiov,sizeof (*uiov))) +return -EFAULT ; +if (__get_user (clen, &uiov->iov_len)) +return -EFAULT ; +if (clen <0 ) +return -EINVAL ; + sr->len = clen; + } + +if (ddir ==ITER_DEST && req->flags &REQ_F_APOLL_MULTISHOT ) { + iomsg->namelen = msg.msg_namelen; + iomsg->controllen = msg.msg_controllen; +if (io_recvmsg_multishot_overflow (iomsg)) +return -EOVERFLOW ; + } + +return 0 ; + } + + iomsg->free_iov = iomsg->fast_iov; + ret =__import_iovec (ddir, (struct iovec __user *)uiov, msg.msg_iovlen, +UIO_FASTIOV , &iomsg->free_iov, + &iomsg->msg.msg_iter, true); +if (unlikely (ret <0 )) +return ret; + +return 0 ; +} +#endif + +static int __io_msg_copy_hdr (struct io_kiocb *req,struct io_async_msghdr *iomsg, +struct sockaddr __user **addr,int ddir) +{ + struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg); +struct user_msghdr msg; +int ret; + +if (copy_from_user (&msg, sr->umsg,sizeof (*sr->umsg))) +return -EFAULT ; + + ret =__copy_msghdr (&iomsg->msg, &msg, addr); +if (ret) +return ret; + +if (req->flags &REQ_F_BUFFER_SELECT ) { +if (msg.msg_iovlen ==0 ) { + sr->len = iomsg->fast_iov[0 ].iov_len =0 ; + iomsg->fast_iov[0 ].iov_base =NULL ; + iomsg->free_iov =NULL ; + }else if (msg.msg_iovlen >1 ) { +return -EINVAL ; + }else { +if (copy_from_user (iomsg->fast_iov, msg.msg_iov, +sizeof (*msg.msg_iov))) +return -EFAULT ; + sr->len = iomsg->fast_iov[0 ].iov_len; + iomsg->free_iov =NULL ; + } + +if (ddir ==ITER_DEST && req->flags &REQ_F_APOLL_MULTISHOT ) { + iomsg->namelen = msg.msg_namelen; + iomsg->controllen = msg.msg_controllen; +if (io_recvmsg_multishot_overflow (iomsg)) +return -EOVERFLOW ; + } + +return 0 ; + } + + iomsg->free_iov = iomsg->fast_iov; + ret =__import_iovec (ddir, msg.msg_iov, msg.msg_iovlen,UIO_FASTIOV , + &iomsg->free_iov, &iomsg->msg.msg_iter, false); +if (unlikely (ret <0 )) +return ret; + +return 0 ; +} + +static int io_msg_copy_hdr (struct io_kiocb *req,struct io_async_msghdr *iomsg, +struct sockaddr __user **addr,int ddir) +{ + iomsg->msg.msg_name = &iomsg->addr; + iomsg->msg.msg_iter.nr_segs =0 ; + +#ifdef CONFIG_COMPAT +if (req->ctx->compat) +return __io_compat_msg_copy_hdr (req, iomsg, addr, ddir); +#endif + +return __io_msg_copy_hdr (req, iomsg, addr, ddir); +} +static int io_sendmsg_copy_hdr (struct io_kiocb *req,struct io_async_msghdr *iomsg) { struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg);int ret; - iomsg->msg.msg_name = &iomsg->addr; - iomsg->free_iov = iomsg->fast_iov; - ret =sendmsg_copy_msghdr (&iomsg->msg, sr->umsg, sr->msg_flags, - &iomsg->free_iov); + ret =io_msg_copy_hdr (req, iomsg,NULL ,ITER_SOURCE ); +if (ret) +return ret; +/* save msg_control as sys_sendmsg() overwrites it */ sr->msg_control = iomsg->msg.msg_control_user;return ret;
@@ -435,142 +569,21 @@ int io_send(struct io_kiocb *req, unsigned int issue_flags)return IOU_OK ; } -static bool io_recvmsg_multishot_overflow (struct io_async_msghdr *iomsg) -{ -int hdr; - -if (iomsg->namelen <0 ) -return true; -if (check_add_overflow ((int )sizeof (struct io_uring_recvmsg_out ), - iomsg->namelen, &hdr)) -return true; -if (check_add_overflow (hdr, (int )iomsg->controllen, &hdr)) -return true; - -return false; -} - -static int __io_recvmsg_copy_hdr (struct io_kiocb *req, -struct io_async_msghdr *iomsg) -{ - struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg); -struct user_msghdr msg; -int ret; - -if (copy_from_user (&msg, sr->umsg,sizeof (*sr->umsg))) -return -EFAULT ; - - ret =__copy_msghdr (&iomsg->msg, &msg, &iomsg->uaddr); -if (ret) -return ret; - -if (req->flags &REQ_F_BUFFER_SELECT ) { -if (msg.msg_iovlen ==0 ) { - sr->len = iomsg->fast_iov[0 ].iov_len =0 ; - iomsg->fast_iov[0 ].iov_base =NULL ; - iomsg->free_iov =NULL ; - }else if (msg.msg_iovlen >1 ) { -return -EINVAL ; - }else { -if (copy_from_user (iomsg->fast_iov, msg.msg_iov,sizeof (*msg.msg_iov))) -return -EFAULT ; - sr->len = iomsg->fast_iov[0 ].iov_len; - iomsg->free_iov =NULL ; - } - -if (req->flags &REQ_F_APOLL_MULTISHOT ) { - iomsg->namelen = msg.msg_namelen; - iomsg->controllen = msg.msg_controllen; -if (io_recvmsg_multishot_overflow (iomsg)) -return -EOVERFLOW ; - } - }else { - iomsg->free_iov = iomsg->fast_iov; - ret =__import_iovec (ITER_DEST , msg.msg_iov, msg.msg_iovlen,UIO_FASTIOV , - &iomsg->free_iov, &iomsg->msg.msg_iter, - false); -if (ret >0 ) - ret =0 ; - } - -return ret; -} - -#ifdef CONFIG_COMPAT -static int __io_compat_recvmsg_copy_hdr (struct io_kiocb *req, -struct io_async_msghdr *iomsg) -{ - struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg); -struct compat_msghdr msg; -struct compat_iovec __user *uiov; -int ret; - -if (copy_from_user (&msg, sr->umsg_compat,sizeof (msg))) -return -EFAULT ; - - ret =__get_compat_msghdr (&iomsg->msg, &msg, &iomsg->uaddr); -if (ret) -return ret; - - uiov =compat_ptr (msg.msg_iov); -if (req->flags &REQ_F_BUFFER_SELECT ) { -compat_ssize_t clen; - - iomsg->free_iov =NULL ; -if (msg.msg_iovlen ==0 ) { - sr->len =0 ; - }else if (msg.msg_iovlen >1 ) { -return -EINVAL ; - }else { -if (!access_ok (uiov,sizeof (*uiov))) -return -EFAULT ; -if (__get_user (clen, &uiov->iov_len)) -return -EFAULT ; -if (clen <0 ) -return -EINVAL ; - sr->len = clen; - } - -if (req->flags &REQ_F_APOLL_MULTISHOT ) { - iomsg->namelen = msg.msg_namelen; - iomsg->controllen = msg.msg_controllen; -if (io_recvmsg_multishot_overflow (iomsg)) -return -EOVERFLOW ; - } - }else { - iomsg->free_iov = iomsg->fast_iov; - ret =__import_iovec (ITER_DEST , (struct iovec __user *)uiov, msg.msg_iovlen, -UIO_FASTIOV , &iomsg->free_iov, - &iomsg->msg.msg_iter, true); -if (ret <0 ) -return ret; - } - -return 0 ; -} -#endif -static int io_recvmsg_copy_hdr (struct io_kiocb *req,struct io_async_msghdr *iomsg) { - iomsg->msg.msg_name = &iomsg->addr; - iomsg->msg.msg_iter.nr_segs =0 ; - -#ifdef CONFIG_COMPAT -if (req->ctx->compat) -return __io_compat_recvmsg_copy_hdr (req, iomsg); -#endif - -return __io_recvmsg_copy_hdr (req, iomsg); +return io_msg_copy_hdr (req, iomsg, &iomsg->uaddr,ITER_DEST ); }int io_recvmsg_prep_async (struct io_kiocb *req) { +struct io_async_msghdr *iomsg;int ret;if (!io_msg_alloc_async_prep (req))return -ENOMEM ; - ret =io_recvmsg_copy_hdr (req, req->async_data); + iomsg = req->async_data; + ret =io_recvmsg_copy_hdr (req, iomsg);if (!ret) req->flags |=REQ_F_NEED_CLEANUP ;return ret;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 118/713 io_uring/net: move receive multishot out of the generic msghdr path
In reply to Sasha LevinFrom: Jens Axboe <[email protected]>
[ Upstream commit c55978024d123d43808ab393a0a4ce3ce8568150 ]
Move the actual user_msghdr / compat_msghdr into the send and receive sides, respectively, so we can move the uaddr receive handling into its own handler, and ditto the multishot with buffer selection logic.
Stable-dep-of: 8ede3db5061b ("io_uring/net: fix overflow check in io_recvmsg_mshot_prep()")
--- io_uring/net.c | 161 ++++++++++++++++++++++++++++--------------------- 1 file changed, 91 insertions(+), 70 deletions(-)
io_uring/net.c +91 -70
@@ -204,46 +204,26 @@ static int io_setup_async_msg(struct io_kiocb *req,return -EAGAIN ; } -static bool io_recvmsg_multishot_overflow (struct io_async_msghdr *iomsg) -{ -int hdr; - -if (iomsg->namelen <0 ) -return true; -if (check_add_overflow ((int )sizeof (struct io_uring_recvmsg_out ), - iomsg->namelen, &hdr)) -return true; -if (check_add_overflow (hdr, (int )iomsg->controllen, &hdr)) -return true; - -return false; -} -#ifdef CONFIG_COMPAT -static int __io_compat_msg_copy_hdr (struct io_kiocb *req, -struct io_async_msghdr *iomsg, -struct sockaddr __user **addr,int ddir) +static int io_compat_msg_copy_hdr (struct io_kiocb *req, +struct io_async_msghdr *iomsg, +struct compat_msghdr *msg,int ddir) { struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg); -struct compat_msghdr msg;struct compat_iovec __user *uiov;int ret; -if (copy_from_user (&msg, sr->umsg_compat,sizeof (msg))) +if (copy_from_user (msg, sr->umsg_compat,sizeof (*msg)))return -EFAULT ; - ret =__get_compat_msghdr (&iomsg->msg, &msg, addr); -if (ret) -return ret; - - uiov =compat_ptr (msg.msg_iov); + uiov =compat_ptr (msg->msg_iov);if (req->flags &REQ_F_BUFFER_SELECT ) {compat_ssize_t clen; iomsg->free_iov =NULL ; -if (msg.msg_iovlen ==0 ) { +if (msg->msg_iovlen ==0 ) { sr->len =0 ; - }else if (msg.msg_iovlen >1 ) { + }else if (msg->msg_iovlen >1 ) {return -EINVAL ; }else {if (!access_ok (uiov,sizeof (*uiov)))
@@ -255,18 +235,11 @@ static int __io_compat_msg_copy_hdr(struct io_kiocb *req, sr->len = clen; } -if (ddir ==ITER_DEST && req->flags &REQ_F_APOLL_MULTISHOT ) { - iomsg->namelen = msg.msg_namelen; - iomsg->controllen = msg.msg_controllen; -if (io_recvmsg_multishot_overflow (iomsg)) -return -EOVERFLOW ; - } -return 0 ; } iomsg->free_iov = iomsg->fast_iov; - ret =__import_iovec (ddir, (struct iovec __user *)uiov, msg.msg_iovlen, + ret =__import_iovec (ddir, (struct iovec __user *)uiov, msg->msg_iovlen,UIO_FASTIOV , &iomsg->free_iov, &iomsg->msg.msg_iter, true);if (unlikely (ret <0 ))
@@ -276,47 +249,35 @@ static int __io_compat_msg_copy_hdr(struct io_kiocb *req, }#endif -static int __io_msg_copy_hdr (struct io_kiocb *req,struct io_async_msghdr *iomsg, -struct sockaddr __user **addr,int ddir) +static int io_msg_copy_hdr (struct io_kiocb *req,struct io_async_msghdr *iomsg, +struct user_msghdr *msg,int ddir) { struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg); -struct user_msghdr msg;int ret; -if (copy_from_user (&msg, sr->umsg,sizeof (*sr->umsg))) +if (copy_from_user (msg, sr->umsg,sizeof (*sr->umsg)))return -EFAULT ; - ret =__copy_msghdr (&iomsg->msg, &msg, addr); -if (ret) -return ret; -if (req->flags &REQ_F_BUFFER_SELECT ) { -if (msg.msg_iovlen ==0 ) { +if (msg->msg_iovlen ==0 ) { sr->len = iomsg->fast_iov[0 ].iov_len =0 ; iomsg->fast_iov[0 ].iov_base =NULL ; iomsg->free_iov =NULL ; - }else if (msg.msg_iovlen >1 ) { + }else if (msg->msg_iovlen >1 ) {return -EINVAL ; }else { -if (copy_from_user (iomsg->fast_iov, msg.msg_iov, -sizeof (*msg.msg_iov))) +if (copy_from_user (iomsg->fast_iov, msg->msg_iov, +sizeof (*msg->msg_iov)))return -EFAULT ; sr->len = iomsg->fast_iov[0 ].iov_len; iomsg->free_iov =NULL ; } -if (ddir ==ITER_DEST && req->flags &REQ_F_APOLL_MULTISHOT ) { - iomsg->namelen = msg.msg_namelen; - iomsg->controllen = msg.msg_controllen; -if (io_recvmsg_multishot_overflow (iomsg)) -return -EOVERFLOW ; - } -return 0 ; } iomsg->free_iov = iomsg->fast_iov; - ret =__import_iovec (ddir, msg.msg_iov, msg.msg_iovlen,UIO_FASTIOV , + ret =__import_iovec (ddir, msg->msg_iov, msg->msg_iovlen,UIO_FASTIOV , &iomsg->free_iov, &iomsg->msg.msg_iter, false);if (unlikely (ret <0 ))return ret;
@@ -324,30 +285,34 @@ static int __io_msg_copy_hdr(struct io_kiocb *req, struct io_async_msghdr *iomsgreturn 0 ; } -static int io_msg_copy_hdr (struct io_kiocb *req,struct io_async_msghdr *iomsg, -struct sockaddr __user **addr,int ddir) +static int io_sendmsg_copy_hdr (struct io_kiocb *req, +struct io_async_msghdr *iomsg) { + struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg); +struct user_msghdr msg; +int ret; + iomsg->msg.msg_name = &iomsg->addr; iomsg->msg.msg_iter.nr_segs =0 ;#ifdef CONFIG_COMPAT -if (req->ctx->compat) -return __io_compat_msg_copy_hdr (req, iomsg, addr, ddir); -#endif +if (unlikely (req->ctx->compat)) { +struct compat_msghdr cmsg; -return __io_msg_copy_hdr (req, iomsg, addr, ddir); -} + ret =io_compat_msg_copy_hdr (req, iomsg, &cmsg,ITER_SOURCE ); +if (unlikely (ret)) +return ret; -static int io_sendmsg_copy_hdr (struct io_kiocb *req, -struct io_async_msghdr *iomsg) -{ - struct io_sr_msg *sr = io_kiocb_to_cmd(req, struct io_sr_msg); -int ret; +return __get_compat_msghdr (&iomsg->msg, &cmsg,NULL ); + } +#endif - ret =io_msg_copy_hdr (req, iomsg,NULL ,ITER_SOURCE ); -if (ret) + ret =io_msg_copy_hdr (req, iomsg, &msg,ITER_SOURCE ); +if (unlikely (ret))return ret; + ret =__copy_msghdr (&iomsg->msg, &msg,NULL ); +/* save msg_control as sys_sendmsg() overwrites it */ sr->msg_control = iomsg->msg.msg_control_user;return ret;
@@ -569,10 +534,66 @@ int io_send(struct io_kiocb *req, unsigned int issue_flags)return IOU_OK ; } +static int io_recvmsg_mshot_prep (struct io_kiocb *req, +struct io_async_msghdr *iomsg, +size_t namelen,size_t controllen) +{ +if ((req->flags & (REQ_F_APOLL_MULTISHOT |REQ_F_BUFFER_SELECT )) == + (REQ_F_APOLL_MULTISHOT |REQ_F_BUFFER_SELECT )) { +int hdr; + +if (unlikely (namelen <0 )) +return -EOVERFLOW ; +if (check_add_overflow ((int )sizeof (struct io_uring_recvmsg_out ), + namelen, &hdr)) +return -EOVERFLOW ; +if (check_add_overflow (hdr, (int )controllen, &hdr)) +return -EOVERFLOW ; + + iomsg->namelen = namelen; + iomsg->controllen = controllen; +return 0 ; + } + +return 0 ; +} +static int io_recvmsg_copy_hdr (struct io_kiocb *req,struct io_async_msghdr *iomsg) { -return io_msg_copy_hdr (req, iomsg, &iomsg->uaddr,ITER_DEST ); +struct user_msghdr msg; +int ret; + + iomsg->msg.msg_name = &iomsg->addr; + iomsg->msg.msg_iter.nr_segs =0 ; + +#ifdef CONFIG_COMPAT +if (unlikely (req->ctx->compat)) { +struct compat_msghdr cmsg; + + ret =io_compat_msg_copy_hdr (req, iomsg, &cmsg,ITER_DEST ); +if (unlikely (ret)) +return ret; + + ret =__get_compat_msghdr (&iomsg->msg, &cmsg, &iomsg->uaddr); +if (unlikely (ret)) +return ret; + +return io_recvmsg_mshot_prep (req, iomsg, cmsg.msg_namelen, + cmsg.msg_controllen); + } +#endif + + ret =io_msg_copy_hdr (req, iomsg, &msg,ITER_DEST ); +if (unlikely (ret)) +return ret; + + ret =__copy_msghdr (&iomsg->msg, &msg, &iomsg->uaddr); +if (unlikely (ret)) +return ret; + +return io_recvmsg_mshot_prep (req, iomsg, msg.msg_namelen, + msg.msg_controllen); }int io_recvmsg_prep_async (struct io_kiocb *req)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 119/713 io_uring/net: fix overflow check in io_recvmsg_mshot_prep()
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 8ede3db5061bb1fe28e2c9683329aafa89d2b1b4 ]
The "controllen" variable is type size_t (unsigned long). Casting it to int could lead to an integer underflow.
The check_add_overflow() function considers the type of the destination which is type int. If we add two positive values and the result cannot fit in an integer then that's counted as an overflow.
However, if we cast "controllen" to an int and it turns negative, then negative values *can* fit into an int type so there is no overflow.
Good: 100 + (unsigned long)-4 = 96 <-- overflow
Bad: 100 + (int)-4 = 96 <-- no overflow
I deleted the cast of the sizeof() as well. That's not a bug but the cast is unnecessary.
--- io_uring/net.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
io_uring/net.c +2 -2
@@ -544,10 +544,10 @@ static int io_recvmsg_mshot_prep(struct io_kiocb *req,if (unlikely (namelen <0 ))return -EOVERFLOW ; -if (check_add_overflow ((int )sizeof (struct io_uring_recvmsg_out ), +if (check_add_overflow (sizeof (struct io_uring_recvmsg_out ), namelen, &hdr))return -EOVERFLOW ; -if (check_add_overflow (hdr, (int )controllen, &hdr)) +if (check_add_overflow (hdr, controllen, &hdr))return -EOVERFLOW ; iomsg->namelen = namelen;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 120/713 aoe: fix the potential use-after-free problem in aoecmd_cfg_pkts
In reply to Sasha LevinFrom: Chun-Yi Lee <[email protected]>
[ Upstream commit f98364e926626c678fb4b9004b75cacf92ff0662 ]
This patch is against CVE-2023-6270. The description of cve is:
A flaw was found in the ATA over Ethernet (AoE) driver in the Linux kernel. The aoecmd_cfg_pkts() function improperly updates the refcnt on struct net_device, and a use-after-free can be triggered by racing between the free on the struct and the access through the skbtxq global queue. This could lead to a denial of service condition or potential code execution.
In aoecmd_cfg_pkts(), it always calls dev_put(ifp) when skb initial code is finished. But the net_device ifp will still be used in later tx()->dev_queue_xmit() in kthread. Which means that the dev_put(ifp) should NOT be called in the success path of skb initial code in aoecmd_cfg_pkts(). Otherwise tx() may run into use-after-free because the net_device is freed.
This patch removed the dev_put(ifp) in the success path in aoecmd_cfg_pkts(), and added dev_put() after skb xmit in tx().
--- drivers/block/aoe/aoecmd.c | 12 ++++++------ drivers/block/aoe/aoenet.c | 1 + 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/block/aoe/aoecmd.c +6 -6
@@ -419,13 +419,16 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff_head *qurcu_read_lock ();for_each_netdev_rcu (&init_net, ifp) {dev_hold (ifp); -if (!is_aoe_netif (ifp)) - goto cont; +if (!is_aoe_netif (ifp)) { +dev_put (ifp); +continue ; + } skb =new_skb (sizeof *h +sizeof *ch);if (skb ==NULL ) {printk (KERN_INFO "aoe: skb alloc failure\n" ); - goto cont; +dev_put (ifp); +continue ; }skb_put (skb,sizeof *h +sizeof *ch); skb->dev = ifp;
@@ -440,9 +443,6 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff_head *qu h->major =cpu_to_be16 (aoemajor); h->minor = aoeminor; h->cmd =AOECMD_CFG ; - -cont: -dev_put (ifp); }rcu_read_unlock (); }
drivers/block/aoe/aoenet.c +1 -0
@@ -63,6 +63,7 @@ tx(int id) __must_hold(&txlock)pr_warn ("aoe: packet could not be sent on %s. %s\n" , ifp ? ifp->name :"netif" ,"consider increasing tx_queue_len" ); +dev_put (ifp);spin_lock_irq (&txlock); }return 0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 121/713 x86/mm: Ensure input to pfn_to_kaddr() is treated as a 64-bit type
In reply to Sasha LevinFrom: Michael Roth <[email protected]>
[ Upstream commit 8e5647a723c49d73b9f108a8bb38e8c29d3948ea ]
On 64-bit platforms, the pfn_to_kaddr() macro requires that the input value is 64 bits in order to ensure that valid address bits don't get lost when shifting that input by PAGE_SHIFT to calculate the physical address to provide a virtual address for.
One such example is in pvalidate_pages() (used by SEV-SNP guests), where the GFN in the struct used for page-state change requests is a 40-bit bit-field, so attempts to pass this GFN field directly into pfn_to_kaddr() ends up causing guest crashes when dealing with addresses above the 1TB range due to the above.
Fix this issue with SEV-SNP guests, as well as any similar cases that might cause issues in current/future code, by using an inline function, instead of a macro, so that the input is implicitly cast to the expected 64-bit input type prior to performing the shift operation.
While it might be argued that the issue is on the caller side, other archs/macros have taken similar approaches to deal with instances like this, such as ARM explicitly casting the input to phys_addr_t:
e48866647b48 ("ARM: 8396/1: use phys_addr_t in pfn_to_kaddr()")
A C inline function is even better though.
[ mingo: Refined the changelog some more & added __always_inline. ]
--- arch/x86/include/asm/page.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/x86/include/asm/page.h +5 -1
@@ -66,10 +66,14 @@ static inline void copy_user_page(void *to, void *from, unsigned long vaddr,* virt_addr_valid(kaddr) returns true. */ #define virt_to_page (kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) -#define pfn_to_kaddr (pfn) __va((pfn) << PAGE_SHIFT)extern bool __virt_addr_valid (unsigned long kaddr);#define virt_addr_valid (kaddr) __virt_addr_valid((unsigned long) (kaddr)) +static __always_inline void *pfn_to_kaddr(unsigned long pfn) +{ +return __va (pfn <<PAGE_SHIFT ); +} + static __always_inline u64 __canonical_address(u64 vaddr, u8 vaddr_bits) {return ((s64 )vaddr << (64 - vaddr_bits)) >> (64 - vaddr_bits);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 122/713 x86/resctrl: Remove hard-coded memory bandwidth limit
In reply to Sasha LevinFrom: Babu Moger <[email protected]>
[ Upstream commit 0976783bb123f30981bc1e7a14d9626a6f63aeac ]
The QOS Memory Bandwidth Enforcement Limit is reported by CPUID_Fn80000020_EAX_x01 and CPUID_Fn80000020_EAX_x02:
Bits Description
31:0 BW_LEN: Size of the QOS Memory Bandwidth Enforcement Limit.
Newer processors can support higher bandwidth limit than the current hard-coded value. Remove latter and detect using CPUID instead. Also, update the register variables eax and edx to match the AMD CPUID definition.
The CPUID details are documented in the Processor Programming Reference (PPR) Vol 1.1 for AMD Family 19h Model 11h B1 - 55901 Rev 0.25 in the Link tag below.
--- arch/x86/kernel/cpu/resctrl/core.c | 10 ++++------ arch/x86/kernel/cpu/resctrl/internal.h | 1 - 2 files changed, 4 insertions(+), 7 deletions(-)
arch/x86/kernel/cpu/resctrl/core.c +4 -6
@@ -231,9 +231,7 @@ static bool __get_mem_config_intel(struct rdt_resource *r)static bool __rdt_get_mem_config_amd (struct rdt_resource *r) {struct rdt_hw_resource *hw_res =resctrl_to_arch_res (r); -union cpuid_0x10_3_eax eax; -union cpuid_0x10_x_edx edx; -u32 ebx, ecx, subleaf; +u32 eax, ebx, ecx, edx, subleaf;/* * Query CPUID_Fn80000020_EDX_x01 for MBA and
@@ -241,9 +239,9 @@ static bool __rdt_get_mem_config_amd(struct rdt_resource *r)*/ subleaf = (r->rid ==RDT_RESOURCE_SMBA ) ?2 :1 ; -cpuid_count (0x80000020 , subleaf, &eax.full, &ebx, &ecx, &edx.full); - hw_res->num_closid = edx.split.cos_max +1 ; - r->default_ctrl =MAX_MBA_BW_AMD ; +cpuid_count (0x80000020 , subleaf, &eax, &ebx, &ecx, &edx); + hw_res->num_closid = edx +1 ; + r->default_ctrl =1 << eax;/* AMD does not use delay */ r->membw.delay_linear = false;
arch/x86/kernel/cpu/resctrl/internal.h +0 -1
@@ -18,7 +18,6 @@#define MBM_OVERFLOW_INTERVAL 1000#define MAX_MBA_BW 100u#define MBA_IS_LINEAR 0x4 -#define MAX_MBA_BW_AMD 0x800#define MBM_CNTR_WIDTH_OFFSET_AMD 20#define RMID_VAL_ERROR BIT_ULL(63)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 123/713 x86/resctrl: Read supported bandwidth sources from CPUID
In reply to Sasha LevinFrom: Babu Moger <[email protected]>
[ Upstream commit 54e35eb8611cce5550d3d7689679b1a91c864f28 ]
If the BMEC (Bandwidth Monitoring Event Configuration) feature is supported, the bandwidth events can be configured. The maximum supported bandwidth bitmask can be read from CPUID:
CPUID_Fn80000020_ECX_x03 [Platform QoS Monitoring Bandwidth Event Configuration]
Bits Description 31:7 Reserved 6:0 Identifies the bandwidth sources that can be tracked.
While at it, move the mask checking to mon_config_write() before iterating over all the domains. Also, print the valid bitmask when the user tries to configure invalid event configuration value.
The CPUID details are documented in the Processor Programming Reference (PPR) Vol 1.1 for AMD Family 19h Model 11h B1 - 55901 Rev 0.25 in the Link tag.
--- arch/x86/kernel/cpu/resctrl/internal.h | 3 +++ arch/x86/kernel/cpu/resctrl/monitor.c | 6 ++++++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 14 ++++++++------ 3 files changed, 17 insertions(+), 6 deletions(-)
arch/x86/kernel/cpu/resctrl/internal.h +3 -0
@@ -394,6 +394,8 @@ struct rdt_parse_data {* @msr_update: Function pointer to update QOS MSRs * @mon_scale: cqm counter * mon_scale = occupancy in bytes * @mbm_width: Monitor width, to detect and correct for overflow. +* @mbm_cfg_mask: Bandwidth sources that can be tracked when Bandwidth +* Monitoring Event Configuration (BMEC) is supported. * @cdp_enabled: CDP state of this resource * * Members of this structure are either private to the architecture
@@ -408,6 +410,7 @@ struct rdt_hw_resource { struct rdt_resource *r);unsigned int mon_scale;unsigned int mbm_width; +unsigned int mbm_cfg_mask;bool cdp_enabled; };
arch/x86/kernel/cpu/resctrl/monitor.c +6 -0
@@ -813,6 +813,12 @@ int __init rdt_get_mon_l3_config(struct rdt_resource *r)return ret;if (rdt_cpu_has (X86_FEATURE_BMEC )) { +u32 eax, ebx, ecx, edx; + +/* Detect list of bandwidth sources that can be tracked */ +cpuid_count (0x80000020 ,3 , &eax, &ebx, &ecx, &edx); + hw_res->mbm_cfg_mask = ecx &MAX_EVT_CONFIG_BITS ; +if (rdt_cpu_has (X86_FEATURE_CQM_MBM_TOTAL )) { mbm_total_event.configurable = true;mbm_config_rftype_init ("mbm_total_bytes_config" );
arch/x86/kernel/cpu/resctrl/rdtgroup.c +8 -6
@@ -1620,12 +1620,6 @@ static int mbm_config_write_domain(struct rdt_resource *r,struct mon_config_info mon_info = {0 };int ret =0 ; -/* mon_config cannot be more than the supported set of events */ -if (val >MAX_EVT_CONFIG_BITS ) { -rdt_last_cmd_puts ("Invalid event configuration\n" ); -return -EINVAL ; - } -/* * Read the current config value first. If both are the same then * no need to write it again.
@@ -1663,6 +1657,7 @@ static int mbm_config_write_domain(struct rdt_resource *r,static int mon_config_write (struct rdt_resource *r,char *tok,u32 evtid) { +struct rdt_hw_resource *hw_res =resctrl_to_arch_res (r);char *dom_str =NULL , *id_str;unsigned long dom_id, val;struct rdt_domain *d;
@@ -1686,6 +1681,13 @@ static int mon_config_write(struct rdt_resource *r, char *tok, u32 evtid)return -EINVAL ; } +/* Value from user cannot be more than the supported set of events */ +if ((val & hw_res->mbm_cfg_mask) != val) { +rdt_last_cmd_printf ("Invalid event configuration: max valid mask is 0x%02x\n" , + hw_res->mbm_cfg_mask); +return -EINVAL ; + } +list_for_each_entry (d, &r->domains, list) {if (d->id == dom_id) { ret =mbm_config_write_domain (r, d, evtid, val);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 124/713 x86/resctrl: Implement new mba_MBps throttling heuristic
In reply to Sasha LevinFrom: Tony Luck <[email protected]>
[ Upstream commit c2427e70c1630d98966375fffc2b713ab9768a94 ]
The mba_MBps feedback loop increases throttling when a group is using more bandwidth than the target set by the user in the schemata file, and decreases throttling when below target.
To avoid possibly stepping throttling up and down on every poll a flag "delta_comp" is set whenever throttling is changed to indicate that the actual change in bandwidth should be recorded on the next poll in "delta_bw". Throttling is only reduced if the current bandwidth plus delta_bw is below the user target.
This algorithm works well if the workload has steady bandwidth needs. But it can go badly wrong if the workload moves to a different phase just as the throttling level changed. E.g. if the workload becomes essentially idle right as throttling level is increased, the value calculated for delta_bw will be more or less the old bandwidth level. If the workload then resumes, Linux may never reduce throttling because current bandwidth plus delta_bw is above the target set by the user.
Implement a simpler heuristic by assuming that in the worst case the currently measured bandwidth is being controlled by the current level of throttling. Compute how much it may increase if throttling is relaxed to the next higher level. If that is still below the user target, then it is ok to reduce the amount of throttling.
--- arch/x86/kernel/cpu/resctrl/internal.h | 4 --- arch/x86/kernel/cpu/resctrl/monitor.c | 42 ++++++-------------------- 2 files changed, 10 insertions(+), 36 deletions(-)
arch/x86/kernel/cpu/resctrl/internal.h +0 -4
@@ -295,14 +295,10 @@ struct rftype {* struct mbm_state - status for each MBM counter in each domain * @prev_bw_bytes: Previous bytes value read for bandwidth calculation * @prev_bw: The most recent bandwidth in MBps -* @delta_bw: Difference between the current and previous bandwidth -* @delta_comp: Indicates whether to compute the delta_bw */ struct mbm_state {u64 prev_bw_bytes;u32 prev_bw; -u32 delta_bw; -bool delta_comp; };/**
arch/x86/kernel/cpu/resctrl/monitor.c +10 -32
86 lines not on this page · raw message
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 125/713 x86/sme: Fix memory encryption setting if enabled by default and not overridden
In reply to Sasha LevinFrom: Ard Biesheuvel <[email protected]>
[ Upstream commit e814b59e6c2b11f5a3d007b2e61f7d550c354c3a ]
Commit
cbebd68f59f0 ("x86/mm: Fix use of uninitialized buffer in sme_enable()")
'fixed' an issue in sme_enable() detected by static analysis, and broke the common case in the process.
cmdline_find_option() will return < 0 on an error, or when the command line argument does not appear at all. In this particular case, the latter is not an error condition, and so the early exit is wrong.
Instead, without mem_encrypt= on the command line, the compile time default should be honoured, which could be to enable memory encryption, and this is currently broken.
Fix it by setting sme_me_mask to a preliminary value based on the compile time default, and only omitting the command line argument test when cmdline_find_option() returns an error.
[ bp: Drop active_by_default while at it. ]
--- arch/x86/mm/mem_encrypt_identity.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
arch/x86/mm/mem_encrypt_identity.c +3 -7
@@ -507,7 +507,6 @@ void __init sme_enable(struct boot_params *bp)const char *cmdline_ptr, *cmdline_arg, *cmdline_on, *cmdline_off;unsigned int eax, ebx, ecx, edx;unsigned long feature_mask; -bool active_by_default;unsigned long me_mask;char buffer[16 ];bool snp;
@@ -593,22 +592,19 @@ void __init sme_enable(struct boot_params *bp) : "p" (sme_cmdline_off));if (IS_ENABLED (CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT )) - active_by_default = true; -else - active_by_default = false; + sme_me_mask = me_mask; cmdline_ptr = (const char *)((u64 )bp->hdr.cmd_line_ptr | ((u64 )bp->ext_cmd_line_ptr <<32 ));if (cmdline_find_option (cmdline_ptr, cmdline_arg, buffer,sizeof (buffer)) <0 ) -return ; + goto out;if (!strncmp (buffer, cmdline_on,sizeof (buffer))) sme_me_mask = me_mask;else if (!strncmp (buffer, cmdline_off,sizeof (buffer))) sme_me_mask =0 ; -else - sme_me_mask = active_by_default ? me_mask :0 ; + out:if (sme_me_mask) { physical_mask &= ~sme_me_mask;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 126/713 timekeeping: Fix cross-timestamp interpolation on counter wrap
In reply to Sasha LevinFrom: Peter Hilber <[email protected]>
[ Upstream commit 84dccadd3e2a3f1a373826ad71e5ced5e76b0c00 ]
cycle_between() decides whether get_device_system_crosststamp() will interpolate for older counter readings.
cycle_between() yields wrong results for a counter wrap-around where after < before < test, and for the case after < test < before.
Fix the comparison logic.
--- kernel/time/timekeeping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/time/timekeeping.c +1 -1
@@ -1186,7 +1186,7 @@ static bool cycle_between(u64 before, u64 test, u64 after) {if (test > before && test < after)return true; -if (test < before && before > after) +if (before > after && (test > before || test < after))return true;return false; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 127/713 timekeeping: Fix cross-timestamp interpolation corner case decision
In reply to Sasha LevinFrom: Peter Hilber <[email protected]>
[ Upstream commit 87a41130881995f82f7adbafbfeddaebfb35f0ef ]
The cycle_between() helper checks if parameter test is in the open interval (before, after). Colloquially speaking, this also applies to the counter wrap-around special case before > after. get_device_system_crosststamp() currently uses cycle_between() at the first call site to decide whether to interpolate for older counter readings.
get_device_system_crosststamp() has the following problem with cycle_between() testing against an open interval: Assume that, by chance, cycles == tk->tkr_mono.cycle_last (in the following, "cycle_last" for brevity). Then, cycle_between() at the first call site, with effective argument values cycle_between(cycle_last, cycles, now), returns false, enabling interpolation. During interpolation, get_device_system_crosststamp() will then call cycle_between() at the second call site (if a history_begin was supplied). The effective argument values are cycle_between(history_begin->cycles, cycles, cycles), since system_counterval.cycles == interval_start == cycles, per the assumption. Due to the test against the open interval, cycle_between() returns false again. This causes get_device_system_crosststamp() to return -EINVAL.
This failure should be avoided, since get_device_system_crosststamp() works both when cycles follows cycle_last (no interpolation), and when cycles precedes cycle_last (interpolation). For the case cycles == cycle_last, interpolation is actually unneeded.
Fix this by changing cycle_between() into timestamp_in_interval(), which now checks against the closed interval, rather than the open interval.
This changes the get_device_system_crosststamp() behavior for three corner cases:
1. Bypass interpolation in the case cycles == tk->tkr_mono.cycle_last, fixing the problem described above.
2. At the first timestamp_in_interval() call site, cycles == now no longer causes failure.
3. At the second timestamp_in_interval() call site, history_begin->cycles == system_counterval.cycles no longer causes failure. adjust_historical_crosststamp() also works for this corner case, where partial_history_cycles == total_history_cycles.
These behavioral changes should not cause any problems.
--- kernel/time/timekeeping.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
kernel/time/timekeeping.c +10 -8
@@ -1180,13 +1180,15 @@ static int adjust_historical_crosststamp(struct system_time_snapshot *history, }/* -* cycle_between - true if test occurs chronologically between before and after +* timestamp_in_interval - true if ts is chronologically in [start, end] +* +* True if ts occurs chronologically at or after start, and before or at end. */ -static bool cycle_between (u64 before,u64 test,u64 after) +static bool timestamp_in_interval (u64 start,u64 end,u64 ts) { -if (test > before && test < after) +if (ts >= start && ts <= end)return true; -if (before > after && (test > before || test < after)) +if (start > end && (ts >= start || ts <= end))return true;return false; }
@@ -1246,7 +1248,7 @@ int get_device_system_crosststamp(int (*get_time_fn)*/ now =tk_clock_read (&tk->tkr_mono); interval_start = tk->tkr_mono.cycle_last; -if (!cycle_between (interval_start, cycles, now)) { +if (!timestamp_in_interval (interval_start, now, cycles)) { clock_was_set_seq = tk->clock_was_set_seq; cs_was_changed_seq = tk->cs_was_changed_seq; cycles = interval_start;
@@ -1277,13 +1279,13 @@ int get_device_system_crosststamp(int (*get_time_fn)bool discontinuity;/* -* Check that the counter value occurs after the provided +* Check that the counter value is not before the provided * history reference and that the history doesn't cross a * clocksource change */ if (!history_begin || - !cycle_between (history_begin->cycles, - system_counterval.cycles, cycles) || + !timestamp_in_interval (history_begin->cycles, + cycles, system_counterval.cycles) || history_begin->cs_was_changed_seq != cs_was_changed_seq)return -EINVAL ; partial_history_cycles = cycles - system_counterval.cycles;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 128/713 timekeeping: Fix cross-timestamp interpolation for non-x86
In reply to Sasha LevinFrom: Peter Hilber <[email protected]>
[ Upstream commit 14274d0bd31b4debf28284604589f596ad2e99f2 ]
So far, get_device_system_crosststamp() unconditionally passes system_counterval.cycles to timekeeping_cycles_to_ns(). But when interpolating system time (do_interp == true), system_counterval.cycles is before tkr_mono.cycle_last, contrary to the timekeeping_cycles_to_ns() expectations.
On x86, CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE will mitigate on interpolating, setting delta to 0. With delta == 0, xtstamp->sys_monoraw and xtstamp->sys_realtime are then set to the last update time, as implicitly expected by adjust_historical_crosststamp(). On other architectures, the resulting nonsense xtstamp->sys_monoraw and xtstamp->sys_realtime corrupt the xtstamp (ts) adjustment in adjust_historical_crosststamp().
Fix this by deriving xtstamp->sys_monoraw and xtstamp->sys_realtime from the last update time when interpolating, by using the local variable "cycles". The local variable already has the right value when interpolating, unlike system_counterval.cycles.
--- kernel/time/timekeeping.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
kernel/time/timekeeping.c +2 -4
@@ -1261,10 +1261,8 @@ int get_device_system_crosststamp(int (*get_time_fn) tk_core.timekeeper.offs_real); base_raw = tk->tkr_raw.base; - nsec_real =timekeeping_cycles_to_ns (&tk->tkr_mono, - system_counterval.cycles); - nsec_raw =timekeeping_cycles_to_ns (&tk->tkr_raw, - system_counterval.cycles); + nsec_real =timekeeping_cycles_to_ns (&tk->tkr_mono, cycles); + nsec_raw =timekeeping_cycles_to_ns (&tk->tkr_raw, cycles); }while (read_seqcount_retry (&tk_core.seq, seq)); xtstamp->sys_realtime =ktime_add_ns (base_real, nsec_real);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 129/713 sched/fair: Take the scheduling domain into account in select_idle_smt()
In reply to Sasha LevinFrom: Keisuke Nishimura <[email protected]>
[ Upstream commit 8aeaffef8c6eceab0e1498486fdd4f3dc3b7066c ]
When picking a CPU on task wakeup, select_idle_smt() has to take into account the scheduling domain of @target. This is because the "isolcpus" kernel command line option can remove CPUs from the domain to isolate them from other SMT siblings.
This fix checks if the candidate CPU is in the target scheduling domain.
Commit:
df3cb4ea1fb6 ("sched/fair: Fix wrong cpu selecting from isolated domain")
... originally introduced this fix by adding the check of the scheduling domain in the loop.
However, commit:
3e6efe87cd5cc ("sched/fair: Remove redundant check in select_idle_smt()")
... accidentally removed the check. Bring it back.
--- kernel/sched/fair.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
kernel/sched/fair.c +9 -3
@@ -7318,13 +7318,19 @@ static int select_idle_core(struct task_struct *p, int core, struct cpumask *cpu/* * Scan the local SMT mask for idle CPUs. */ -static int select_idle_smt (struct task_struct *p,int target) +static int select_idle_smt (struct task_struct *p,struct sched_domain *sd,int target) {int cpu;for_each_cpu_and (cpu,cpu_smt_mask (target), p->cpus_ptr) {if (cpu == target)continue ; +/* +* Check if the CPU is in the LLC scheduling domain of @target. +* Due to isolcpus, there is no guarantee that all the siblings are in the domain. +*/ +if (!cpumask_test_cpu (cpu,sched_domain_span (sd))) +continue ;if (available_idle_cpu (cpu) ||sched_idle_cpu (cpu))return cpu; }
@@ -7348,7 +7354,7 @@ static inline int select_idle_core(struct task_struct *p, int core, struct cpumareturn __select_idle_cpu (core, p); } -static inline int select_idle_smt (struct task_struct *p,int target) +static inline int select_idle_smt (struct task_struct *p,struct sched_domain *sd,int target) {return -1 ; }
@@ -7598,7 +7604,7 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target) has_idle_core =test_idle_cores (target);if (!has_idle_core &&cpus_share_cache (prev, target)) { - i =select_idle_smt (p, prev); + i =select_idle_smt (p, sd, prev);if ((unsigned int )i < nr_cpumask_bits)return i; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 130/713 sched/fair: Take the scheduling domain into account in select_idle_core()
In reply to Sasha LevinFrom: Keisuke Nishimura <[email protected]>
[ Upstream commit 23d04d8c6b8ec339057264659b7834027f3e6a63 ]
When picking a CPU on task wakeup, select_idle_core() has to take into account the scheduling domain where the function looks for the CPU.
This is because the "isolcpus" kernel command line option can remove CPUs from the domain to isolate them from other SMT siblings.
This change replaces the set of CPUs allowed to run the task from p->cpus_ptr by the intersection of p->cpus_ptr and sched_domain_span(sd) which is stored in the 'cpus' argument provided by select_idle_cpu().
--- kernel/sched/fair.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched/fair.c +2 -2
@@ -7296,7 +7296,7 @@ static int select_idle_core(struct task_struct *p, int core, struct cpumask *cpuif (!available_idle_cpu (cpu)) { idle = false;if (*idle_cpu ==-1 ) { -if (sched_idle_cpu (cpu) &&cpumask_test_cpu (cpu, p->cpus_ptr)) { +if (sched_idle_cpu (cpu) &&cpumask_test_cpu (cpu, cpus)) { *idle_cpu = cpu;break ; }
@@ -7304,7 +7304,7 @@ static int select_idle_core(struct task_struct *p, int core, struct cpumask *cpu }break ; } -if (*idle_cpu ==-1 &&cpumask_test_cpu (cpu, p->cpus_ptr)) +if (*idle_cpu ==-1 &&cpumask_test_cpu (cpu, cpus)) *idle_cpu = cpu; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 131/713 wifi: ath10k: fix NULL pointer dereference in ath10k_wmi_tlv_op_pull_mgmt_tx_compl_ev()
In reply to Sasha LevinFrom: Xingyuan Mo <[email protected]>
[ Upstream commit ad25ee36f00172f7d53242dc77c69fff7ced0755 ]
We should check whether the WMI_TLV_TAG_STRUCT_MGMT_TX_COMPL_EVENT tlv is present before accessing it, otherwise a null pointer deference error will occur.
--- drivers/net/wireless/ath/ath10k/wmi-tlv.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/ath/ath10k/wmi-tlv.c +4 -0
@@ -851,6 +851,10 @@ ath10k_wmi_tlv_op_pull_mgmt_tx_compl_ev(struct ath10k *ar, struct sk_buff *skb, } ev = tb[WMI_TLV_TAG_STRUCT_MGMT_TX_COMPL_EVENT ]; +if (!ev) { +kfree (tb); +return -EPROTO ; + } arg->desc_id = ev->desc_id; arg->status = ev->status;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 132/713 wifi: b43: Stop/wake correct queue in DMA Tx path when QoS is disabled
In reply to Sasha LevinFrom: Rahul Rameshbabu <[email protected]>
[ Upstream commit 9636951e4468f02c72cc75a82dc65d003077edbc ]
When QoS is disabled, the queue priority value will not map to the correct ieee80211 queue since there is only one queue. Stop/wake queue 0 when QoS is disabled to prevent trying to stop/wake a non-existent queue and failing to stop/wake the actual queue instantiated.
Log of issue before change (with kernel parameter qos=0):
[ +5.112651] ------------[ cut here ]------------
[ +0.000005] WARNING: CPU: 7 PID: 25513 at net/mac80211/util.c:449 __ieee80211_wake_queue+0xd5/0x180 [mac80211]
[ +0.000067] Modules linked in: b43(O) snd_seq_dummy snd_hrtimer snd_seq snd_seq_device nft_chain_nat xt_MASQUERADE nf_nat xfrm_user xfrm_algo xt_addrtype overlay ccm af_packet amdgpu snd_hda_codec_cirrus snd_hda_codec_generic ledtrig_audio drm_exec amdxcp gpu_sched xt_conntrack nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip6t_rpfilter ipt_rpfilter xt_pkttype xt_LOG nf_log_syslog xt_tcpudp nft_compat nf_tables nfnetlink sch_fq_codel btusb uinput iTCO_wdt ctr btrtl intel_pmc_bxt i915 intel_rapl_msr mei_hdcp mei_pxp joydev at24 watchdog btintel atkbd libps2 serio radeon btbcm vivaldi_fmap btmtk intel_rapl_common snd_hda_codec_hdmi bluetooth uvcvideo nls_iso8859_1 applesmc nls_cp437 x86_pkg_temp_thermal snd_hda_intel intel_powerclamp vfat videobuf2_vmalloc coretemp fat snd_intel_dspcfg crc32_pclmul uvc polyval_clmulni snd_intel_sdw_acpi loop videobuf2_memops snd_hda_codec tun drm_suballoc_helper polyval_generic drm_ttm_helper drm_buddy tap ecdh_generic videobuf2_v4l2 gf128mul macvlan ttm ghash_clmulni_intel ecc tg3
[ +0.000044] videodev bridge snd_hda_core rapl crc16 drm_display_helper cec mousedev snd_hwdep evdev intel_cstate bcm5974 hid_appleir videobuf2_common stp mac_hid libphy snd_pcm drm_kms_helper acpi_als mei_me intel_uncore llc mc snd_timer intel_gtt industrialio_triggered_buffer apple_mfi_fastcharge i2c_i801 mei snd lpc_ich agpgart ptp i2c_smbus thunderbolt apple_gmux i2c_algo_bit kfifo_buf video industrialio soundcore pps_core wmi tiny_power_button sbs sbshc button ac cordic bcma mac80211 cfg80211 ssb rfkill libarc4 kvm_intel kvm drm irqbypass fuse backlight firmware_class efi_pstore configfs efivarfs dmi_sysfs ip_tables x_tables autofs4 dm_crypt cbc encrypted_keys trusted asn1_encoder tee tpm rng_core input_leds hid_apple led_class hid_generic usbhid hid sd_mod t10_pi crc64_rocksoft crc64 crc_t10dif crct10dif_generic ahci libahci libata uhci_hcd ehci_pci ehci_hcd crct10dif_pclmul crct10dif_common sha512_ssse3 sha512_generic sha256_ssse3 sha1_ssse3 aesni_intel usbcore scsi_mod libaes crypto_simd cryptd scsi_common
[ +0.000055] usb_common rtc_cmos btrfs blake2b_generic libcrc32c crc32c_generic crc32c_intel xor raid6_pq dm_snapshot dm_bufio dm_mod dax [last unloaded: b43(O)]
[ +0.000009] CPU: 7 PID: 25513 Comm: irq/17-b43 Tainted: G W O 6.6.7 #1-NixOS
[ +0.000003] Hardware name: Apple Inc. MacBookPro8,3/Mac-942459F5819B171B, BIOS 87.0.0.0.0 06/13/2019
[ +0.000001] RIP: 0010:__ieee80211_wake_queue+0xd5/0x180 [mac80211]
[ +0.000046] Code: 00 45 85 e4 0f 85 9b 00 00 00 48 8d bd 40 09 00 00 f0 48 0f ba ad 48 09 00 00 00 72 0f 5b 5d 41 5c 41 5d 41 5e e9 cb 6d 3c d0 <0f> 0b 5b 5d 41 5c 41 5d 41 5e c3 cc cc cc cc 48 8d b4 16 94 00 00
[ +0.000002] RSP: 0018:ffffc90003c77d60 EFLAGS: 00010097
[ +0.000001] RAX: 0000000000000001 RBX: 0000000000000002 RCX: 0000000000000000
[ +0.000001] RDX: 0000000000000000 RSI: 0000000000000002 RDI: ffff88820b924900
[ +0.000002] RBP: ffff88820b924900 R08: ffffc90003c77d90 R09: 000000000003bfd0
[ +0.000001] R10: ffff88820b924900 R11: ffffc90003c77c68 R12: 0000000000000000
[ +0.000001] R13: 0000000000000000 R14: ffffc90003c77d90 R15: ffffffffc0fa6f40
[ +0.000001] FS: 0000000000000000(0000) GS:ffff88846fb80000(0000) knlGS:0000000000000000
[ +0.000001] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ +0.000001] CR2: 00007fafda7ae008 CR3: 000000046d220005 CR4: 00000000000606e0
[ +0.000002] Call Trace:
[ +0.000003] <TASK>
[ +0.000001] ? __ieee80211_wake_queue+0xd5/0x180 [mac80211]
[ +0.000044] ? __warn+0x81/0x130
[ +0.000005] ? __ieee80211_wake_queue+0xd5/0x180 [mac80211]
[ +0.000045] ? report_bug+0x171/0x1a0
[ +0.000004] ? handle_bug+0x41/0x70
[ +0.000004] ? exc_invalid_op+0x17/0x70
[ +0.000003] ? asm_exc_invalid_op+0x1a/0x20
[ +0.000005] ? __ieee80211_wake_queue+0xd5/0x180 [mac80211]
[ +0.000043] ieee80211_wake_queue+0x4a/0x80 [mac80211]
[ +0.000044] b43_dma_handle_txstatus+0x29c/0x3a0 [b43]
[ +0.000016] ? __pfx_irq_thread_fn+0x10/0x10
[ +0.000002] b43_handle_txstatus+0x61/0x80 [b43]
[ +0.000012] b43_interrupt_thread_handler+0x3f9/0x6b0 [b43]
[ +0.000011] irq_thread_fn+0x23/0x60
[ +0.000002] irq_thread+0xfe/0x1c0
[ +0.000002] ? __pfx_irq_thread_dtor+0x10/0x10
[ +0.000001] ? __pfx_irq_thread+0x10/0x10
[ +0.000001] kthread+0xe8/0x120
[ +0.000003] ? __pfx_kthread+0x10/0x10
[ +0.000003] ret_from_fork+0x34/0x50
[ +0.000002] ? __pfx_kthread+0x10/0x10
[ +0.000002] ret_from_fork_asm+0x1b/0x30
[ +0.000004] </TASK>
[ +0.000001] ---[ end trace 0000000000000000 ]--- [ +0.000065] ------------[ cut here ]------------
[ +0.000001] WARNING: CPU: 0 PID: 56077 at net/mac80211/util.c:514 __ieee80211_stop_queue+0xcc/0xe0 [mac80211]
[ +0.000077] Modules linked in: b43(O) snd_seq_dummy snd_hrtimer snd_seq snd_seq_device nft_chain_nat xt_MASQUERADE nf_nat xfrm_user xfrm_algo xt_addrtype overlay ccm af_packet amdgpu snd_hda_codec_cirrus snd_hda_codec_generic ledtrig_audio drm_exec amdxcp gpu_sched xt_conntrack nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip6t_rpfilter ipt_rpfilter xt_pkttype xt_LOG nf_log_syslog xt_tcpudp nft_compat nf_tables nfnetlink sch_fq_codel btusb uinput iTCO_wdt ctr btrtl intel_pmc_bxt i915 intel_rapl_msr mei_hdcp mei_pxp joydev at24 watchdog btintel atkbd libps2 serio radeon btbcm vivaldi_fmap btmtk intel_rapl_common snd_hda_codec_hdmi bluetooth uvcvideo nls_iso8859_1 applesmc nls_cp437 x86_pkg_temp_thermal snd_hda_intel intel_powerclamp vfat videobuf2_vmalloc coretemp fat snd_intel_dspcfg crc32_pclmul uvc polyval_clmulni snd_intel_sdw_acpi loop videobuf2_memops snd_hda_codec tun drm_suballoc_helper polyval_generic drm_ttm_helper drm_buddy tap ecdh_generic videobuf2_v4l2 gf128mul macvlan ttm ghash_clmulni_intel ecc tg3
[ +0.000073] videodev bridge snd_hda_core rapl crc16 drm_display_helper cec mousedev snd_hwdep evdev intel_cstate bcm5974 hid_appleir videobuf2_common stp mac_hid libphy snd_pcm drm_kms_helper acpi_als mei_me intel_uncore llc mc snd_timer intel_gtt industrialio_triggered_buffer apple_mfi_fastcharge i2c_i801 mei snd lpc_ich agpgart ptp i2c_smbus thunderbolt apple_gmux i2c_algo_bit kfifo_buf video industrialio soundcore pps_core wmi tiny_power_button sbs sbshc button ac cordic bcma mac80211 cfg80211 ssb rfkill libarc4 kvm_intel kvm drm irqbypass fuse backlight firmware_class efi_pstore configfs efivarfs dmi_sysfs ip_tables x_tables autofs4 dm_crypt cbc encrypted_keys trusted asn1_encoder tee tpm rng_core input_leds hid_apple led_class hid_generic usbhid hid sd_mod t10_pi crc64_rocksoft crc64 crc_t10dif crct10dif_generic ahci libahci libata uhci_hcd ehci_pci ehci_hcd crct10dif_pclmul crct10dif_common sha512_ssse3 sha512_generic sha256_ssse3 sha1_ssse3 aesni_intel usbcore scsi_mod libaes crypto_simd cryptd scsi_common
[ +0.000084] usb_common rtc_cmos btrfs blake2b_generic libcrc32c crc32c_generic crc32c_intel xor raid6_pq dm_snapshot dm_bufio dm_mod dax [last unloaded: b43]
[ +0.000012] CPU: 0 PID: 56077 Comm: kworker/u16:17 Tainted: G W O 6.6.7 #1-NixOS
[ +0.000003] Hardware name: Apple Inc. MacBookPro8,3/Mac-942459F5819B171B, BIOS 87.0.0.0.0 06/13/2019
[ +0.000001] Workqueue: phy7 b43_tx_work [b43]
[ +0.000019] RIP: 0010:__ieee80211_stop_queue+0xcc/0xe0 [mac80211]
[ +0.000076] Code: 74 11 48 8b 78 08 0f b7 d6 89 e9 4c 89 e6 e8 ab f4 00 00 65 ff 0d 9c b7 34 3f 0f 85 55 ff ff ff 0f 1f 44 00 00 e9 4b ff ff ff <0f> 0b 5b 5d 41 5c 41 5d c3 cc cc cc cc 0f 1f 80 00 00 00 00 90 90
[ +0.000002] RSP: 0000:ffffc90004157d50 EFLAGS: 00010097
[ +0.000002] RAX: 0000000000000001 RBX: 0000000000000002 RCX: 0000000000000000
[ +0.000002] RDX: 0000000000000000 RSI: 0000000000000002 RDI: ffff8882d65d0900
[ +0.000002] RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000001
[ +0.000001] R10: 00000000000000ff R11: ffff88814d0155a0 R12: ffff8882d65d0900
[ +0.000002] R13: 0000000000000000 R14: ffff8881002d2800 R15: 00000000000000d0
[ +0.000002] FS: 0000000000000000(0000) GS:ffff88846f800000(0000) knlGS:0000000000000000
[ +0.000003] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ +0.000002] CR2: 00007f2e8c10c880 CR3: 0000000385b66005 CR4: 00000000000606f0
[ +0.000002] Call Trace:
[ +0.000001] <TASK>
[ +0.000001] ? __ieee80211_stop_queue+0xcc/0xe0 [mac80211]
[ +0.000075] ? __warn+0x81/0x130
[ +0.000004] ? __ieee80211_stop_queue+0xcc/0xe0 [mac80211]
[ +0.000075] ? report_bug+0x171/0x1a0
[ +0.000005] ? handle_bug+0x41/0x70
[ +0.000003] ? exc_invalid_op+0x17/0x70
[ +0.000004] ? asm_exc_invalid_op+0x1a/0x20
[ +0.000004] ? __ieee80211_stop_queue+0xcc/0xe0 [mac80211]
[ +0.000076] ieee80211_stop_queue+0x36/0x50 [mac80211]
[ +0.000077] b43_dma_tx+0x550/0x780 [b43]
[ +0.000023] b43_tx_work+0x90/0x130 [b43]
[ +0.000018] process_one_work+0x174/0x340
[ +0.000003] worker_thread+0x27b/0x3a0
[ +0.000004] ? __pfx_worker_thread+0x10/0x10
[ +0.000002] kthread+0xe8/0x120
[ +0.000003] ? __pfx_kthread+0x10/0x10
[ +0.000004] ret_from_fork+0x34/0x50
[ +0.000002] ? __pfx_kthread+0x10/0x10
[ +0.000003] ret_from_fork_asm+0x1b/0x30
[ +0.000006] </TASK>
[ +0.000001] ---[ end trace 0000000000000000 ]------ drivers/net/wireless/broadcom/b43/b43.h | 16 ++++++++++++++++ drivers/net/wireless/broadcom/b43/dma.c | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-)
drivers/net/wireless/broadcom/b43/b43.h +16 -0
@@ -1082,6 +1082,22 @@ static inline bool b43_using_pio_transfers(struct b43_wldev *dev)return dev->__using_pio_transfers; } +static inline void b43_wake_queue (struct b43_wldev *dev,int queue_prio) +{ +if (dev->qos_enabled) +ieee80211_wake_queue (dev->wl->hw, queue_prio); +else +ieee80211_wake_queue (dev->wl->hw,0 ); +} + +static inline void b43_stop_queue (struct b43_wldev *dev,int queue_prio) +{ +if (dev->qos_enabled) +ieee80211_stop_queue (dev->wl->hw, queue_prio); +else +ieee80211_stop_queue (dev->wl->hw,0 ); +} +/* Message printing */ __printf(2, 3) void b43info(struct b43_wl *wl, const char *fmt, ...); __printf(2, 3) void b43err(struct b43_wl *wl, const char *fmt, ...);
drivers/net/wireless/broadcom/b43/dma.c +2 -2
@@ -1399,7 +1399,7 @@ int b43_dma_tx(struct b43_wldev *dev, struct sk_buff *skb) should_inject_overflow(ring)) {/* This TX ring is full. */ unsigned int skb_mapping =skb_get_queue_mapping (skb); -ieee80211_stop_queue (dev->wl->hw, skb_mapping); +b43_stop_queue (dev, skb_mapping); dev->wl->tx_queue_stopped[skb_mapping] = true; ring->stopped = true;if (b43_debug (dev,B43_DBG_DMAVERBOSE )) {
@@ -1570,7 +1570,7 @@ void b43_dma_handle_txstatus(struct b43_wldev *dev, }else {/* If the driver queue is running wake the corresponding * mac80211 queue. */ -ieee80211_wake_queue (dev->wl->hw, ring->queue_prio); +b43_wake_queue (dev, ring->queue_prio);if (b43_debug (dev,B43_DBG_DMAVERBOSE )) {b43dbg (dev->wl,"Woke up TX ring %d\n" , ring->index); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 133/713 wifi: b43: Stop/wake correct queue in PIO Tx path when QoS is disabled
In reply to Sasha LevinFrom: Rahul Rameshbabu <[email protected]>
[ Upstream commit 77135a38f6c2f950d2306ac3d37cbb407e6243f2 ]
When QoS is disabled, the queue priority value will not map to the correct ieee80211 queue since there is only one queue. Stop/wake queue 0 when QoS is disabled to prevent trying to stop/wake a non-existent queue and failing to stop/wake the actual queue instantiated.
--- drivers/net/wireless/broadcom/b43/pio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/broadcom/b43/pio.c +3 -3
@@ -525,7 +525,7 @@ int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb)if (total_len > (q->buffer_size - q->buffer_used)) {/* Not enough memory on the queue. */ err = -EBUSY ; -ieee80211_stop_queue (dev->wl->hw,skb_get_queue_mapping (skb)); +b43_stop_queue (dev,skb_get_queue_mapping (skb)); q->stopped = true; goto out; }
@@ -552,7 +552,7 @@ int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb)if (((q->buffer_size - q->buffer_used) <roundup (2 +2 +6 ,4 )) || (q->free_packet_slots ==0 )) {/* The queue is full. */ -ieee80211_stop_queue (dev->wl->hw,skb_get_queue_mapping (skb)); +b43_stop_queue (dev,skb_get_queue_mapping (skb)); q->stopped = true; }
@@ -587,7 +587,7 @@ void b43_pio_handle_txstatus(struct b43_wldev *dev,list_add (&pack->list, &q->packets_list);if (q->stopped) { -ieee80211_wake_queue (dev->wl->hw, q->queue_prio); +b43_wake_queue (dev, q->queue_prio); q->stopped = false; } }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 134/713 wifi: b43: Stop correct queue in DMA worker when QoS is disabled
In reply to Sasha LevinFrom: Rahul Rameshbabu <[email protected]>
[ Upstream commit 581c8967d66c4961076dbbee356834e9c6777184 ]
When QoS is disabled, the queue priority value will not map to the correct ieee80211 queue since there is only one queue. Stop queue 0 when QoS is disabled to prevent trying to stop a non-existent queue and failing to stop the actual queue instantiated.
--- drivers/net/wireless/broadcom/b43/main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/wireless/broadcom/b43/main.c +7 -6
@@ -3603,7 +3603,7 @@ static void b43_tx_work(struct work_struct *work) err =b43_dma_tx (dev, skb);if (err == -ENOSPC ) { wl->tx_queue_stopped[queue_num] = true; -ieee80211_stop_queue (wl->hw, queue_num); +b43_stop_queue (dev, queue_num);skb_queue_head (&wl->tx_queue[queue_num], skb);break ; }
@@ -3627,6 +3627,7 @@ static void b43_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) {struct b43_wl *wl =hw_to_b43_wl (hw); +u16 skb_queue_mapping;if (unlikely (skb->len <2 +2 +6 )) {/* Too short, this can't be a valid frame. */
@@ -3635,12 +3636,12 @@ static void b43_op_tx(struct ieee80211_hw *hw, }B43_WARN_ON (skb_shinfo (skb)->nr_frags); -skb_queue_tail (&wl->tx_queue[skb->queue_mapping], skb); -if (!wl->tx_queue_stopped[skb->queue_mapping]) { + skb_queue_mapping =skb_get_queue_mapping (skb); +skb_queue_tail (&wl->tx_queue[skb_queue_mapping], skb); +if (!wl->tx_queue_stopped[skb_queue_mapping])ieee80211_queue_work (wl->hw, &wl->tx_work); - }else { -ieee80211_stop_queue (wl->hw, skb->queue_mapping); - } +else +b43_stop_queue (wl->current_dev, skb_queue_mapping); } static void b43_qos_params_upload(struct b43_wldev *dev,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 135/713 wifi: b43: Disable QoS for bcm4331
In reply to Sasha LevinFrom: Rahul Rameshbabu <[email protected]>
[ Upstream commit 09795bded2e725443fe4a4803cae2079cdaf7b26 ]
bcm4331 seems to not function correctly with QoS support. This may be due to issues with currently available firmware or potentially a device specific issue.
When queues that are not of the default "best effort" priority are selected, traffic appears to not transmit out of the hardware while no errors are returned. This behavior is present among all the other priority
queues: video, voice, and background. While this can be worked around by setting a kernel parameter, the default behavior is problematic for most users and may be difficult to debug. This patch offers a working out-of-box experience for bcm4331 users.
Log of the issue (using ssh low-priority traffic as an example):
ssh -T -vvvv [email protected]
OpenSSH_9.6p1, OpenSSL 3.0.12 24 Oct 2023
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: checking match for 'host * exec "/nix/store/q1c2flcykgr4wwg5a6h450hxbk4ch589-bash-5.2-p15/bin/bash -c '/nix/store/c015armnkhr6v18za0rypm7sh1i8js8w-gnupg-2.4.1/bin/gpg-connect-agent --quiet updatestartuptty /bye >/dev/null 2>&1'"' host github.com originally github.com
debug3: /etc/ssh/ssh_config line 5: matched 'host "github.com"'
debug1: Executing command: '/nix/store/q1c2flcykgr4wwg5a6h450hxbk4ch589-bash-5.2-p15/bin/bash -c '/nix/store/c015armnkhr6v18za0rypm7sh1i8js8w-gnupg-2.4.1/bin/gpg-connect-agent --quiet updatestartuptty /bye >/dev/null 2>&1''
debug3: command returned status 0
debug3: /etc/ssh/ssh_config line 5: matched 'exec "/nix/store/q1c2flcykgr4wwg5a6h450hxbk4ch589-bash-5.2-p15/bin/bash -c '/nix/store/c015armnkhr6v18za0r"'
debug2: match found
debug1: /etc/ssh/ssh_config line 9: Applying options for *
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/binary-eater/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/binary-eater/.ssh/known_hosts2'
debug2: resolving "github.com" port 22
debug3: resolve_host: lookup github.com:22
debug3: channel_clear_timeouts: clearing
debug3: ssh_connect_direct: entering
debug1: Connecting to github.com [192.30.255.113] port 22.
debug3: set_sock_tos: set socket 3 IP_TOS 0x48
--- drivers/net/wireless/broadcom/b43/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/broadcom/b43/main.c +2 -1
@@ -2587,7 +2587,8 @@ static void b43_request_firmware(struct work_struct *work) start_ieee80211: wl->hw->queues =B43_QOS_QUEUE_NUM ; -if (!modparam_qos || dev->fw.opensource) +if (!modparam_qos || dev->fw.opensource || + dev->dev->chip_id ==BCMA_CHIP_ID_BCM4331 ) wl->hw->queues =1 ; err =ieee80211_register_hw (wl->hw);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 136/713 wifi: wilc1000: fix declarations ordering
In reply to Sasha LevinFrom: Alexis Lothoré <[email protected]>
[ Upstream commit 535733e90e5d8912ebeccebb05b354a2d06ff459 ]
Reorder parameters declaration in wilc_parse_join_bss_param to enforce reverse christmas tree
Stable-dep-of: 205c50306acf ("wifi: wilc1000: fix RCU usage in connect path")
--- drivers/net/wireless/microchip/wilc1000/hif.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/microchip/wilc1000/hif.c +4 -4
@@ -374,13 +374,13 @@ static void handle_connect_timeout(struct work_struct *work)void *wilc_parse_join_bss_param (struct cfg80211_bss *bss,struct cfg80211_crypto_settings *crypto) { -struct wilc_join_bss_param *param; -struct ieee80211_p2p_noa_attr noa_attr; -u8 rates_len =0 ; +const struct cfg80211_bss_ies *ies =rcu_dereference (bss->ies);const u8 *tim_elm, *ssid_elm, *rates_ie, *supp_rates_ie;const u8 *ht_ie, *wpa_ie, *wmm_ie, *rsn_ie; +struct ieee80211_p2p_noa_attr noa_attr; +struct wilc_join_bss_param *param; +u8 rates_len =0 ;int ret; -const struct cfg80211_bss_ies *ies =rcu_dereference (bss->ies); param =kzalloc (sizeof (*param),GFP_KERNEL );if (!param)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 137/713 wifi: wilc1000: fix RCU usage in connect path
In reply to Sasha LevinFrom: Alexis Lothoré <[email protected]>
[ Upstream commit 205c50306acf58a335eb19fa84e40140f4fe814f ]
With lockdep enabled, calls to the connect function from cfg802.11 layer lead to the following warning:
=============================
WARNING: suspicious RCU usage
6.7.0-rc1-wt+ #333 Not tainted
-----------------------------drivers/net/wireless/microchip/wilc1000/hif.c:386
suspicious rcu_dereference_check() usage!
[...]
stack backtrace: CPU: 0 PID: 100 Comm: wpa_supplicant Not tainted 6.7.0-rc1-wt+ #333 Hardware name: Atmel SAMA5 unwind_backtrace from show_stack+0x18/0x1c show_stack from dump_stack_lvl+0x34/0x48 dump_stack_lvl from wilc_parse_join_bss_param+0x7dc/0x7f4 wilc_parse_join_bss_param from connect+0x2c4/0x648 connect from cfg80211_connect+0x30c/0xb74 cfg80211_connect from nl80211_connect+0x860/0xa94 nl80211_connect from genl_rcv_msg+0x3fc/0x59c genl_rcv_msg from netlink_rcv_skb+0xd0/0x1f8 netlink_rcv_skb from genl_rcv+0x2c/0x3c genl_rcv from netlink_unicast+0x3b0/0x550 netlink_unicast from netlink_sendmsg+0x368/0x688 netlink_sendmsg from ____sys_sendmsg+0x190/0x430 ____sys_sendmsg from ___sys_sendmsg+0x110/0x158 ___sys_sendmsg from sys_sendmsg+0xe8/0x150 sys_sendmsg from ret_fast_syscall+0x0/0x1c
This warning is emitted because in the connect path, when trying to parse target BSS parameters, we dereference a RCU pointer whithout being in RCU critical section.
Fix RCU dereference usage by moving it to a RCU read critical section. To avoid wrapping the whole wilc_parse_join_bss_param under the critical section, just use the critical section to copy ies data
--- drivers/net/wireless/microchip/wilc1000/hif.c | 36 ++++++++++++------- 1 file changed, 24 insertions(+), 12 deletions(-)
drivers/net/wireless/microchip/wilc1000/hif.c +24 -12
@@ -374,38 +374,49 @@ static void handle_connect_timeout(struct work_struct *work)void *wilc_parse_join_bss_param (struct cfg80211_bss *bss,struct cfg80211_crypto_settings *crypto) { -const struct cfg80211_bss_ies *ies =rcu_dereference (bss->ies); -const u8 *tim_elm, *ssid_elm, *rates_ie, *supp_rates_ie; +const u8 *ies_data, *tim_elm, *ssid_elm, *rates_ie, *supp_rates_ie;const u8 *ht_ie, *wpa_ie, *wmm_ie, *rsn_ie;struct ieee80211_p2p_noa_attr noa_attr; +const struct cfg80211_bss_ies *ies;struct wilc_join_bss_param *param; -u8 rates_len =0 ; +u8 rates_len =0 , ies_len;int ret; param =kzalloc (sizeof (*param),GFP_KERNEL );if (!param)return NULL ; +rcu_read_lock (); + ies =rcu_dereference (bss->ies); + ies_data =kmemdup (ies->data, ies->len,GFP_ATOMIC ); +if (!ies_data) { +rcu_read_unlock (); +kfree (param); +return NULL ; + } + ies_len = ies->len; +rcu_read_unlock (); + param->beacon_period =cpu_to_le16 (bss->beacon_interval); param->cap_info =cpu_to_le16 (bss->capability); param->bss_type =WILC_FW_BSS_TYPE_INFRA ; param->ch =ieee80211_frequency_to_channel (bss->channel->center_freq);ether_addr_copy (param->bssid, bss->bssid); - ssid_elm =cfg80211_find_ie (WLAN_EID_SSID , ies->data, ies->len); + ssid_elm =cfg80211_find_ie (WLAN_EID_SSID , ies_data, ies_len);if (ssid_elm) {if (ssid_elm[1 ] <=IEEE80211_MAX_SSID_LEN )memcpy (param->ssid, ssid_elm +2 , ssid_elm[1 ]); } - tim_elm =cfg80211_find_ie (WLAN_EID_TIM , ies->data, ies->len); + tim_elm =cfg80211_find_ie (WLAN_EID_TIM , ies_data, ies_len);if (tim_elm && tim_elm[1 ] >=2 ) param->dtim_period = tim_elm[3 ];memset (param->p_suites,0xFF ,3 );memset (param->akm_suites,0xFF ,3 ); - rates_ie =cfg80211_find_ie (WLAN_EID_SUPP_RATES , ies->data, ies->len); + rates_ie =cfg80211_find_ie (WLAN_EID_SUPP_RATES , ies_data, ies_len);if (rates_ie) { rates_len = rates_ie[1 ];if (rates_len >WILC_MAX_RATES_SUPPORTED )
@@ -416,7 +427,7 @@ void *wilc_parse_join_bss_param(struct cfg80211_bss *bss,if (rates_len <WILC_MAX_RATES_SUPPORTED ) { supp_rates_ie =cfg80211_find_ie (WLAN_EID_EXT_SUPP_RATES , - ies->data, ies->len); + ies_data, ies_len);if (supp_rates_ie) {u8 ext_rates = supp_rates_ie[1 ];
@@ -431,11 +442,11 @@ void *wilc_parse_join_bss_param(struct cfg80211_bss *bss, } } - ht_ie =cfg80211_find_ie (WLAN_EID_HT_CAPABILITY , ies->data, ies->len); + ht_ie =cfg80211_find_ie (WLAN_EID_HT_CAPABILITY , ies_data, ies_len);if (ht_ie) param->ht_capable = true; - ret =cfg80211_get_p2p_attr (ies->data, ies->len, + ret =cfg80211_get_p2p_attr (ies_data, ies_len,IEEE80211_P2P_ATTR_ABSENCE_NOTICE , (u8 *)&noa_attr,sizeof (noa_attr));if (ret >0 ) {
@@ -459,7 +470,7 @@ void *wilc_parse_join_bss_param(struct cfg80211_bss *bss, } wmm_ie =cfg80211_find_vendor_ie (WLAN_OUI_MICROSOFT ,WLAN_OUI_TYPE_MICROSOFT_WMM , - ies->data, ies->len); + ies_data, ies_len);if (wmm_ie) {struct ieee80211_wmm_param_ie *ie;
@@ -474,13 +485,13 @@ void *wilc_parse_join_bss_param(struct cfg80211_bss *bss, wpa_ie =cfg80211_find_vendor_ie (WLAN_OUI_MICROSOFT ,WLAN_OUI_TYPE_MICROSOFT_WPA , - ies->data, ies->len); + ies_data, ies_len);if (wpa_ie) { param->mode_802_11i =1 ; param->rsn_found = true; } - rsn_ie =cfg80211_find_ie (WLAN_EID_RSN , ies->data, ies->len); + rsn_ie =cfg80211_find_ie (WLAN_EID_RSN , ies_data, ies_len);if (rsn_ie) {int rsn_ie_len =sizeof (struct element ) + rsn_ie[1 ];int offset =8 ;
@@ -514,6 +525,7 @@ void *wilc_parse_join_bss_param(struct cfg80211_bss *bss, param->akm_suites[i] = crypto->akm_suites[i] &0xFF ; } +kfree (ies_data);return (void *)param; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 138/713 wifi: rtl8xxxu: add cancel_work_sync() for c2hcmd_work
In reply to Sasha LevinFrom: Martin Kaistra <[email protected]>
[ Upstream commit 1213acb478a7181cd73eeaf00db430f1e45b1361 ]
The workqueue might still be running, when the driver is stopped. To avoid a use-after-free, call cancel_work_sync() in rtl8xxxu_stop().
--- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +1 -0
@@ -7304,6 +7304,7 @@ static void rtl8xxxu_stop(struct ieee80211_hw *hw)if (priv->usb_interrupts)rtl8xxxu_write32 (priv,REG_USB_HIMR ,0 ); +cancel_work_sync (&priv->c2hcmd_work);cancel_delayed_work_sync (&priv->ra_watchdog);rtl8xxxu_free_rx_resources (priv);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 139/713 wifi: wilc1000: do not realloc workqueue everytime an interface is added
In reply to Sasha LevinFrom: Ajay Singh <[email protected]>
[ Upstream commit 328efda22af81130c2ad981c110518cb29ff2f1d ]
Commit 09ed8bfc5215 ("wilc1000: Rename workqueue from "WILC_wq" to "NETDEV-wq"") moved workqueue creation in wilc_netdev_ifc_init in order to set the interface name in the workqueue name. However, while the driver needs only one workqueue, the wilc_netdev_ifc_init is called each time we add an interface over a phy, which in turns overwrite the workqueue with a new one. This can be observed with the following commands:
for i in $(seq 0 10)
do
iw phy phy0 interface add wlan1 type managed
iw dev wlan1 del
done
ps -eo pid,comm|grep wlan
39 kworker/R-wlan0
98 kworker/R-wlan1
102 kworker/R-wlan1
105 kworker/R-wlan1
108 kworker/R-wlan1
111 kworker/R-wlan1
114 kworker/R-wlan1
117 kworker/R-wlan1
120 kworker/R-wlan1
123 kworker/R-wlan1
126 kworker/R-wlan1
129 kworker/R-wlan1
Fix this leakage by putting back hif_workqueue allocation in wilc_cfg80211_init. Regarding the workqueue name, it is indeed relevant to set it lowercase, however it is not attached to a specific netdev, so enforcing netdev name in the name is not so relevant. Still, enrich the name with the wiphy name to make it clear which phy is using the workqueue.
--- drivers/net/wireless/microchip/wilc1000/cfg80211.c | 11 ++++++++++- drivers/net/wireless/microchip/wilc1000/netdev.c | 10 +--------- 2 files changed, 11 insertions(+), 10 deletions(-)
drivers/net/wireless/microchip/wilc1000/cfg80211.c +10 -1
@@ -1810,15 +1810,24 @@ int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type,INIT_LIST_HEAD (&wl->rxq_head.list);INIT_LIST_HEAD (&wl->vif_list); + wl->hif_workqueue =alloc_ordered_workqueue ("%s" ,WQ_MEM_RECLAIM , +wiphy_name (wl->wiphy)); +if (!wl->hif_workqueue) { + ret = -ENOMEM ; + goto free_cfg; + } vif =wilc_netdev_ifc_init (wl,"wlan%d" ,WILC_STATION_MODE ,NL80211_IFTYPE_STATION , false);if (IS_ERR (vif)) { ret =PTR_ERR (vif); - goto free_cfg; + goto free_hq; }return 0 ; +free_hq: +destroy_workqueue (wl->hif_workqueue); + free_cfg:wilc_wlan_cfg_deinit (wl);
drivers/net/wireless/microchip/wilc1000/netdev.c +1 -9
@@ -989,13 +989,6 @@ struct wilc_vif *wilc_netdev_ifc_init(struct wilc *wl, const char *name, goto error; } - wl->hif_workqueue =alloc_ordered_workqueue ("%s-wq" ,WQ_MEM_RECLAIM , - ndev->name); -if (!wl->hif_workqueue) { - ret = -ENOMEM ; - goto unregister_netdev; - } - ndev->needs_free_netdev = true; vif->iftype = vif_type; vif->idx =wilc_get_available_idx (wl);
@@ -1008,12 +1001,11 @@ struct wilc_vif *wilc_netdev_ifc_init(struct wilc *wl, const char *name,return vif; -unregister_netdev: +error:if (rtnl_locked)cfg80211_unregister_netdevice (ndev);else unregister_netdev (ndev); - error:free_netdev (ndev);return ERR_PTR (ret); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 140/713 wifi: wilc1000: fix multi-vif management when deleting a vif
In reply to Sasha LevinFrom: Ajay Singh <[email protected]>
[ Upstream commit 12cfc9c8d3faf887a202c89bc312202445fca7e8 ]
Adding then removing a second vif currently makes the first vif not working anymore. This is visible for example when we have a first interface connected to some access point:
- create a wpa_supplicant.conf with some AP credentials
- wpa_supplicant -Dnl80211 -c /etc/wpa_supplicant.conf -i wlan0
- dhclient wlan0
- iw phy phy0 interface add wlan1 type managed
- iw dev wlan1 del
wlan0 does not manage properly traffic anymore (eg: ping not working)
This is due to vif mode being incorrectly reconfigured with some default values in del_virtual_intf, affecting by default first vif.
Prevent first vif from being affected on second vif removal by removing vif mode change command in del_virtual_intf
--- drivers/net/wireless/microchip/wilc1000/cfg80211.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/wireless/microchip/wilc1000/cfg80211.c +0 -1
@@ -1615,7 +1615,6 @@ static int del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)cfg80211_unregister_netdevice (vif->ndev); vif->monitor_flag =0 ; -wilc_set_operation_mode (vif,0 ,0 ,0 );mutex_lock (&wl->vif_mutex);list_del_rcu (&vif->list); wl->vif_num--;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 141/713 wifi: mwifiex: debugfs: Drop unnecessary error check for debugfs_create_dir()
In reply to Sasha LevinFrom: Jinjie Ruan <[email protected]>
[ Upstream commit 50180c7f8e3de7c2d87f619131776598fcb1478d ]
debugfs_create_dir() returns ERR_PTR and never return NULL.
As Russell suggested, this patch removes the error checking for debugfs_create_dir(). This is because the DebugFS kernel API is developed in a way that the caller can safely ignore the errors that occur during the creation of DebugFS nodes. The debugfs APIs have a IS_ERR() judge in start_creating() which can handle it gracefully. So these checks are unnecessary.
--- drivers/net/wireless/marvell/mwifiex/debugfs.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/wireless/marvell/mwifiex/debugfs.c +0 -3
@@ -970,9 +970,6 @@ mwifiex_dev_debugfs_init(struct mwifiex_private *priv) priv->dfs_dev_dir =debugfs_create_dir (priv->netdev->name, mwifiex_dfs_dir); -if (!priv->dfs_dev_dir) -return ; -MWIFIEX_DFS_ADD_FILE (info);MWIFIEX_DFS_ADD_FILE (debug);MWIFIEX_DFS_ADD_FILE (getlog);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 142/713 ARM: dts: renesas: r8a73a4: Fix external clocks and clock rate
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 090c4094574705b0afc7d37825cdc5d06f0e7e02 ]
External clocks should be defined as zero-Hz clocks in the SoC .dtsi, and overridden in the board .dts when present.
Correct the clock rate of extal1 from 25 to 26 MHz, to match the crystal oscillator present on the APE6-EVM board.
--- arch/arm/boot/dts/renesas/r8a73a4-ape6evm.dts | 12 ++++++++++++ arch/arm/boot/dts/renesas/r8a73a4.dtsi | 9 ++++++--- 2 files changed, 18 insertions(+), 3 deletions(-)
arch/arm/boot/dts/renesas/r8a73a4-ape6evm.dts +12 -0
@@ -209,6 +209,18 @@ &cmt1 { status = "okay"; }; +&extal1_clk { + clock-frequency = <26000000>; +}; + +&extal2_clk { + clock-frequency = <48000000>; +}; + +&extalr_clk { + clock-frequency = <32768>; +}; + &pfc { scifa0_pins: scifa0 { groups = "scifa0_data";
arch/arm/boot/dts/renesas/r8a73a4.dtsi +6 -3
@@ -450,17 +450,20 @@ clocks { extalr_clk: extalr { compatible = "fixed-clock"; #clock-cells = <0>; - clock-frequency = <32768>; + /* This value must be overridden by the board. */ + clock-frequency = <0>; }; extal1_clk: extal1 { compatible = "fixed-clock"; #clock-cells = <0>; - clock-frequency = <25000000>; + /* This value must be overridden by the board. */ + clock-frequency = <0>; }; extal2_clk: extal2 { compatible = "fixed-clock"; #clock-cells = <0>; - clock-frequency = <48000000>; + /* This value must be overridden by the board. */ + clock-frequency = <0>; }; fsiack_clk: fsiack { compatible = "fixed-clock";
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 143/713 arm64: dts: qcom: sc8180x: Hook up VDD_CX as GCC parent domain
In reply to Sasha LevinFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 3c58b96df110a80e78fa36ef928f1e6c375008e3 ]
Most of GCC is powered by the CX rail. Describe that relationship to let the performance state requests trickle up the chain.
--- arch/arm64/boot/dts/qcom/sc8180x.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/sc8180x.dtsi +1 -0
@@ -781,6 +781,7 @@ gcc: clock-controller@100000 { clock-names = "bi_tcxo", "bi_tcxo_ao", "sleep_clk"; + power-domains = <&rpmhpd SC8180X_CX>; }; qupv3_id_0: geniqup@8c0000 {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 144/713 arm64: dts: qcom: sc8180x: Fix up big CPU idle state entry latency
In reply to Sasha LevinFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 266a3a92044b89c392b3e9cfcc328d4167c18294 ]
The entry latency was oddly low.. Turns out somebody forgot about a second '1'! Fix it.
--- arch/arm64/boot/dts/qcom/sc8180x.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sc8180x.dtsi +1 -1
@@ -289,7 +289,7 @@ LITTLE_CPU_SLEEP_0: cpu-sleep-0-0 { BIG_CPU_SLEEP_0: cpu-sleep-1-0 { compatible = "arm,idle-state"; arm,psci-suspend-param = <0x40000004>; - entry-latency-us = <241>; + entry-latency-us = <2411>; exit-latency-us = <1461>; min-residency-us = <4488>; local-timer-stop;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 145/713 arm64: dts: qcom: sc8180x: Add missing CPU off state
In reply to Sasha LevinFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 07b600dfdfea65d58dd80ea25becd8cff69bfafc ]
The CPUs can be powered off without pulling the plug from the rest of the system. Describe the idle state responsible for this.
--- arch/arm64/boot/dts/qcom/sc8180x.dtsi | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sc8180x.dtsi +10 -2
@@ -297,7 +297,15 @@ BIG_CPU_SLEEP_0: cpu-sleep-1-0 { }; domain-idle-states { - CLUSTER_SLEEP_0: cluster-sleep-0 { + CLUSTER_SLEEP_APSS_OFF: cluster-sleep-0 { + compatible = "domain-idle-state"; + arm,psci-suspend-param = <0x41000044>; + entry-latency-us = <3300>; + exit-latency-us = <3300>; + min-residency-us = <6000>; + }; + + CLUSTER_SLEEP_AOSS_SLEEP: cluster-sleep-1 { compatible = "domain-idle-state"; arm,psci-suspend-param = <0x4100a344>; entry-latency-us = <3263>;
@@ -581,7 +589,7 @@ CPU_PD7: power-domain-cpu7 { CLUSTER_PD: power-domain-cpu-cluster0 { #power-domain-cells = <0>; - domain-idle-states = <&CLUSTER_SLEEP_0>; + domain-idle-states = <&CLUSTER_SLEEP_APSS_OFF &CLUSTER_SLEEP_AOSS_SLEEP>; }; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 146/713 arm64: dts: qcom: sc8180x: Fix eDP PHY power-domains
In reply to Sasha LevinFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 24e98cb3d5e2c86565680e00008a794b4eac0040 ]
The (e)DP PHYs are powered by the MX line, not through the MDSS GDSC. Fix that up.
--- arch/arm64/boot/dts/qcom/sc8180x.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sc8180x.dtsi +1 -1
@@ -3186,7 +3186,7 @@ edp_phy: phy@aec2a00 { <&dispcc DISP_CC_MDSS_AHB_CLK>; clock-names = "aux", "cfg_ahb"; - power-domains = <&dispcc MDSS_GDSC>; + power-domains = <&rpmhpd SC8180X_MX>; #clock-cells = <1>; #phy-cells = <0>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 147/713 arm64: dts: qcom: sc8180x: Don't hold MDP core clock at FMAX
In reply to Sasha LevinFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 309b5774f45aafd002efdb2656673542419abd6f ]
There's an OPP table to handle this, drop the permanent vote.
--- arch/arm64/boot/dts/qcom/sc8180x.dtsi | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/sc8180x.dtsi +2 -4
@@ -2723,10 +2723,8 @@ mdss_mdp: mdp@ae01000 { "core", "vsync"; - assigned-clocks = <&dispcc DISP_CC_MDSS_MDP_CLK>, - <&dispcc DISP_CC_MDSS_VSYNC_CLK>; - assigned-clock-rates = <460000000>, - <19200000>; + assigned-clocks = <&dispcc DISP_CC_MDSS_VSYNC_CLK>; + assigned-clock-rates = <19200000>; operating-points-v2 = <&mdp_opp_table>; power-domains = <&rpmhpd SC8180X_MMCX>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 148/713 arm64: dts: qcom: sc8180x: Require LOW_SVS vote for MMCX if DISPCC is on
In reply to Sasha LevinFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 6d9fb9e4c473cdfd2adca019b46d8e482105cae7 ]
To ensure the PLLs are getting enough power, cast a vote with DISPCC so that MMCX is at least at LOW_SVS.
--- arch/arm64/boot/dts/qcom/sc8180x.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/qcom/sc8180x.dtsi +1 -0
@@ -3210,6 +3210,7 @@ dispcc: clock-controller@af00000 { "edp_phy_pll_link_clk", "edp_phy_pll_vco_div_clk"; power-domains = <&rpmhpd SC8180X_MMCX>; + required-opps = <&rpmhpd_opp_low_svs>; #clock-cells = <1>; #reset-cells = <1>; #power-domain-cells = <1>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 149/713 arm64: dts: qcom: sc8180x: Shrink aoss_qmp register space size
In reply to Sasha LevinFrom: Konrad Dybcio <[email protected]>
[ Upstream commit dcad0590d1ea4278a55c30dd2903611a96111601 ]
The AOSS_QMP region is overallocated, bleeding into space that's supposed to be used by other peripherals. Fix it.
--- arch/arm64/boot/dts/qcom/sc8180x.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sc8180x.dtsi +1 -1
@@ -3249,7 +3249,7 @@ tsens1: thermal-sensor@c265000 { aoss_qmp: power-controller@c300000 { compatible = "qcom,sc8180x-aoss-qmp", "qcom,aoss-qmp"; - reg = <0x0 0x0c300000 0x0 0x100000>; + reg = <0x0 0x0c300000 0x0 0x400>; interrupts = <GIC_SPI 389 IRQ_TYPE_EDGE_RISING>; mboxes = <&apss_shared 0>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 150/713 cpufreq: brcmstb-avs-cpufreq: add check for cpufreq_cpu_get's return value
In reply to Sasha LevinFrom: Anastasia Belova <[email protected]>
[ Upstream commit f661017e6d326ee187db24194cabb013d81bc2a6 ]
cpufreq_cpu_get may return NULL. To avoid NULL-dereference check it and return 0 in case of error.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/cpufreq/brcmstb-avs-cpufreq.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/cpufreq/brcmstb-avs-cpufreq.c +2 -0
@@ -481,6 +481,8 @@ static bool brcm_avs_is_firmware_loaded(struct private_data *priv)static unsigned int brcm_avs_cpufreq_get (unsigned int cpu) {struct cpufreq_policy *policy =cpufreq_cpu_get (cpu); +if (!policy) +return 0 ;struct private_data *priv = policy->driver_data;cpufreq_cpu_put (policy);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 151/713 cpufreq: mediatek-hw: Wait for CPU supplies before probing
In reply to Sasha LevinFrom: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 788715b5f21c6455264fe00a1779e61bec407fe2 ]
Before proceeding with the probe and enabling frequency scaling for the CPUs, make sure that all supplies feeding the CPUs have probed.
This fixes an issue observed on MT8195-Tomato where if the mediatek-cpufreq-hw driver enabled the hardware (by writing to REG_FREQ_ENABLE) before the SPMI controller driver (spmi-mtk-pmif), behind which lies the big CPU supply, probed the platform would hang shortly after with "rcu: INFO: rcu_preempt detected stalls on CPUs/tasks" being printed in the log.
--- drivers/cpufreq/mediatek-cpufreq-hw.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/cpufreq/mediatek-cpufreq-hw.c +18 -1
@@ -13,6 +13,7 @@#include <linux/of.h> #include <linux/of_platform.h> #include <linux/platform_device.h> +#include <linux/regulator/consumer.h> #include <linux/slab.h> #define LUT_MAX_ENTRIES 32U
@@ -300,7 +301,23 @@ static struct cpufreq_driver cpufreq_mtk_hw_driver = {static int mtk_cpufreq_hw_driver_probe (struct platform_device *pdev) {const void *data; -int ret; +int ret, cpu; +struct device *cpu_dev; +struct regulator *cpu_reg; + +/* Make sure that all CPU supplies are available before proceeding. */ +for_each_possible_cpu (cpu) { + cpu_dev =get_cpu_device (cpu); +if (!cpu_dev) +return dev_err_probe (&pdev->dev, -EPROBE_DEFER , +"Failed to get cpu%d device\n" , cpu); + + cpu_reg =devm_regulator_get_optional (cpu_dev,"cpu" ); +if (IS_ERR (cpu_reg)) +return dev_err_probe (&pdev->dev,PTR_ERR (cpu_reg), +"CPU%d regulator get failed\n" , cpu); + } + data =of_device_get_match_data (&pdev->dev);if (!data)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 152/713 sock_diag: annotate data-races around sock_diag_handlers[family]
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit efd402537673f9951992aea4ef0f5ff51d858f4b ]
__sock_diag_cmd() and sock_diag_bind() read sock_diag_handlers[family] without a lock held.
Use READ_ONCE()/WRITE_ONCE() annotations to avoid potential issues.
--- net/core/sock_diag.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/core/sock_diag.c +5 -5
@@ -193,7 +193,7 @@ int sock_diag_register(const struct sock_diag_handler *hndl)if (sock_diag_handlers[hndl->family]) err = -EBUSY ;else - sock_diag_handlers[hndl->family] = hndl; +WRITE_ONCE (sock_diag_handlers[hndl->family], hndl);mutex_unlock (&sock_diag_table_mutex);return err;
@@ -209,7 +209,7 @@ void sock_diag_unregister(const struct sock_diag_handler *hnld)mutex_lock (&sock_diag_table_mutex);BUG_ON (sock_diag_handlers[family] != hnld); - sock_diag_handlers[family] =NULL ; +WRITE_ONCE (sock_diag_handlers[family],NULL );mutex_unlock (&sock_diag_table_mutex); }EXPORT_SYMBOL_GPL (sock_diag_unregister);
@@ -227,7 +227,7 @@ static int __sock_diag_cmd(struct sk_buff *skb, struct nlmsghdr *nlh)return -EINVAL ; req->sdiag_family =array_index_nospec (req->sdiag_family,AF_MAX ); -if (sock_diag_handlers[req->sdiag_family] ==NULL ) +if (READ_ONCE (sock_diag_handlers[req->sdiag_family]) ==NULL )sock_load_diag_module (req->sdiag_family,0 );mutex_lock (&sock_diag_table_mutex);
@@ -286,12 +286,12 @@ static int sock_diag_bind(struct net *net, int group)switch (group) {case SKNLGRP_INET_TCP_DESTROY :case SKNLGRP_INET_UDP_DESTROY : -if (!sock_diag_handlers[AF_INET ]) +if (!READ_ONCE (sock_diag_handlers[AF_INET ]))sock_load_diag_module (AF_INET ,0 );break ;case SKNLGRP_INET6_TCP_DESTROY :case SKNLGRP_INET6_UDP_DESTROY : -if (!sock_diag_handlers[AF_INET6 ]) +if (!READ_ONCE (sock_diag_handlers[AF_INET6 ]))sock_load_diag_module (AF_INET6 ,0 );break ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 153/713 inet_diag: annotate data-races around inet_diag_table[]
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit e50e10ae5d81ddb41547114bfdc5edc04422f082 ]
inet_diag_lock_handler() reads inet_diag_table[proto] locklessly.
Use READ_ONCE()/WRITE_ONCE() annotations to avoid potential issues.
--- net/ipv4/inet_diag.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/ipv4/inet_diag.c +3 -3
@@ -57,7 +57,7 @@ static const struct inet_diag_handler *inet_diag_lock_handler(int proto)return ERR_PTR (-ENOENT ); } -if (!inet_diag_table[proto]) +if (!READ_ONCE (inet_diag_table[proto]))sock_load_diag_module (AF_INET , proto);mutex_lock (&inet_diag_table_mutex);
@@ -1419,7 +1419,7 @@ int inet_diag_register(const struct inet_diag_handler *h)mutex_lock (&inet_diag_table_mutex); err = -EEXIST ;if (!inet_diag_table[type]) { - inet_diag_table[type] = h; +WRITE_ONCE (inet_diag_table[type], h); err =0 ; }mutex_unlock (&inet_diag_table_mutex);
@@ -1436,7 +1436,7 @@ void inet_diag_unregister(const struct inet_diag_handler *h)return ;mutex_lock (&inet_diag_table_mutex); - inet_diag_table[type] =NULL ; +WRITE_ONCE (inet_diag_table[type],NULL );mutex_unlock (&inet_diag_table_mutex); }EXPORT_SYMBOL_GPL (inet_diag_unregister);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 154/713 bpftool: Silence build warning about calloc()
In reply to Sasha LevinFrom: Tiezhu Yang <[email protected]>
[ Upstream commit f5f30386c78105cba520e443a6a9ee945ec1d066 ]
There exists the following warning when building bpftool:
CC prog.oprog.c: In function ‘profile_open_perf_events’:
prog.c:2301:24: warning: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
2301 | sizeof(int), obj->rodata->num_cpu * obj->rodata->num_metric);
| ^~~
prog.c:2301:24: note: earlier argument should specify number of elements, later size of each element
Tested with the latest upstream GCC which contains a new warning option -Wcalloc-transposed-args. The first argument to calloc is documented to be number of elements in array, while the second argument is size of each element, just switch the first and second arguments of calloc() to silence the build warning, compile tested only.
--- tools/bpf/bpftool/prog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/bpftool/prog.c +1 -1
@@ -2294,7 +2294,7 @@ static int profile_open_perf_events(struct profiler_bpf *obj)int map_fd; profile_perf_events =calloc ( -sizeof (int ), obj->rodata->num_cpu * obj->rodata->num_metric); + obj->rodata->num_cpu * obj->rodata->num_metric,sizeof (int ));if (!profile_perf_events) {p_err ("failed to allocate memory for perf_event array: %s" ,strerror (errno));
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 155/713 selftests/bpf: Fix potential premature unload in bpf_testmod
In reply to Sasha LevinFrom: Artem Savkov <[email protected]>
[ Upstream commit d177c1be06ce28aa8c8710ac55be1b5ad3f314c6 ]
It is possible for bpf_kfunc_call_test_release() to be called from bpf_map_free_deferred() when bpf_testmod is already unloaded and perf_test_stuct.cnt which it tries to decrease is no longer in memory. This patch tries to fix the issue by waiting for all references to be dropped in bpf_testmod_exit().
The issue can be triggered by running 'test_progs -t map_kptr' in 6.5, but is obscured in 6.6 by d119357d07435 ("rcu-tasks: Treat only synchronous grace periods urgently").
--- tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c | 9 +++++++++ 1 file changed, 9 insertions(+)
tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c +9 -0
@@ -2,6 +2,7 @@/* Copyright (c) 2020 Facebook */ #include <linux/btf.h> #include <linux/btf_ids.h> +#include <linux/delay.h> #include <linux/error-injection.h> #include <linux/init.h> #include <linux/module.h>
@@ -544,6 +545,14 @@ static int bpf_testmod_init(void)static void bpf_testmod_exit (void ) { +/* Need to wait for all references to be dropped because +* bpf_kfunc_call_test_release() which currently resides in kernel can +* be called after bpf_testmod is unloaded. Once release function is +* moved into the module this wait can be removed. +*/ +while (refcount_read (&prog_test_struct.cnt) >1 ) +msleep (20 ); +return sysfs_remove_bin_file (kernel_kobj, &bin_attr_bpf_testmod_file); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 156/713 libbpf: Apply map_set_def_max_entries() for inner_maps on creation
In reply to Sasha LevinFrom: Andrey Grafin <[email protected]>
[ Upstream commit f04deb90e516e8e48bf8693397529bc942a9e80b ]
This patch allows to auto create BPF_MAP_TYPE_ARRAY_OF_MAPS and BPF_MAP_TYPE_HASH_OF_MAPS with values of BPF_MAP_TYPE_PERF_EVENT_ARRAY by bpf_object__load().
Previous behaviour created a zero filled btf_map_def for inner maps and tried to use it for a map creation but the linux kernel forbids to create a BPF_MAP_TYPE_PERF_EVENT_ARRAY map with max_entries=0.
--- tools/lib/bpf/libbpf.c | 4 ++++ 1 file changed, 4 insertions(+)
tools/lib/bpf/libbpf.c +4 -0
@@ -70,6 +70,7 @@static struct bpf_map *bpf_object__add_map (struct bpf_object *obj);static bool prog_is_subprog (const struct bpf_object *obj,const struct bpf_program *prog); +static int map_set_def_max_entries (struct bpf_map *map);static const char *const attach_type_name[] = { [BPF_CGROUP_INET_INGRESS ] ="cgroup_inet_ingress" ,
@@ -5214,6 +5215,9 @@ static int bpf_object__create_map(struct bpf_object *obj, struct bpf_map *map, bif (bpf_map_type__is_map_in_map (def->type)) {if (map->inner_map) { + err =map_set_def_max_entries (map->inner_map); +if (err) +return err; err =bpf_object__create_map (obj, map->inner_map, true);if (err) { pr_warn("map '%s': failed to create inner map: %d\n",
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 157/713 selftest/bpf: Add map_in_maps with BPF_MAP_TYPE_PERF_EVENT_ARRAY values
In reply to Sasha LevinFrom: Andrey Grafin <[email protected]>
[ Upstream commit 40628f9fff73adecac77a9aa390f8016724cad99 ]
Check that bpf_object__load() successfully creates map_in_maps with BPF_MAP_TYPE_PERF_EVENT_ARRAY values.
These changes cover fix in the previous patch
"libbpf: Apply map_set_def_max_entries() for inner_maps on creation".
A command line output is:
- w/o fix
$ sudo ./test_maps libbpf: map 'mim_array_pe': failed to create inner map: -22 libbpf: map 'mim_array_pe': failed to create: Invalid argument(-22) libbpf: failed to load object './test_map_in_map.bpf.o' Failed to load test prog
- with fix
$ sudo ./test_maps ... test_maps: OK, 0 SKIPPED
--- .../selftests/bpf/progs/test_map_in_map.c | 26 +++++++++++++++++++ tools/testing/selftests/bpf/test_maps.c | 6 ++++- 2 files changed, 31 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/progs/test_map_in_map.c +26 -0
@@ -21,6 +21,32 @@ struct {__type (value, __u32); } mim_hash SEC(".maps"); +/* The following three maps are used to test +* perf_event_array map can be an inner +* map of hash/array_of_maps. +*/ +struct perf_event_array { + __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY); + __type(key, __u32); + __type(value, __u32); +} inner_map0 SEC(".maps"); + +struct { + __uint(type, BPF_MAP_TYPE_ARRAY_OF_MAPS); + __uint(max_entries, 1); + __type(key, __u32); + __array(values, struct perf_event_array); +} mim_array_pe SEC(".maps") = { + .values = {&inner_map0}}; + +struct { + __uint(type, BPF_MAP_TYPE_HASH_OF_MAPS); + __uint(max_entries, 1); + __type(key, __u32); + __array(values, struct perf_event_array); +} mim_hash_pe SEC(".maps") = { + .values = {&inner_map0}}; + SEC("xdp")int xdp_mimtest0 (struct xdp_md *ctx) {
tools/testing/selftests/bpf/test_maps.c +5 -1
@@ -1190,7 +1190,11 @@ static void test_map_in_map(void) goto out_map_in_map; } -bpf_object__load (obj); + err =bpf_object__load (obj); +if (err) { +printf ("Failed to load test prog\n" ); + goto out_map_in_map; + } map =bpf_object__find_map_by_name (obj,"mim_array" );if (!map) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 158/713 wifi: ath12k: Fix issues in channel list update
In reply to Sasha LevinFrom: Sriram R <[email protected]>
[ Upstream commit 67a48d937fac917947540c9f89630d472cd61fcb ]
Currently, the logic used to select the 6 GHz band is incorrect, which may cause 6 GHz supported channels to not be updated properly. This is because the 6 GHz Max frequency supported by the driver is being compared to the Max frequency supported on the board. If in some cases, the 6 GHz Max frequency supported on the board is less than the defined 6 GHz Max frequency, all 6 GHz channels are disabled. To address this, compare the max frequency supported by the board to the defined 6 GHz Minimum frequency by the driver.
Similarly, when a dual mac card supports both 6 GHz and 5 GHz radios, if the 5 GHz radio gets enumerated first before 6 GHz, the checks in ath12k_mac_setup_channels_rates() can cause the 5 GHz channels which were enabled earlier to get disabled when the 6 GHz channel list is updated. This is because the Min 6 GHz frequency defined in the driver is 5945 MHz, which should be 5925 MHz since channel 2 is not considered currently, but the firmware can pass 5925 MHz as the minimum. Hence, update the Min frequency supported by the driver to 5925 MHz.
In addition, ensure that the channel list update to firmware updates only the channels that the current radio (ar) supports rather than considering the wiphy support. This would be required when multiple pdevs are supported in a wiphy and they support different ranges of frequencies or bands as in single wiphy support.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00188-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
--- drivers/net/wireless/ath/ath12k/core.h | 2 +- drivers/net/wireless/ath/ath12k/mac.c | 2 +- drivers/net/wireless/ath/ath12k/reg.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath12k/core.h +1 -1
@@ -418,7 +418,7 @@ struct ath12k_sta { };#define ATH12K_MIN_5G_FREQ 4150 -#define ATH12K_MIN_6G_FREQ 5945 +#define ATH12K_MIN_6G_FREQ 5925#define ATH12K_MAX_6G_FREQ 7115#define ATH12K_NUM_CHANS 100#define ATH12K_MAX_5G_CHAN 173
drivers/net/wireless/ath/ath12k/mac.c +1 -1
@@ -7188,7 +7188,7 @@ static int ath12k_mac_setup_channels_rates(struct ath12k *ar, }if (supported_bands &WMI_HOST_WLAN_5G_CAP ) { -if (reg_cap->high_5ghz_chan >=ATH12K_MAX_6G_FREQ ) { +if (reg_cap->high_5ghz_chan >=ATH12K_MIN_6G_FREQ ) { channels =kmemdup (ath12k_6ghz_channels,sizeof (ath12k_6ghz_channels),GFP_KERNEL );if (!channels) {
drivers/net/wireless/ath/ath12k/reg.c +2 -2
@@ -103,7 +103,7 @@ int ath12k_reg_update_chan_list(struct ath12k *ar) bands = hw->wiphy->bands;for (band =0 ; band <NUM_NL80211_BANDS ; band++) { -if (!bands[band]) +if (!(ar->mac.sbands[band].channels && bands[band]))continue ;for (i =0 ; i < bands[band]->n_channels; i++) {
@@ -129,7 +129,7 @@ int ath12k_reg_update_chan_list(struct ath12k *ar) ch = arg->channel;for (band =0 ; band <NUM_NL80211_BANDS ; band++) { -if (!bands[band]) +if (!(ar->mac.sbands[band].channels && bands[band]))continue ;for (i =0 ; i < bands[band]->n_channels; i++) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 159/713 selftests/bpf: Fix the flaky tc_redirect_dtime test
In reply to Sasha LevinFrom: Martin KaFai Lau <[email protected]>
[ Upstream commit 177f1d083a19af58f4b1206d299ed73689249fd8 ]
BPF CI has been reporting the tc_redirect_dtime test failing from time to time:
test_inet_dtime:PASS:setns src 0 nsec
(network_helpers.c:253: errno: No route to host) Failed to connect to server close_netns:PASS:setns 0 nsec
test_inet_dtime:FAIL:connect_to_fd unexpected connect_to_fd: actual -1 < expected 0 test_tcp_clear_dtime:PASS:tcp ip6 clear dtime ingress_fwdns_p100 0 nsec
The connect_to_fd failure (EHOSTUNREACH) is from the test_tcp_clear_dtime() test and it is the very first IPv6 traffic after setting up all the links, addresses, and routes.
The symptom is this first connect() is always slow. In my setup, it could take ~3s.
After some tracing and tcpdump, the slowness is mostly spent in the neighbor solicitation in the "ns_fwd" namespace while the "ns_src" and "ns_dst" are fine.
I forced the kernel to drop the neighbor solicitation messages. I can then reproduce EHOSTUNREACH. What actually happen could be:
- the neighbor advertisement came back a little slow.
- the "ns_fwd" namespace concluded a neighbor discovery failure and triggered the ndisc_error_report() => ip6_link_failure() => icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_ADDR_UNREACH, 0)
- the client's connect() reports EHOSTUNREACH after receiving the ICMPV6_DEST_UNREACH message.
The neigh table of both "ns_src" and "ns_dst" namespace has already been manually populated but not the "ns_fwd" namespace. This patch fixes it by manually populating the neigh table also in the "ns_fwd" namespace.
Although the namespace configuration part had been existed before the tc_redirect_dtime test, still Fixes-tagging the patch when the tc_redirect_dtime test was added since it is the only test hitting it so far.
--- tools/testing/selftests/bpf/prog_tests/tc_redirect.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
tools/testing/selftests/bpf/prog_tests/tc_redirect.c +11 -0
@@ -188,6 +188,7 @@ static int netns_setup_links_and_routes(struct netns_setup_result *result) {struct nstoken *nstoken =NULL ;char src_fwd_addr[IFADDR_STR_LEN +1 ] = {}; +char src_addr[IFADDR_STR_LEN +1 ] = {};int err;if (result->dev_mode ==MODE_VETH ) {
@@ -208,6 +209,9 @@ static int netns_setup_links_and_routes(struct netns_setup_result *result)if (get_ifaddr ("src_fwd" , src_fwd_addr)) goto fail; +if (get_ifaddr ("src" , src_addr)) + goto fail; + result->ifindex_src =if_nametoindex ("src" );if (!ASSERT_GT (result->ifindex_src,0 ,"ifindex_src" )) goto fail;
@@ -270,6 +274,13 @@ static int netns_setup_links_and_routes(struct netns_setup_result *result)SYS (fail,"ip route add " IP4_DST "/32 dev dst_fwd scope global" );SYS (fail,"ip route add " IP6_DST "/128 dev dst_fwd scope global" ); +if (result->dev_mode ==MODE_VETH ) { +SYS (fail,"ip neigh add " IP4_SRC " dev src_fwd lladdr %s" , src_addr); +SYS (fail,"ip neigh add " IP6_SRC " dev src_fwd lladdr %s" , src_addr); +SYS (fail,"ip neigh add " IP4_DST " dev dst_fwd lladdr %s" ,MAC_DST ); +SYS (fail,"ip neigh add " IP6_DST " dev dst_fwd lladdr %s" ,MAC_DST ); + } +close_netns (nstoken);/** setup in 'dst' namespace */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 160/713 selftests/bpf: Wait for the netstamp_needed_key static key to be turned on
In reply to Sasha LevinFrom: Martin KaFai Lau <[email protected]>
[ Upstream commit ce6f6cffaeaa0a3bcdafcae7fe03c68c3afae631 ]
After the previous patch that speeded up the test (by avoiding neigh discovery in IPv6), the BPF CI occasionally hits this error:
rcv tstamp unexpected pkt rcv tstamp: actual 0 == expected 0
The test complains about the cmsg returned from the recvmsg() does not have the rcv timestamp. Setting skb->tstamp or not is controlled by a kernel static key "netstamp_needed_key". The static key is enabled whenever this is at least one sk with the SOCK_TIMESTAMP set.
The test_redirect_dtime does use setsockopt() to turn on
the SOCK_TIMESTAMP for the reading sk. In the kernel net_enable_timestamp() has a delay to enable the "netstamp_needed_key" when CONFIG_JUMP_LABEL is set. This potential delay is the likely reason for packet missing rcv timestamp occasionally.
This patch is to create udp sockets with SOCK_TIMESTAMP set. It sends and receives some packets until the received packet has a rcv timestamp. It currently retries at most 5 times with 1s in between. This should be enough to wait for the "netstamp_needed_key". It then holds on to the socket and only closes it at the end of the test. This guarantees that the test has the "netstamp_needed_key" key turned on from the beginning.
To simplify the udp sockets setup, they are sending/receiving packets in the same netns (ns_dst is used) and communicate over the "lo" dev. Hence, the patch enables the "lo" dev in the ns_dst.
--- .../selftests/bpf/prog_tests/tc_redirect.c | 79 ++++++++++++++++++- 1 file changed, 75 insertions(+), 4 deletions(-)
tools/testing/selftests/bpf/prog_tests/tc_redirect.c +75 -4
@@ -291,6 +291,7 @@ static int netns_setup_links_and_routes(struct netns_setup_result *result)SYS (fail,"ip addr add " IP4_DST "/32 dev dst" );SYS (fail,"ip addr add " IP6_DST "/128 dev dst nodad" );SYS (fail,"ip link set dev dst up" ); +SYS (fail,"ip link set dev lo up" );SYS (fail,"ip route add " IP4_SRC "/32 dev dst scope global" );SYS (fail,"ip route add " IP4_NET "/16 dev dst scope global" );
@@ -468,7 +469,7 @@ static int set_forwarding(bool enable)return 0 ; } -static void rcv_tstamp (int fd,const char *expected,size_t s) +static int __rcv_tstamp (int fd,const char *expected,size_t s,__u64 *tstamp) {struct __kernel_timespec pkt_ts = {};char ctl[CMSG_SPACE (sizeof (pkt_ts))];
@@ -489,7 +490,7 @@ static void rcv_tstamp(int fd, const char *expected, size_t s) ret =recvmsg (fd, &msg,0 );if (!ASSERT_EQ (ret, s,"recvmsg" )) -return ; +return -1 ;ASSERT_STRNEQ (data, expected, s,"expected rcv data" ); cmsg =CMSG_FIRSTHDR (&msg);
@@ -498,6 +499,12 @@ static void rcv_tstamp(int fd, const char *expected, size_t s)memcpy (&pkt_ts,CMSG_DATA (cmsg),sizeof (pkt_ts)); pkt_ns = pkt_ts.tv_sec *NSEC_PER_SEC + pkt_ts.tv_nsec; +if (tstamp) { +/* caller will check the tstamp itself */ + *tstamp = pkt_ns; +return 0 ; + } +ASSERT_NEQ (pkt_ns,0 ,"pkt rcv tstamp" ); ret =clock_gettime (CLOCK_REALTIME , &now_ts);
@@ -507,6 +514,60 @@ static void rcv_tstamp(int fd, const char *expected, size_t s)if (ASSERT_GE (now_ns, pkt_ns,"check rcv tstamp" ))ASSERT_LT (now_ns - pkt_ns,5 *NSEC_PER_SEC ,"check rcv tstamp" ); +return 0 ; +} + +static void rcv_tstamp (int fd,const char *expected,size_t s) +{ +__rcv_tstamp (fd, expected, s,NULL ); +} + +static int wait_netstamp_needed_key (void ) +{ +int opt =1 , srv_fd =-1 , cli_fd =-1 , nretries =0 , err, n; +char buf[] ="testing testing" ; +struct nstoken *nstoken; +__u64 tstamp =0 ; + + nstoken =open_netns (NS_DST ); +if (!nstoken) +return -1 ; + + srv_fd =start_server (AF_INET6 ,SOCK_DGRAM ,"::1" ,0 ,0 ); +if (!ASSERT_GE (srv_fd,0 ,"start_server" )) + goto done; + + err =setsockopt (srv_fd,SOL_SOCKET ,SO_TIMESTAMPNS_NEW , + &opt,sizeof (opt)); +if (!ASSERT_OK (err,"setsockopt(SO_TIMESTAMPNS_NEW)" )) + goto done; + + cli_fd =connect_to_fd (srv_fd,TIMEOUT_MILLIS ); +if (!ASSERT_GE (cli_fd,0 ,"connect_to_fd" )) + goto done; + +again: + n =write (cli_fd, buf,sizeof (buf)); +if (!ASSERT_EQ (n,sizeof (buf),"send to server" )) + goto done; + err =__rcv_tstamp (srv_fd, buf,sizeof (buf), &tstamp); +if (!ASSERT_OK (err,"__rcv_tstamp" )) + goto done; +if (!tstamp && nretries++ <5 ) { +sleep (1 ); +printf ("netstamp_needed_key retry#%d\n" , nretries); + goto again; + } + +done: +if (!tstamp && srv_fd !=-1 ) { +close (srv_fd); + srv_fd =-1 ; + } +if (cli_fd !=-1 ) +close (cli_fd); +close_netns (nstoken); +return srv_fd; }static void snd_tstamp (int fd,char *b,size_t s)
@@ -843,11 +904,20 @@ static void test_tc_redirect_dtime(struct netns_setup_result *setup_result) {struct test_tc_dtime *skel;struct nstoken *nstoken; -int err; +int hold_tstamp_fd, err; + +/* Hold a sk with the SOCK_TIMESTAMP set to ensure there +* is no delay in the kernel net_enable_timestamp(). +* This ensures the following tests must have +* non zero rcv tstamp in the recvmsg(). +*/ + hold_tstamp_fd =wait_netstamp_needed_key (); +if (!ASSERT_GE (hold_tstamp_fd,0 ,"wait_netstamp_needed_key" )) +return ; skel =test_tc_dtime__open ();if (!ASSERT_OK_PTR (skel,"test_tc_dtime__open" )) -return ; + goto done; skel->rodata->IFINDEX_SRC = setup_result->ifindex_src_fwd; skel->rodata->IFINDEX_DST = setup_result->ifindex_dst_fwd;
@@ -892,6 +962,7 @@ static void test_tc_redirect_dtime(struct netns_setup_result *setup_result) done:test_tc_dtime__destroy (skel); +close (hold_tstamp_fd); }static void test_tc_redirect_neigh_fib (struct netns_setup_result *setup_result)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 161/713 wifi: mac80211: use deflink and fix typo in link ID check
In reply to Sasha LevinFrom: Benjamin Berg <[email protected]>
[ Upstream commit e10322810ce0d0d4a5a319458c4e1e052c6fe9be ]
This does not change anything effectively, but it is closer to what the code is trying to achieve here. i.e. select the link data if it is an MLD and fall back to using the deflink otherwise.
--- net/mac80211/mlme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/mac80211/mlme.c +2 -2
@@ -7502,10 +7502,10 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,if (err) goto err_clear; -if (req->link_id >0 ) +if (req->link_id >=0 ) link =sdata_dereference (sdata->link[req->link_id], sdata);else - link =sdata_dereference (sdata->link[0 ], sdata); + link = &sdata->deflink;if (WARN_ON (!link)) { err = -ENOLINK ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 162/713 wifi: iwlwifi: change link id in time event to s8
In reply to Sasha LevinFrom: Miri Korenblit <[email protected]>
[ Upstream commit 6c8ce23854b66db94d88e0957e531cb074806c16 ]
Link ID in time event data is -1 when the time event is cleared. Change the type of the link ID in the time event data structure and in the affected function from unsigned to signed.
--- drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/time-event.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +1 -1
@@ -121,7 +121,7 @@ struct iwl_mvm_time_event_data {* if the te is in the time event list or not (when id == TE_MAX) */ u32 id; -u8 link_id; +s8 link_id; };/* Power management */
drivers/net/wireless/intel/iwlwifi/mvm/time-event.c +4 -4
@@ -692,7 +692,7 @@ void iwl_mvm_protect_session(struct iwl_mvm *mvm,/* Determine whether mac or link id should be used, and validate the link id */ static int iwl_mvm_get_session_prot_id (struct iwl_mvm *mvm,struct ieee80211_vif *vif, -u32 link_id) +s8 link_id) {struct iwl_mvm_vif *mvmvif =iwl_mvm_vif_from_mac80211 (vif); int ver = iwl_fw_lookup_cmd_ver(mvm->fw,
@@ -716,7 +716,7 @@ static int iwl_mvm_get_session_prot_id(struct iwl_mvm *mvm,static void iwl_mvm_cancel_session_protection (struct iwl_mvm *mvm,struct ieee80211_vif *vif, -u32 id,u32 link_id) +u32 id,s8 link_id) {int mac_link_id =iwl_mvm_get_session_prot_id (mvm, vif, link_id);struct iwl_mvm_session_prot_cmd cmd = {
@@ -745,7 +745,7 @@ static bool __iwl_mvm_remove_time_event(struct iwl_mvm *mvm,struct ieee80211_vif *vif = te_data->vif;struct iwl_mvm_vif *mvmvif;enum nl80211_iftype iftype; -unsigned int link_id; +s8 link_id;if (!vif)return false;
@@ -1297,7 +1297,7 @@ void iwl_mvm_schedule_session_protection(struct iwl_mvm *mvm,struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data;const u16 notif[] = {WIDE_ID (MAC_CONF_GROUP ,SESSION_PROTECTION_NOTIF ) };struct iwl_notification_wait wait_notif; -int mac_link_id =iwl_mvm_get_session_prot_id (mvm, vif, link_id); +int mac_link_id =iwl_mvm_get_session_prot_id (mvm, vif, (s8 )link_id);struct iwl_mvm_session_prot_cmd cmd = { .id_and_color =cpu_to_le32 (mac_link_id), .action =cpu_to_le32 (FW_CTXT_ACTION_ADD ),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 163/713 af_unix: Annotate data-race of gc_in_progress in wait_for_unix_gc().
In reply to Sasha LevinFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 31e03207119a535d0b0e3b3a7f91983aeb2cb14d ]
gc_in_progress is changed under spin_lock(&unix_gc_lock), but wait_for_unix_gc() reads it locklessly.
Let's use READ_ONCE().
--- net/unix/garbage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/unix/garbage.c +1 -1
@@ -198,7 +198,7 @@ void wait_for_unix_gc(void)if (READ_ONCE (unix_tot_inflight) >UNIX_INFLIGHT_TRIGGER_GC && !READ_ONCE (gc_in_progress))unix_gc (); -wait_event (unix_gc_wait, gc_in_progress == false); +wait_event (unix_gc_wait, !READ_ONCE (gc_in_progress)); }/* The external entry point: unix_gc() */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 164/713 arm64: dts: qcom: sm8450: Add missing interconnects to serial
In reply to Sasha LevinFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 6e115b75b43bd12d4061e53c8ff175e387783d8a ]
The serial ports did not have their interconnect paths specified when they were first introduced. Fix that.
--- arch/arm64/boot/dts/qcom/sm8450.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/arm64/boot/dts/qcom/sm8450.dtsi +12 -0
@@ -1026,6 +1026,12 @@ uart20: serial@894000 { pinctrl-names = "default"; pinctrl-0 = <&qup_uart20_default>; interrupts = <GIC_SPI 587 IRQ_TYPE_LEVEL_HIGH>; + interconnects = <&clk_virt MASTER_QUP_CORE_2 QCOM_ICC_TAG_ALWAYS + &clk_virt SLAVE_QUP_CORE_2 QCOM_ICC_TAG_ALWAYS>, + <&gem_noc MASTER_APPSS_PROC QCOM_ICC_TAG_ALWAYS + &config_noc SLAVE_QUP_2 QCOM_ICC_TAG_ALWAYS>; + interconnect-names = "qup-core", + "qup-config"; status = "disabled"; };
@@ -1418,6 +1424,12 @@ uart7: serial@99c000 { pinctrl-names = "default"; pinctrl-0 = <&qup_uart7_tx>, <&qup_uart7_rx>; interrupts = <GIC_SPI 608 IRQ_TYPE_LEVEL_HIGH>; + interconnects = <&clk_virt MASTER_QUP_CORE_2 QCOM_ICC_TAG_ALWAYS + &clk_virt SLAVE_QUP_CORE_2 QCOM_ICC_TAG_ALWAYS>, + <&gem_noc MASTER_APPSS_PROC QCOM_ICC_TAG_ALWAYS + &config_noc SLAVE_QUP_2 QCOM_ICC_TAG_ALWAYS>; + interconnect-names = "qup-core", + "qup-config"; status = "disabled"; }; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 165/713 soc: qcom: socinfo: rename PM2250 to PM4125
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 5155e48128826d0c5999dc9f47aa746df54da448 ]
It seems, the only actual mentions of PM2250 can be found are related to the Qualcomm RB1 platform. However even RB1 schematics use PM4125 as a PMIC name. Rename PM2250 to PM4125 to follow the documentation.
--- drivers/soc/qcom/socinfo.c | 2 +- include/soc/qcom/qcom-spmi-pmic.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/soc/qcom/socinfo.c +1 -1
@@ -114,7 +114,7 @@ static const char *const pmic_models[] = { [50] = "PM8350B", [51] = "PMR735A", [52] = "PMR735B", - [55] = "PM2250", + [55] = "PM4125", [58] = "PM8450", [65] = "PM8010", [69] = "PM8550VS",
include/soc/qcom/qcom-spmi-pmic.h +1 -1
@@ -48,7 +48,7 @@#define PMK8350_SUBTYPE 0x2f#define PMR735B_SUBTYPE 0x34#define PM6350_SUBTYPE 0x36 -#define PM2250_SUBTYPE 0x37 +#define PM4125_SUBTYPE 0x37#define PMI8998_FAB_ID_SMIC 0x11#define PMI8998_FAB_ID_GF 0x30
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 166/713 arm64: dts: qcom: sdm845-oneplus-common: improve DAI node naming
In reply to Sasha LevinFrom: David Heidelberg <[email protected]>
[ Upstream commit afe9867a0c0e10ba618c15d4ef6f8699872f6cc3 ]
Make it easier to understand what the reg in those nodes is by using the constants provided by qcom,q6dsp-lpass-ports.h.
Name nodes according to dt-binding expectations.
Fix for
```
arch/arm64/boot/dts/qcom/sdm845-oneplus-enchilada.dtb: service@4: dais: Unevaluated properties are not allowed ('qi2s@22', 'qi2s@23' were unexpected)
```--- arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi +4 -4
@@ -485,13 +485,13 @@ &pmi8998_charger { }; &q6afedai { - qi2s@22 { - reg = <22>; + dai@22 { + reg = <QUATERNARY_MI2S_RX>; qcom,sd-lines = <1>; }; - qi2s@23 { - reg = <23>; + dai@23 { + reg = <QUATERNARY_MI2S_TX>; qcom,sd-lines = <0>; }; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 167/713 cpufreq: mediatek-hw: Don't error out if supply is not found
In reply to Sasha LevinFrom: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit eaffb10b51bf74415c9252fd8fb4dd77122501ee ]
devm_regulator_get_optional() returns -ENODEV if no supply can be found. By introducing its usage, commit 788715b5f21c ("cpufreq: mediatek-hw:
Wait for CPU supplies before probing") caused the driver to fail probe if no supply was present in any of the CPU DT nodes.
Use devm_regulator_get() instead since the CPUs do require supplies even if not described in the DT. It will gracefully return a dummy regulator if none is found in the DT node, allowing probe to succeed.
--- drivers/cpufreq/mediatek-cpufreq-hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/mediatek-cpufreq-hw.c +1 -1
@@ -312,7 +312,7 @@ static int mtk_cpufreq_hw_driver_probe(struct platform_device *pdev)return dev_err_probe (&pdev->dev, -EPROBE_DEFER ,"Failed to get cpu%d device\n" , cpu); - cpu_reg =devm_regulator_get_optional (cpu_dev,"cpu" ); + cpu_reg =devm_regulator_get (cpu_dev,"cpu" );if (IS_ERR (cpu_reg))return dev_err_probe (&pdev->dev,PTR_ERR (cpu_reg),"CPU%d regulator get failed\n" , cpu);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 168/713 libbpf: Fix faccessat() usage on Android
In reply to Sasha LevinFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit ad57654053805bf9a62602aaec74cc78edb6f235 ]
Android implementation of libc errors out with -EINVAL in faccessat() if passed AT_EACCESS ([0]), this leads to ridiculous issue with libbpf refusing to load /sys/kernel/btf/vmlinux on Androids ([1]). Fix by detecting Android and redefining AT_EACCESS to 0, it's equivalent on Android.
[0] https://android.googlesource.com/platform/bionic/+/refs/heads/android13-release/libc/bionic/faccessat.cpp#50
[1] https://github.com/libbpf/libbpf-bootstrap/issues/250#issuecomment-1911324250
--- tools/lib/bpf/libbpf_internal.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
tools/lib/bpf/libbpf_internal.h +14 -0
@@ -18,6 +18,20 @@#include <libelf.h> #include "relo_core.h" +/* Android's libc doesn't support AT_EACCESS in faccessat() implementation +* ([0]), and just returns -EINVAL even if file exists and is accessible. +* See [1] for issues caused by this. +* +* So just redefine it to 0 on Android. +* +* [0] https://android.googlesource.com/platform/bionic/+/refs/heads/android13-release/libc/bionic/faccessat.cpp#50 +* [1] https://github.com/libbpf/libbpf-bootstrap/issues/250#issuecomment-1911324250 +*/ +#ifdef __ANDROID__ +#undef AT_EACCESS +#define AT_EACCESS 0 +#endif +/* make sure libbpf doesn't use kernel-only integer typedefs */ #pragma GCC poison u8 u16 u32 u64 s8 s16 s32 s64
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 169/713 pmdomain: qcom: rpmhpd: Drop SA8540P gfx.lvl
In reply to Sasha LevinFrom: Bjorn Andersson <[email protected]>
[ Upstream commit 883957bee580b723fd87d49ac73e0c84fc03a446 ]
On SA8295P and SA8540P gfx.lvl is not provdied by rpmh, but rather is handled by an external regulator (max20411). Drop gfx.lvl from the list of power-domains exposed on this platform.
--- drivers/pmdomain/qcom/rpmhpd.c | 1 - 1 file changed, 1 deletion(-)
drivers/pmdomain/qcom/rpmhpd.c +0 -1
@@ -217,7 +217,6 @@ static struct rpmhpd *sa8540p_rpmhpds[] = { [SC8280XP_CX] = &cx, [SC8280XP_CX_AO] = &cx_ao, [SC8280XP_EBI] = &ebi, - [SC8280XP_GFX] = &gfx, [SC8280XP_LCX] = &lcx, [SC8280XP_LMX] = &lmx, [SC8280XP_MMCX] = &mmcx,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 170/713 arm64: dts: qcom: sa8540p: Drop gfx.lvl as power-domain for gpucc
In reply to Sasha LevinFrom: Bjorn Andersson <[email protected]>
[ Upstream commit fd5821a1a83c969ed2dcc72fef885f3a82c1d978 ]
The SA8295P and SA8540P uses an external regulator (max20411), and gfx.lvl is not provided by rpmh. Drop the power-domains property of the gpucc node to reflect this.
--- arch/arm64/boot/dts/qcom/sa8540p.dtsi | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/qcom/sa8540p.dtsi +3 -0
@@ -168,6 +168,9 @@ opp-2592000000 { }; &gpucc { + /* SA8295P and SA8540P doesn't provide gfx.lvl */ + /delete-property/ power-domains; + status = "disabled"; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 171/713 arm64: dts: renesas: r8a779g0: Restore sort order
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 8b93657c976a61726d7ffbe8d019b84b4abfb673 ]
Numerical by unit address, alphabetical by node name.
Stable-dep-of: 08e799f6bce8 ("arm64: dts: renesas: r8a779g0: Add missing SCIF_CLK2")
--- arch/arm64/boot/dts/renesas/r8a779g0.dtsi | 72 +++++++++++------------ 1 file changed, 36 insertions(+), 36 deletions(-)
arch/arm64/boot/dts/renesas/r8a779g0.dtsi +36 -36
@@ -161,11 +161,6 @@ L3_CA76_1: cache-controller-1 { }; }; - psci { - compatible = "arm,psci-1.0", "arm,psci-0.2"; - method = "smc"; - }; - extal_clk: extal { compatible = "fixed-clock"; #clock-cells = <0>;
@@ -185,6 +180,11 @@ pmu_a76 { interrupts-extended = <&gic GIC_PPI 7 IRQ_TYPE_LEVEL_LOW>; }; + psci { + compatible = "arm,psci-1.0", "arm,psci-0.2"; + method = "smc"; + }; + /* External SCIF clock - to be overridden by boards that provide it */ scif_clk: scif { compatible = "fixed-clock";
@@ -1777,6 +1777,37 @@ ssi0: ssi-0 { }; }; + mmc0: mmc@ee140000 { + compatible = "renesas,sdhi-r8a779g0", + "renesas,rcar-gen4-sdhi"; + reg = <0 0xee140000 0 0x2000>; + interrupts = <GIC_SPI 440 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cpg CPG_MOD 706>, + <&cpg CPG_CORE R8A779G0_CLK_SD0H>; + clock-names = "core", "clkh"; + power-domains = <&sysc R8A779G0_PD_ALWAYS_ON>; + resets = <&cpg 706>; + max-frequency = <200000000>; + iommus = <&ipmmu_ds0 32>; + status = "disabled"; + }; + + rpc: spi@ee200000 { + compatible = "renesas,r8a779g0-rpc-if", + "renesas,rcar-gen4-rpc-if"; + reg = <0 0xee200000 0 0x200>, + <0 0x08000000 0 0x04000000>, + <0 0xee208000 0 0x100>; + reg-names = "regs", "dirmap", "wbuf"; + interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cpg CPG_MOD 629>; + power-domains = <&sysc R8A779G0_PD_ALWAYS_ON>; + resets = <&cpg 629>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + ipmmu_rt0: iommu@ee480000 { compatible = "renesas,ipmmu-r8a779g0", "renesas,rcar-gen4-ipmmu-vmsa";
@@ -1886,37 +1917,6 @@ ipmmu_mm: iommu@eefc0000 { #iommu-cells = <1>; }; - mmc0: mmc@ee140000 { - compatible = "renesas,sdhi-r8a779g0", - "renesas,rcar-gen4-sdhi"; - reg = <0 0xee140000 0 0x2000>; - interrupts = <GIC_SPI 440 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&cpg CPG_MOD 706>, - <&cpg CPG_CORE R8A779G0_CLK_SD0H>; - clock-names = "core", "clkh"; - power-domains = <&sysc R8A779G0_PD_ALWAYS_ON>; - resets = <&cpg 706>; - max-frequency = <200000000>; - iommus = <&ipmmu_ds0 32>; - status = "disabled"; - }; - - rpc: spi@ee200000 { - compatible = "renesas,r8a779g0-rpc-if", - "renesas,rcar-gen4-rpc-if"; - reg = <0 0xee200000 0 0x200>, - <0 0x08000000 0 0x04000000>, - <0 0xee208000 0 0x100>; - reg-names = "regs", "dirmap", "wbuf"; - interrupts = <GIC_SPI 225 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&cpg CPG_MOD 629>; - power-domains = <&sysc R8A779G0_PD_ALWAYS_ON>; - resets = <&cpg 629>; - #address-cells = <1>; - #size-cells = <0>; - status = "disabled"; - }; - gic: interrupt-controller@f1000000 { compatible = "arm,gic-v3"; #interrupt-cells = <3>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 172/713 arm64: dts: renesas: r8a779g0: Add missing SCIF_CLK2
In reply to Sasha LevinFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 08e799f6bce80dd63c174d8d0fc61d1a6149960b ]
R-Car V4H actually has two SCIF_CLK pins.
The second pin provides the SCIF_CLK signal for HSCIF2 and SCIF4.
--- arch/arm64/boot/dts/renesas/r8a779g0.dtsi | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/renesas/r8a779g0.dtsi +9 -3
@@ -185,13 +185,19 @@ psci { method = "smc"; }; - /* External SCIF clock - to be overridden by boards that provide it */ + /* External SCIF clocks - to be overridden by boards that provide them */ scif_clk: scif { compatible = "fixed-clock"; #clock-cells = <0>; clock-frequency = <0>; }; + scif_clk2: scif2 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <0>; + }; + soc: soc { compatible = "simple-bus"; interrupt-parent = <&gic>;
@@ -681,7 +687,7 @@ hscif2: serial@e6560000 { interrupts = <GIC_SPI 248 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cpg CPG_MOD 516>, <&cpg CPG_CORE R8A779G0_CLK_SASYNCPERD1>, - <&scif_clk>; + <&scif_clk2>; clock-names = "fck", "brg_int", "scif_clk"; dmas = <&dmac0 0x35>, <&dmac0 0x34>, <&dmac1 0x35>, <&dmac1 0x34>;
@@ -1057,7 +1063,7 @@ scif4: serial@e6c40000 { interrupts = <GIC_SPI 254 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cpg CPG_MOD 705>, <&cpg CPG_CORE R8A779G0_CLK_SASYNCPERD1>, - <&scif_clk>; + <&scif_clk2>; clock-names = "fck", "brg_int", "scif_clk"; dmas = <&dmac0 0x59>, <&dmac0 0x58>, <&dmac1 0x59>, <&dmac1 0x58>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 173/713 selftests/bpf: Disable IPv6 for lwt_redirect test
In reply to Sasha LevinFrom: Manu Bretelle <[email protected]>
[ Upstream commit 2ef61296d2844c6a4211e07ab70ef2fb412b2c30 ]
After a recent change in the vmtest runner, this test started failing sporadically.
Investigation showed that this test was subject to race condition which got exacerbated after the vm runner change. The symptoms being that the logic that waited for an ICMPv4 packet is naive and will break if 5 or more non-ICMPv4 packets make it to tap0.
When ICMPv6 is enabled, the kernel will generate traffic such as ICMPv6 router solicitation...
On a system with good performance, the expected ICMPv4 packet would very likely make it to the network interface promptly, but on a system with poor performance, those "guarantees" do not hold true anymore.
Given that the test is IPv4 only, this change disable IPv6 in the test netns by setting net.ipv6.conf.all.disable_ipv6 to 1. This essentially leaves "ping" as the sole generator of traffic in the network namespace.
If this test was to be made IPv6 compatible, the logic in wait_for_packet would need to be modified.
In more details...
At a high level, the test does:
- create a new namespace
- in setup_redirect_target set up lo, tap0, and link_err interfaces as well as add 2 routes that attaches ingress/egress sections of test_lwt_redirect.bpf.o to the xmit path.
- in send_and_capture_test_packets send an ICMP packet and read off the tap interface (using wait_for_packet) to check that a ICMP packet with the right size is read.
wait_for_packet will try to read max_retry (5) times from the tap0 fd looking for an ICMPv4 packet matching some criteria.
The problem is that when we set up the tap0 interface, because IPv6 is enabled by default, traffic such as Router solicitation is sent through tap0, as in:
# tcpdump -r /tmp/lwt_redirect.pc reading from file /tmp/lwt_redirect.pcap, link-type EN10MB (Ethernet) 04:46:23.578352 IP6 :: > ff02::1:ffc0:4427: ICMP6, neighbor solicitation, who has fe80::fcba:dff:fec0:4427, length 32 04:46:23.659522 IP6 :: > ff02::16: HBH ICMP6, multicast listener report v2, 1 group record(s), length 28 04:46:24.389169 IP 10.0.0.1 > 20.0.0.9: ICMP echo request, id 122, seq 1, length 108 04:46:24.618599 IP6 fe80::fcba:dff:fec0:4427 > ff02::16: HBH ICMP6, multicast listener report v2, 1 group record(s), length 28 04:46:24.619985 IP6 fe80::fcba:dff:fec0:4427 > ff02::2: ICMP6, router solicitation, length 16 04:46:24.767326 IP6 fe80::fcba:dff:fec0:4427 > ff02::16: HBH ICMP6, multicast listener report v2, 1 group record(s), length 28 04:46:28.936402 IP6 fe80::fcba:dff:fec0:4427 > ff02::2: ICMP6, router solicitation, length 16
If wait_for_packet sees 5 non-ICMPv4 packets, it will return 0, which is what we see in:
2024-01-31T03:51:25.0336992Z test_lwt_redirect_run:PASS:netns_create 0 nsec 2024-01-31T03:51:25.0341309Z open_netns:PASS:malloc token 0 nsec 2024-01-31T03:51:25.0344844Z open_netns:PASS:open /proc/self/ns/net 0 nsec 2024-01-31T03:51:25.0350071Z open_netns:PASS:open netns fd 0 nsec 2024-01-31T03:51:25.0353516Z open_netns:PASS:setns 0 nsec 2024-01-31T03:51:25.0356560Z test_lwt_redirect_run:PASS:setns 0 nsec 2024-01-31T03:51:25.0360140Z open_tuntap:PASS:open(/dev/net/tun) 0 nsec 2024-01-31T03:51:25.0363822Z open_tuntap:PASS:ioctl(TUNSETIFF) 0 nsec 2024-01-31T03:51:25.0367402Z open_tuntap:PASS:fcntl(O_NONBLOCK) 0 nsec 2024-01-31T03:51:25.0371167Z setup_redirect_target:PASS:open_tuntap 0 nsec 2024-01-31T03:51:25.0375180Z setup_redirect_target:PASS:if_nametoindex 0 nsec 2024-01-31T03:51:25.0379929Z setup_redirect_target:PASS:ip link add link_err type dummy 0 nsec 2024-01-31T03:51:25.0384874Z setup_redirect_target:PASS:ip link set lo up 0 nsec 2024-01-31T03:51:25.0389678Z setup_redirect_target:PASS:ip addr add dev lo 10.0.0.1/32 0 nsec 2024-01-31T03:51:25.0394814Z setup_redirect_target:PASS:ip link set link_err up 0 nsec 2024-01-31T03:51:25.0399874Z setup_redirect_target:PASS:ip link set tap0 up 0 nsec 2024-01-31T03:51:25.0407731Z setup_redirect_target:PASS:ip route add 10.0.0.0/24 dev link_err encap bpf xmit obj test_lwt_redirect.bpf.o sec redir_ingress 0 nsec 2024-01-31T03:51:25.0419105Z setup_redirect_target:PASS:ip route add 20.0.0.0/24 dev link_err encap bpf xmit obj test_lwt_redirect.bpf.o sec redir_egress 0 nsec 2024-01-31T03:51:25.0427209Z test_lwt_redirect_normal:PASS:setup_redirect_target 0 nsec 2024-01-31T03:51:25.0431424Z ping_dev:PASS:if_nametoindex 0 nsec 2024-01-31T03:51:25.0437222Z send_and_capture_test_packets:FAIL:wait_for_epacket unexpected wait_for_epacket: actual 0 != expected 1 2024-01-31T03:51:25.0448298Z (/tmp/work/bpf/bpf/tools/testing/selftests/bpf/prog_tests/lwt_redirect.c:175: errno: Success) test_lwt_redirect_normal egress test fails 2024-01-31T03:51:25.0457124Z close_netns:PASS:setns 0 nsec
When running in a VM which potential resource contrains, the odds that calling ping is not scheduled very soon after bringing tap0 up increases, and with this the chances to get our ICMP packet pushed to position 6+ in the network trace.
To confirm this indeed solves the issue, I ran the test 100 times in a row with:
errors=0
successes=0
for i in `seq 1 100`
do
./test_progs -t lwt_redirect/lwt_redirect_normal
if [ $? -eq 0 ]; then
successes=$((successes+1))
else
errors=$((errors+1))
fi
done
echo "successes: $successes/errors: $errors"While this test would at least fail a couple of time every 10 runs, here it ran 100 times with no error.
--- tools/testing/selftests/bpf/prog_tests/lwt_redirect.c | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/prog_tests/lwt_redirect.c +1 -0
@@ -203,6 +203,7 @@ static int setup_redirect_target(const char *target_dev, bool need_mac)if (!ASSERT_GE (target_index,0 ,"if_nametoindex" )) goto fail; +SYS (fail,"sysctl -w net.ipv6.conf.all.disable_ipv6=1" );SYS (fail,"ip link add link_err type dummy" );SYS (fail,"ip link set lo up" );SYS (fail,"ip addr add dev lo " LOCAL_SRC "/32" );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 174/713 arm64: dts: imx8mm-kontron: Disable pullups for I2C signals on OSM-S i.MX8MM
In reply to Sasha LevinFrom: Frieder Schrempf <[email protected]>
[ Upstream commit 96293af54f6aa859015d8ca40a1437d3115ad50c ]
There are external pullup resistors on the board and due to silicon errata ERR050080 let's disable the internal ones to prevent any unwanted behavior in case they wear out.
--- arch/arm64/boot/dts/freescale/imx8mm-kontron-bl-osm-s.dts | 4 ++-- arch/arm64/boot/dts/freescale/imx8mm-kontron-osm-s.dtsi | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/freescale/imx8mm-kontron-bl-osm-s.dts +2 -2
@@ -294,8 +294,8 @@ MX8MM_IOMUXC_SAI3_MCLK_GPIO5_IO2 0x19 pinctrl_i2c4: i2c4grp { fsl,pins = < - MX8MM_IOMUXC_I2C4_SCL_I2C4_SCL 0x400001c3 - MX8MM_IOMUXC_I2C4_SDA_I2C4_SDA 0x400001c3 + MX8MM_IOMUXC_I2C4_SCL_I2C4_SCL 0x40000083 + MX8MM_IOMUXC_I2C4_SDA_I2C4_SDA 0x40000083 >; };
arch/arm64/boot/dts/freescale/imx8mm-kontron-osm-s.dtsi +2 -2
@@ -252,8 +252,8 @@ MX8MM_IOMUXC_ECSPI1_SS0_GPIO5_IO9 0x19 pinctrl_i2c1: i2c1grp { fsl,pins = < - MX8MM_IOMUXC_I2C1_SCL_I2C1_SCL 0x400001c3 - MX8MM_IOMUXC_I2C1_SDA_I2C1_SDA 0x400001c3 + MX8MM_IOMUXC_I2C1_SCL_I2C1_SCL 0x40000083 + MX8MM_IOMUXC_I2C1_SDA_I2C1_SDA 0x40000083 >; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 175/713 arm64: dts: imx8mm-kontron: Disable pullups for I2C signals on SL/BL i.MX8MM
In reply to Sasha LevinFrom: Frieder Schrempf <[email protected]>
[ Upstream commit f19e5bb91d53264d7dac5d845a4825afadf72440 ]
There are external pullup resistors on the board and due to silicon errata ERR050080 let's disable the internal ones to prevent any unwanted behavior in case they wear out.
--- arch/arm64/boot/dts/freescale/imx8mm-kontron-bl.dts | 4 ++-- arch/arm64/boot/dts/freescale/imx8mm-kontron-sl.dtsi | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/freescale/imx8mm-kontron-bl.dts +2 -2
@@ -279,8 +279,8 @@ MX8MM_IOMUXC_SAI3_MCLK_GPIO5_IO2 0x19 pinctrl_i2c4: i2c4grp { fsl,pins = < - MX8MM_IOMUXC_I2C4_SCL_I2C4_SCL 0x400001c3 - MX8MM_IOMUXC_I2C4_SDA_I2C4_SDA 0x400001c3 + MX8MM_IOMUXC_I2C4_SCL_I2C4_SCL 0x40000083 + MX8MM_IOMUXC_I2C4_SDA_I2C4_SDA 0x40000083 >; };
arch/arm64/boot/dts/freescale/imx8mm-kontron-sl.dtsi +2 -2
@@ -237,8 +237,8 @@ MX8MM_IOMUXC_ECSPI1_SS0_GPIO5_IO9 0x19 pinctrl_i2c1: i2c1grp { fsl,pins = < - MX8MM_IOMUXC_I2C1_SCL_I2C1_SCL 0x400001c3 - MX8MM_IOMUXC_I2C1_SDA_I2C1_SDA 0x400001c3 + MX8MM_IOMUXC_I2C1_SCL_I2C1_SCL 0x40000083 + MX8MM_IOMUXC_I2C1_SDA_I2C1_SDA 0x40000083 >; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 176/713 arm64: dts: imx8mm-kontron: Disable pullups for onboard UART signals on BL OSM-S board
In reply to Sasha LevinFrom: Frieder Schrempf <[email protected]>
[ Upstream commit c6d9b5672a0e2c4b1079a50d2fc8780c40cfd3eb ]
These signals are actively driven by the SoC or by the onboard transceiver. There's no need to enable the internal pull resistors and due to silicon errata ERR050080 let's disable the internal ones to prevent any unwanted behavior in case they wear out.
--- .../dts/freescale/imx8mm-kontron-bl-osm-s.dts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
arch/arm64/boot/dts/freescale/imx8mm-kontron-bl-osm-s.dts +8 -8
@@ -313,19 +313,19 @@ MX8MM_IOMUXC_SAI5_MCLK_GPIO3_IO25 0x19 pinctrl_uart1: uart1grp { fsl,pins = < - MX8MM_IOMUXC_SAI2_RXC_UART1_DCE_RX 0x140 - MX8MM_IOMUXC_SAI2_RXFS_UART1_DCE_TX 0x140 - MX8MM_IOMUXC_SAI2_RXD0_UART1_DCE_RTS_B 0x140 - MX8MM_IOMUXC_SAI2_TXFS_UART1_DCE_CTS_B 0x140 + MX8MM_IOMUXC_SAI2_RXC_UART1_DCE_RX 0x0 + MX8MM_IOMUXC_SAI2_RXFS_UART1_DCE_TX 0x0 + MX8MM_IOMUXC_SAI2_RXD0_UART1_DCE_RTS_B 0x0 + MX8MM_IOMUXC_SAI2_TXFS_UART1_DCE_CTS_B 0x0 >; }; pinctrl_uart2: uart2grp { fsl,pins = < - MX8MM_IOMUXC_SAI3_TXFS_UART2_DCE_RX 0x140 - MX8MM_IOMUXC_SAI3_TXC_UART2_DCE_TX 0x140 - MX8MM_IOMUXC_SAI3_RXD_UART2_DCE_RTS_B 0x140 - MX8MM_IOMUXC_SAI3_RXC_UART2_DCE_CTS_B 0x140 + MX8MM_IOMUXC_SAI3_TXFS_UART2_DCE_RX 0x0 + MX8MM_IOMUXC_SAI3_TXC_UART2_DCE_TX 0x0 + MX8MM_IOMUXC_SAI3_RXD_UART2_DCE_RTS_B 0x0 + MX8MM_IOMUXC_SAI3_RXC_UART2_DCE_CTS_B 0x0 >; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 177/713 arm64: dts: imx8mm-kontron: Disable pullups for onboard UART signals on BL board
In reply to Sasha LevinFrom: Frieder Schrempf <[email protected]>
[ Upstream commit 162aadaa0df8217b0cc49d919dd00022fef65e78 ]
These signals are actively driven by the SoC or by the onboard transceiver. There's no need to enable the internal pull resistors and due to silicon errata ERR050080 let's disable the internal ones to prevent any unwanted behavior in case they wear out.
--- .../boot/dts/freescale/imx8mm-kontron-bl.dts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
arch/arm64/boot/dts/freescale/imx8mm-kontron-bl.dts +8 -8
@@ -292,19 +292,19 @@ MX8MM_IOMUXC_SPDIF_RX_PWM2_OUT 0x19 pinctrl_uart1: uart1grp { fsl,pins = < - MX8MM_IOMUXC_SAI2_RXC_UART1_DCE_RX 0x140 - MX8MM_IOMUXC_SAI2_RXFS_UART1_DCE_TX 0x140 - MX8MM_IOMUXC_SAI2_RXD0_UART1_DCE_RTS_B 0x140 - MX8MM_IOMUXC_SAI2_TXFS_UART1_DCE_CTS_B 0x140 + MX8MM_IOMUXC_SAI2_RXC_UART1_DCE_RX 0x0 + MX8MM_IOMUXC_SAI2_RXFS_UART1_DCE_TX 0x0 + MX8MM_IOMUXC_SAI2_RXD0_UART1_DCE_RTS_B 0x0 + MX8MM_IOMUXC_SAI2_TXFS_UART1_DCE_CTS_B 0x0 >; }; pinctrl_uart2: uart2grp { fsl,pins = < - MX8MM_IOMUXC_SAI3_TXFS_UART2_DCE_RX 0x140 - MX8MM_IOMUXC_SAI3_TXC_UART2_DCE_TX 0x140 - MX8MM_IOMUXC_SAI3_RXD_UART2_DCE_RTS_B 0x140 - MX8MM_IOMUXC_SAI3_RXC_UART2_DCE_CTS_B 0x140 + MX8MM_IOMUXC_SAI3_TXFS_UART2_DCE_RX 0x0 + MX8MM_IOMUXC_SAI3_TXC_UART2_DCE_TX 0x0 + MX8MM_IOMUXC_SAI3_RXD_UART2_DCE_RTS_B 0x0 + MX8MM_IOMUXC_SAI3_RXC_UART2_DCE_CTS_B 0x0 >; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 178/713 arm64: dts: imx8mm-kontron: Disable pull resistors for SD card signals on BL OSM-S board
In reply to Sasha LevinFrom: Frieder Schrempf <[email protected]>
[ Upstream commit 5a940ba3e4d7c8710c9073ff5d0ca4644d4da9db ]
Some signals have external pullup resistors on the board and don't need the internal ones to be enabled. Due to silicon errata ERR050080 let's disable the internal pull resistors whererever possible and prevent any unwanted behavior in case they wear out.
--- .../dts/freescale/imx8mm-kontron-bl-osm-s.dts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
arch/arm64/boot/dts/freescale/imx8mm-kontron-bl-osm-s.dts +9 -9
@@ -337,40 +337,40 @@ MX8MM_IOMUXC_NAND_CE1_B_GPIO3_IO2 0x19 pinctrl_usdhc2: usdhc2grp { fsl,pins = < - MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x190 + MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x90 MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD 0x1d0 MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0 0x1d0 MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1 0x1d0 MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d0 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d0 - MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 - MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 + MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x19 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0xd0 >; }; pinctrl_usdhc2_100mhz: usdhc2-100mhzgrp { fsl,pins = < - MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x194 + MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x94 MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD 0x1d4 MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0 0x1d4 MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1 0x1d4 MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d4 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d4 - MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 - MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 + MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x19 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0xd0 >; }; pinctrl_usdhc2_200mhz: usdhc2-200mhzgrp { fsl,pins = < - MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x196 + MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x96 MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD 0x1d6 MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0 0x1d6 MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1 0x1d6 MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d6 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d6 - MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 - MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 + MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x19 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0xd0 >; }; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 179/713 arm64: dts: imx8mm-kontron: Disable pull resistors for SD card signals on BL board
In reply to Sasha LevinFrom: Frieder Schrempf <[email protected]>
[ Upstream commit 008820524844326ffb3123cebceba1960c0ad0dc ]
Some signals have external pullup resistors on the board and don't need the internal ones to be enabled. Due to silicon errata ERR050080 let's disable the internal pull resistors whererever possible and prevent any unwanted behavior in case they wear out.
--- .../boot/dts/freescale/imx8mm-kontron-bl.dts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
arch/arm64/boot/dts/freescale/imx8mm-kontron-bl.dts +9 -9
@@ -316,40 +316,40 @@ MX8MM_IOMUXC_NAND_CE1_B_GPIO3_IO2 0x19 pinctrl_usdhc2: usdhc2grp { fsl,pins = < - MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x190 + MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x90 MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD 0x1d0 MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0 0x1d0 MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1 0x1d0 MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d0 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d0 - MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 - MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 + MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x19 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0xd0 >; }; pinctrl_usdhc2_100mhz: usdhc2-100mhzgrp { fsl,pins = < - MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x194 + MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x94 MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD 0x1d4 MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0 0x1d4 MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1 0x1d4 MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d4 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d4 - MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 - MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 + MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x19 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0xd0 >; }; pinctrl_usdhc2_200mhz: usdhc2-200mhzgrp { fsl,pins = < - MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x196 + MX8MM_IOMUXC_SD2_CLK_USDHC2_CLK 0x96 MX8MM_IOMUXC_SD2_CMD_USDHC2_CMD 0x1d6 MX8MM_IOMUXC_SD2_DATA0_USDHC2_DATA0 0x1d6 MX8MM_IOMUXC_SD2_DATA1_USDHC2_DATA1 0x1d6 MX8MM_IOMUXC_SD2_DATA2_USDHC2_DATA2 0x1d6 MX8MM_IOMUXC_SD2_DATA3_USDHC2_DATA3 0x1d6 - MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x019 - MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0x1d0 + MX8MM_IOMUXC_SD2_CD_B_GPIO2_IO12 0x19 + MX8MM_IOMUXC_GPIO1_IO04_USDHC2_VSELECT 0xd0 >; }; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 180/713 arm64: dts: imx8mm-kontron: Fix interrupt for RTC on OSM-S i.MX8MM module
In reply to Sasha LevinFrom: Frieder Schrempf <[email protected]>
[ Upstream commit 8d0f39b7d04d864e89b84063b124fd10aa4b8809 ]
The level of the interrupt signal is active low instead. Fix this.
--- arch/arm64/boot/dts/freescale/imx8mm-kontron-osm-s.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mm-kontron-osm-s.dtsi +1 -1
@@ -210,7 +210,7 @@ rv3028: rtc@52 { reg = <0x52>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_rtc>; - interrupts-extended = <&gpio4 1 IRQ_TYPE_LEVEL_HIGH>; + interrupts-extended = <&gpio4 1 IRQ_TYPE_LEVEL_LOW>; trickle-diode-disable; }; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 181/713 arm64: dts: imx8qm: Align edma3 power-domains resources indentation
In reply to Sasha LevinFrom: Frank Li <[email protected]>
[ Upstream commit 7edee2b297e5a4f805e5b945c0c0e6f4f8f719b5 ]
<&pd IMX_SC_R_DMA_1_CH*> is now properly aligned with the previous line for improved code readability.
Stable-dep-of: 5136ea6b109d ("arm64: dts: imx8qm: Correct edma3 power-domains and interrupt numbers")
--- arch/arm64/boot/dts/freescale/imx8qm-ss-dma.dtsi | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
arch/arm64/boot/dts/freescale/imx8qm-ss-dma.dtsi +7 -7
@@ -98,13 +98,13 @@ &edma2 { &edma3 { power-domains = <&pd IMX_SC_R_DMA_1_CH0>, - <&pd IMX_SC_R_DMA_1_CH1>, - <&pd IMX_SC_R_DMA_1_CH2>, - <&pd IMX_SC_R_DMA_1_CH3>, - <&pd IMX_SC_R_DMA_1_CH4>, - <&pd IMX_SC_R_DMA_1_CH5>, - <&pd IMX_SC_R_DMA_1_CH6>, - <&pd IMX_SC_R_DMA_1_CH7>; + <&pd IMX_SC_R_DMA_1_CH1>, + <&pd IMX_SC_R_DMA_1_CH2>, + <&pd IMX_SC_R_DMA_1_CH3>, + <&pd IMX_SC_R_DMA_1_CH4>, + <&pd IMX_SC_R_DMA_1_CH5>, + <&pd IMX_SC_R_DMA_1_CH6>, + <&pd IMX_SC_R_DMA_1_CH7>; }; &flexcan1 {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 182/713 arm64: dts: imx8qm: Correct edma3 power-domains and interrupt numbers
In reply to Sasha LevinFrom: Frank Li <[email protected]>
[ Upstream commit 5136ea6b109de66b1327a3069f88ad8f5efb37b2 ]
It is eDMA1 at QM, which have the same register with eDMA3 at qxp.
The below commit fix panic problem.
commit b37e75bddc35 ("arm64: dts: imx8qm: Add imx8qm's own pm to avoid panic during startup")
This fixes the IRQ and DMA channel numbers. While QM eDMA1 technically has 32 channels, only 10 channels are likely used for I2C. The exact IRQ numbers for the remaining channels were unclear in the reference manual.
--- .../arm64/boot/dts/freescale/imx8qm-ss-dma.dtsi | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8qm-ss-dma.dtsi +16 -1
@@ -96,7 +96,20 @@ &edma2 { status = "okay"; }; +/* It is eDMA1 in 8QM RM, but 8QXP it is eDMA3 */ &edma3 { + reg = <0x5a9f0000 0x210000>; + dma-channels = <10>; + interrupts = <GIC_SPI 424 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 425 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 426 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 427 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 428 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 429 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 430 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 431 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 432 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 433 IRQ_TYPE_LEVEL_HIGH>; power-domains = <&pd IMX_SC_R_DMA_1_CH0>, <&pd IMX_SC_R_DMA_1_CH1>, <&pd IMX_SC_R_DMA_1_CH2>,
@@ -104,7 +117,9 @@ &edma3 { <&pd IMX_SC_R_DMA_1_CH4>, <&pd IMX_SC_R_DMA_1_CH5>, <&pd IMX_SC_R_DMA_1_CH6>, - <&pd IMX_SC_R_DMA_1_CH7>; + <&pd IMX_SC_R_DMA_1_CH7>, + <&pd IMX_SC_R_DMA_1_CH8>, + <&pd IMX_SC_R_DMA_1_CH9>; }; &flexcan1 {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 183/713 libbpf: Add missing LIBBPF_API annotation to libbpf_set_memlock_rlim API
In reply to Sasha LevinFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 93ee1eb85e28d1e35bb059c1f5965d65d5fc83c2 ]
LIBBPF_API annotation seems missing on libbpf_set_memlock_rlim API, so add it to make this API callable from libbpf's shared library version.
--- tools/lib/bpf/bpf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/bpf.h +1 -1
@@ -35,7 +35,7 @@extern "C" {#endif -int libbpf_set_memlock_rlim (size_t memlock_bytes); +LIBBPF_API int libbpf_set_memlock_rlim(size_t memlock_bytes);struct bpf_map_create_opts {size_t sz;/* size of this struct for forward/backward compatibility */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 184/713 wifi: ath9k: delay all of ath9k_wmi_event_tasklet() until init is complete
In reply to Sasha LevinFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 24355fcb0d4cbcb6ddda262596558e8cfba70f11 ]
The ath9k_wmi_event_tasklet() used in ath9k_htc assumes that all the data structures have been fully initialised by the time it runs. However, because of the order in which things are initialised, this is not guaranteed to be the case, because the device is exposed to the USB subsystem before the ath9k driver initialisation is completed.
We already committed a partial fix for this in commit:8b3046abc99e ("ath9k_htc: fix NULL pointer dereference at ath9k_htc_tx_get_packet()")
However, that commit only aborted the WMI_TXSTATUS_EVENTID command in the event tasklet, pairing it with an "initialisation complete" bit in the TX struct. It seems syzbot managed to trigger the race for one of the other commands as well, so let's just move the existing synchronisation bit to cover the whole tasklet (setting it at the end of ath9k_htc_probe_device() instead of inside ath9k_tx_init()).
--- drivers/net/wireless/ath/ath9k/htc.h | 2 +- drivers/net/wireless/ath/ath9k/htc_drv_init.c | 4 ++++ drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 4 ---- drivers/net/wireless/ath/ath9k/wmi.c | 10 ++++++---- 4 files changed, 11 insertions(+), 9 deletions(-)
drivers/net/wireless/ath/ath9k/htc.h +1 -1
@@ -306,7 +306,6 @@ struct ath9k_htc_tx {DECLARE_BITMAP (tx_slot,MAX_TX_BUF_NUM );struct timer_list cleanup_timer;spinlock_t tx_lock; -bool initialized; };struct ath9k_htc_tx_ctl {
@@ -515,6 +514,7 @@ struct ath9k_htc_priv {unsigned long ps_usecount;bool ps_enabled;bool ps_idle; +bool initialized;#ifdef CONFIG_MAC80211_LEDS enum led_brightness brightness;
drivers/net/wireless/ath/ath9k/htc_drv_init.c +4 -0
@@ -966,6 +966,10 @@ int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev, htc_handle->drv_priv = priv; +/* Allow ath9k_wmi_event_tasklet() to operate. */ +smp_wmb (); + priv->initialized = true; +return 0 ; err_init:
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +0 -4
@@ -815,10 +815,6 @@ int ath9k_tx_init(struct ath9k_htc_priv *priv)skb_queue_head_init (&priv->tx.data_vo_queue);skb_queue_head_init (&priv->tx.tx_failed); -/* Allow ath9k_wmi_event_tasklet(WMI_TXSTATUS_EVENTID) to operate. */ -smp_wmb (); - priv->tx.initialized = true; -return 0 ; }
drivers/net/wireless/ath/ath9k/wmi.c +6 -4
@@ -155,6 +155,12 @@ void ath9k_wmi_event_tasklet(struct tasklet_struct *t) }spin_unlock_irqrestore (&wmi->wmi_lock, flags); +/* Check if ath9k_htc_probe_device() completed. */ +if (!data_race (priv->initialized)) { +kfree_skb (skb); +continue ; + } + hdr = (struct wmi_cmd_hdr *) skb->data; cmd_id =be16_to_cpu (hdr->command_id); wmi_event =skb_pull (skb,sizeof (struct wmi_cmd_hdr ));
@@ -169,10 +175,6 @@ void ath9k_wmi_event_tasklet(struct tasklet_struct *t) &wmi->drv_priv->fatal_work);break ;case WMI_TXSTATUS_EVENTID : -/* Check if ath9k_tx_init() completed. */ -if (!data_race (priv->tx.initialized)) -break ; -spin_lock_bh (&priv->tx.tx_lock);if (priv->tx.flags &ATH9K_HTC_OP_TX_DRAIN ) {spin_unlock_bh (&priv->tx.tx_lock);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 185/713 wifi: ath11k: change to move WMI_VDEV_PARAM_SET_HEMU_MODE before WMI_PEER_ASSOC_CMDID
In reply to Sasha LevinFrom: Wen Gong <[email protected]>
[ Upstream commit 413e20e82ee78f142cb5194fd317db514f012602 ]
Currently when connecting to an AP with 11AX-HE phy mode, host sends WMI_VDEV_PARAM_SET_HEMU_MODE parameter to firmware after WMI_PEER_ASSOC_CMDID command. This results in TXBF not working, because firmware calculates TXBF values while handling WMI_PEER_ASSOC_CMDID, however at that time WMI_VDEV_PARAM_SET_HEMU_MODE has not been sent yet. See below log:
AP sends "VHT/HE/EHT NDP Announcement" to station, and station sends "Action no Ack" of category code HE to AP, the "Nc Index" and "Codebook Information" are wrong:
Issued action:
IEEE 802.11 Action No Ack, Flags: ........
IEEE 802.11 wireless LAN
Fixed parameters
Category code: HE (30)
HE Action: HE Compressed Beamforming And CQI (0)
Total length: 152
HE MIMO Control: 0x0004008018
.... .... .... .... .... .... .... .... .... .000 = Nc Index: 1 Column (0) .... .... .... .... .... .... .... ..0. .... .... = Codebook Information: 0
Change to send WMI_VDEV_PARAM_SET_HEMU_MODE before WMI_PEER_ASSOC_CMDID, then firmware will calculate the TXBF values with valid parameters instead of empty values. TXBF works well and throughput performance is improved from 80 Mbps to 130 Mbps with this patch.
Good action after this patch:
IEEE 802.11 Action No Ack, Flags: ........
IEEE 802.11 wireless LAN
Fixed parameters
Category code: HE (30)
HE Action: HE Compressed Beamforming And CQI (0)
Total length: 409
HE MIMO Control: 0x0004008219
.... .... .... .... .... .... .... .... .... .001 = Nc Index: 2 Columns (1) .... .... .... .... .... .... .... ..1. .... .... = Codebook Information: 1
This change applies to all chipsets.
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23
--- drivers/net/wireless/ath/ath11k/mac.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath11k/mac.c +7 -6
@@ -3026,7 +3026,14 @@ static void ath11k_bss_assoc(struct ieee80211_hw *hw,rcu_read_unlock (); +if (!ath11k_mac_vif_recalc_sta_he_txbf (ar, vif, &he_cap)) { +ath11k_warn (ar->ab,"failed to recalc he txbf for vdev %i on bss %pM\n" , + arvif->vdev_id, bss_conf->bssid); +return ; + } + peer_arg.is_assoc = true; + ret =ath11k_wmi_send_peer_assoc_cmd (ar, &peer_arg);if (ret) { ath11k_warn(ar->ab, "failed to run peer assoc for %pM vdev %i: %d\n",
@@ -3049,12 +3056,6 @@ static void ath11k_bss_assoc(struct ieee80211_hw *hw,return ; } -if (!ath11k_mac_vif_recalc_sta_he_txbf (ar, vif, &he_cap)) { -ath11k_warn (ar->ab,"failed to recalc he txbf for vdev %i on bss %pM\n" , - arvif->vdev_id, bss_conf->bssid); -return ; - } -WARN_ON (arvif->is_up); arvif->aid = vif->cfg.aid;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 186/713 wifi: ath12k: Update Qualcomm Innovation Center, Inc. copyrights
In reply to Sasha LevinFrom: Jeff Johnson <[email protected]>
[ Upstream commit 05205b9576615fca5da91cdae5a3f89f2ad32703 ]
Update the copyright for all ath12k files modified on behalf of Qualcomm Innovation Center, Inc. in 2023.
Stable-dep-of: 902700d55d4a ("wifi: ath12k: fix fetching MCBC flag for QCN9274")
--- drivers/net/wireless/ath/ath12k/dbring.c | 2 +- drivers/net/wireless/ath/ath12k/debug.c | 2 +- drivers/net/wireless/ath/ath12k/dp_tx.c | 2 +- drivers/net/wireless/ath/ath12k/hal.c | 2 +- drivers/net/wireless/ath/ath12k/hal.h | 2 +- drivers/net/wireless/ath/ath12k/hal_rx.c | 2 +- drivers/net/wireless/ath/ath12k/hif.h | 2 +- drivers/net/wireless/ath/ath12k/hw.c | 2 +- drivers/net/wireless/ath/ath12k/hw.h | 2 +- drivers/net/wireless/ath/ath12k/mac.c | 2 +- drivers/net/wireless/ath/ath12k/mac.h | 2 +- drivers/net/wireless/ath/ath12k/mhi.c | 2 +- drivers/net/wireless/ath/ath12k/pci.c | 2 +- drivers/net/wireless/ath/ath12k/pci.h | 2 +- drivers/net/wireless/ath/ath12k/peer.h | 2 +- drivers/net/wireless/ath/ath12k/qmi.c | 2 +- drivers/net/wireless/ath/ath12k/qmi.h | 2 +- drivers/net/wireless/ath/ath12k/reg.c | 2 +- drivers/net/wireless/ath/ath12k/reg.h | 2 +- drivers/net/wireless/ath/ath12k/rx_desc.h | 2 +- drivers/net/wireless/ath/ath12k/wmi.c | 2 +- 21 files changed, 21 insertions(+), 21 deletions(-)
drivers/net/wireless/ath/ath12k/dbring.c +1 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #include "core.h"
drivers/net/wireless/ath/ath12k/debug.c +1 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/vmalloc.h>
drivers/net/wireless/ath/ath12k/dp_tx.c +1 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #include "core.h"
drivers/net/wireless/ath/ath12k/hal.c +1 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/dma-mapping.h> #include "hal_tx.h"
drivers/net/wireless/ath/ath12k/hal.h +1 -1
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef ATH12K_HAL_H
drivers/net/wireless/ath/ath12k/hal_rx.c +1 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #include "debug.h"
drivers/net/wireless/ath/ath12k/hif.h +1 -1
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef ATH12K_HIF_H
drivers/net/wireless/ath/ath12k/hw.c +1 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/types.h>
drivers/net/wireless/ath/ath12k/hw.h +1 -1
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef ATH12K_HW_H
drivers/net/wireless/ath/ath12k/mac.c +1 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <net/mac80211.h>
drivers/net/wireless/ath/ath12k/mac.h +1 -1
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef ATH12K_MAC_H
drivers/net/wireless/ath/ath12k/mhi.c +1 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2020-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/msi.h>
drivers/net/wireless/ath/ath12k/pci.c +1 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/module.h>
drivers/net/wireless/ath/ath12k/pci.h +1 -1
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef ATH12K_PCI_H #define ATH12K_PCI_H
drivers/net/wireless/ath/ath12k/peer.h +1 -1
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef ATH12K_PEER_H
drivers/net/wireless/ath/ath12k/qmi.c +1 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/elf.h>
drivers/net/wireless/ath/ath12k/qmi.h +1 -1
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef ATH12K_QMI_H
drivers/net/wireless/ath/ath12k/reg.c +1 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/rtnetlink.h> #include "core.h"
drivers/net/wireless/ath/ath12k/reg.h +1 -1
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef ATH12K_REG_H
drivers/net/wireless/ath/ath12k/rx_desc.h +1 -1
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause-Clear */ /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #ifndef ATH12K_RX_DESC_H #define ATH12K_RX_DESC_H
drivers/net/wireless/ath/ath12k/wmi.c +1 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/skbuff.h> #include <linux/ctype.h>
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 187/713 wifi: ath12k: fix fetching MCBC flag for QCN9274
In reply to Sasha LevinFrom: Raj Kumar Bhagat <[email protected]>
[ Upstream commit 902700d55d4a4522bb3eb4ef94f752a19c42230a ]
In QCN9274, RX packet's multicast and broadcast(MCBC) flag is fetched from RX descriptor's msdu_end info5 member but it is not correct for QCN9274. Due to this with encryption, ARP request packet is wrongly marked as MCBC packet and it is sent to mac80211 without setting RX_FLAG_PN_VALIDATED & RX_FLAG_DECRYPTED flag. This results in packet getting dropped in mac80211. Hence ping initiated from station to AP fails.
Fix this by fetching correct MCBC flag in case of QCN9274. For QC9274 MCBC flag should be fetched from RX descriptor's mpdu_start info6 member.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00188-QCAHKSWPL_SILICONZ-1
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
--- drivers/net/wireless/ath/ath12k/hal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath12k/hal.c +3 -3
@@ -1,7 +1,7 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. -* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/dma-mapping.h> #include "hal_tx.h"
@@ -449,8 +449,8 @@ static u8 *ath12k_hw_qcn9274_rx_desc_mpdu_start_addr2(struct hal_rx_desc *desc)static bool ath12k_hw_qcn9274_rx_desc_is_da_mcbc (struct hal_rx_desc *desc) { -return __le16_to_cpu (desc->u.qcn9274.msdu_end.info5) & -RX_MSDU_END_INFO5_DA_IS_MCBC ; +return __le32_to_cpu (desc->u.qcn9274.mpdu_start.info6) & +RX_MPDU_START_INFO6_MCAST_BCAST ; } static void ath12k_hw_qcn9274_rx_desc_get_dot11_hdr(struct hal_rx_desc *desc,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 188/713 wifi: iwlwifi: mvm: report beacon protection failures
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 91380f768d7f6e3d003755defa792e9a00a1444a ]
Andrei reports that we just silently drop beacons after we report the key counters, but never report to userspace, so wpa_supplicant cannot send the WNM action frame. Fix that.
--- drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c +15 -11
@@ -282,6 +282,7 @@ static int iwl_mvm_rx_mgmt_prot(struct ieee80211_sta *sta,u32 status, struct ieee80211_rx_status *stats) { + struct wireless_dev *wdev;struct iwl_mvm_sta *mvmsta;struct iwl_mvm_vif *mvmvif;u8 keyid;
@@ -303,9 +304,15 @@ static int iwl_mvm_rx_mgmt_prot(struct ieee80211_sta *sta,if (!ieee80211_is_beacon (hdr->frame_control))return 0 ; +if (!sta) +return -1 ; + + mvmsta =iwl_mvm_sta_from_mac80211 (sta); + mvmvif =iwl_mvm_vif_from_mac80211 (mvmsta->vif); +/* key mismatch - will also report !MIC_OK but we shouldn't count it */ if (!(status &IWL_RX_MPDU_STATUS_KEY_VALID )) -return -1 ; + goto report;/* good cases */ if (likely(status & IWL_RX_MPDU_STATUS_MIC_OK &&
@@ -314,13 +321,6 @@ static int iwl_mvm_rx_mgmt_prot(struct ieee80211_sta *sta,return 0 ; } -if (!sta) -return -1 ; - - mvmsta =iwl_mvm_sta_from_mac80211 (sta); - - mvmvif =iwl_mvm_vif_from_mac80211 (mvmsta->vif); -/* * both keys will have the same cipher and MIC length, use * whichever one is available
@@ -329,11 +329,11 @@ static int iwl_mvm_rx_mgmt_prot(struct ieee80211_sta *sta,if (!key) { key =rcu_dereference (mvmvif->bcn_prot.keys[1 ]);if (!key) -return -1 ; + goto report; }if (len < key->icv_len +IEEE80211_GMAC_PN_LEN +2 ) -return -1 ; + goto report;/* get the real key ID */ keyid = frame[len - key->icv_len -IEEE80211_GMAC_PN_LEN -2 ];
@@ -347,7 +347,7 @@ static int iwl_mvm_rx_mgmt_prot(struct ieee80211_sta *sta,return -1 ; key =rcu_dereference (mvmvif->bcn_prot.keys[keyid -6 ]);if (!key) -return -1 ; + goto report; }/* Report status to mac80211 */
@@ -355,6 +355,10 @@ static int iwl_mvm_rx_mgmt_prot(struct ieee80211_sta *sta,ieee80211_key_mic_failure (key); else if (status & IWL_RX_MPDU_STATUS_REPLAY_ERROR) ieee80211_key_replay(key); +report: + wdev =ieee80211_vif_to_wdev (mvmsta->vif); +if (wdev->netdev) +cfg80211_rx_unprot_mlme_mgmt (wdev->netdev, (void *)hdr, len);return -1 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 189/713 wifi: iwlwifi: dbg-tlv: ensure NUL termination
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit ea1d166fae14e05d49ffb0ea9fcd4658f8d3dcea ]
The iwl_fw_ini_debug_info_tlv is used as a string, so we must ensure the string is terminated correctly before using it.
--- drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c +6 -0
@@ -103,6 +103,12 @@ static int iwl_dbg_tlv_alloc_debug_info(struct iwl_trans *trans,if (le32_to_cpu (tlv->length) !=sizeof (*debug_info))return -EINVAL ; +/* we use this as a string, ensure input was NUL terminated */ +if (strnlen (debug_info->debug_cfg_name, +sizeof (debug_info->debug_cfg_name)) == +sizeof (debug_info->debug_cfg_name)) +return -EINVAL ; +IWL_DEBUG_FW (trans,"WRT: Loading debug cfg: %s\n" , debug_info->debug_cfg_name);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 190/713 wifi: iwlwifi: acpi: fix WPFC reading
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 296f3e926716ded8dc29e349d2b042b362f96515 ]
The code reading the WPFC table needs to take into account the domain type (first element in the package), shouldn't leak the memory if it fails, and has a bad comment. Fix all these issues.
--- drivers/net/wireless/intel/iwlwifi/fw/acpi.c | 10 +++++----- drivers/net/wireless/intel/iwlwifi/fw/acpi.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/acpi.c +5 -5
@@ -1296,7 +1296,6 @@ void iwl_acpi_get_phy_filters(struct iwl_fw_runtime *fwrt,if (IS_ERR (data))return ; -/* try to read wtas table revision 1 or revision 0*/ wifi_pkg =iwl_acpi_get_wifi_pkg (fwrt->dev, data,ACPI_WPFC_WIFI_DATA_SIZE , &tbl_rev);
@@ -1306,13 +1305,14 @@ void iwl_acpi_get_phy_filters(struct iwl_fw_runtime *fwrt,if (tbl_rev !=0 ) goto out_free; -BUILD_BUG_ON (ARRAY_SIZE (filters->filter_cfg_chains) !=ACPI_WPFC_WIFI_DATA_SIZE ); +BUILD_BUG_ON (ARRAY_SIZE (filters->filter_cfg_chains) != +ACPI_WPFC_WIFI_DATA_SIZE -1 );for (i =0 ; i <ARRAY_SIZE (filters->filter_cfg_chains); i++) { -if (wifi_pkg->package.elements[i].type !=ACPI_TYPE_INTEGER ) -return ; +if (wifi_pkg->package.elements[i +1 ].type !=ACPI_TYPE_INTEGER ) + goto out_free; tmp.filter_cfg_chains[i] = -cpu_to_le32 (wifi_pkg->package.elements[i].integer.value); +cpu_to_le32 (wifi_pkg->package.elements[i +1 ].integer.value); }IWL_DEBUG_RADIO (fwrt,"Loaded WPFC filter config from ACPI\n" );
drivers/net/wireless/intel/iwlwifi/fw/acpi.h +1 -1
@@ -56,7 +56,7 @@#define ACPI_EWRD_WIFI_DATA_SIZE_REV2 ((ACPI_SAR_PROFILE_NUM - 1) * \ ACPI_SAR_NUM_CHAINS_REV2 * \ ACPI_SAR_NUM_SUB_BANDS_REV2 + 3) -#define ACPI_WPFC_WIFI_DATA_SIZE 4/* 4 filter config words */ +#define ACPI_WPFC_WIFI_DATA_SIZE 5/* domain and 4 filter config words */ /* revision 0 and 1 are identical, except for the semantics in the FW */ #define ACPI_GEO_NUM_BANDS_REV0 2
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 191/713 wifi: iwlwifi: mvm: initialize rates in FW earlier
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit d3b2c6c65bfd3b9616084e91bd0d402964ea7cef ]
When connecting to an AP, we currently initialize the rate control only after associating. Since we now use firmware to assign rates to auth/assoc frames rather than using the data in the station and the firmware doesn't know, they're transmitted using low mandatory rates. However, if the AP advertised only higher supported rates we want to use them to be nicer (it still must receive mandatory rates though), so send the information to the firmware earlier to have it know about it and be able to use it.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +13 -0
@@ -3684,6 +3684,19 @@ iwl_mvm_sta_state_notexist_to_none(struct iwl_mvm *mvm,if (vif->type ==NL80211_IFTYPE_STATION && !sta->tdls) mvmvif->ap_sta = sta; +/* +* Initialize the rates here already - this really tells +* the firmware only what the supported legacy rates are +* (may be) since it's initialized already from what the +* AP advertised in the beacon/probe response. This will +* allow the firmware to send auth/assoc frames with one +* of the supported rates already, rather than having to +* use a mandatory rate. +* If we're the AP, we'll just assume mandatory rates at +* this point, but we know nothing about the STA anyway. +*/ +iwl_mvm_rs_rate_init_all_links (mvm, vif, sta); +return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 192/713 wifi: iwlwifi: fix EWRD table validity check
In reply to Sasha LevinFrom: Miri Korenblit <[email protected]>
[ Upstream commit c8d8f3911135921ace8e939ea0956b55f74bf8a0 ]
EWRD ACPI table contains up to 3 additional sar profiles. According to the BIOS spec, the table contains a n_profile variable indicating how many additional profiles exist in the table.
Currently we check that n_profiles is not <= 0.
But according to the BIOS spec, 0 is a valid value, and it can't be < 0 anyway because we receive that from ACPI as an unsigned integer.
--- drivers/net/wireless/intel/iwlwifi/fw/acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/fw/acpi.c +1 -1
@@ -767,7 +767,7 @@ int iwl_sar_get_ewrd_table(struct iwl_fw_runtime *fwrt)* from index 1, so the maximum value allowed here is * ACPI_SAR_PROFILES_NUM - 1. */ -if (n_profiles <=0 || n_profiles >=ACPI_SAR_PROFILE_NUM ) { +if (n_profiles >=ACPI_SAR_PROFILE_NUM ) { ret = -EINVAL ; goto out_free; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 193/713 wifi: iwlwifi: mvm: d3: fix IPN byte order
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 0c769cb6b9f364423c255f117774c9ecd5bf23ea ]
The IPN is reported by the firmware in 6 bytes little endian, but mac80211 expects big endian so it can do memcmp() on it. We used to store this as a u64 which was filled in the right way, but never used. When implementing that it's used, we changed it to just be 6 bytes, but lost the conversion. Add it back.
--- drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/d3.c +7 -1
@@ -2207,7 +2207,10 @@ static void iwl_mvm_convert_gtk_v3(struct iwl_wowlan_status_data *status,static void iwl_mvm_convert_igtk (struct iwl_wowlan_status_data *status,struct iwl_wowlan_igtk_status *data) { +int i; +BUILD_BUG_ON (sizeof (status->igtk.key) <sizeof (data->key)); +BUILD_BUG_ON (sizeof (status->igtk.ipn) !=sizeof (data->ipn));if (!data->key_len)return ;
@@ -2219,7 +2222,10 @@ static void iwl_mvm_convert_igtk(struct iwl_wowlan_status_data *status, +WOWLAN_IGTK_MIN_INDEX ;memcpy (status->igtk.key, data->key,sizeof (data->key)); -memcpy (status->igtk.ipn, data->ipn,sizeof (data->ipn)); + +/* mac80211 expects big endian for memcmp() to work, convert */ +for (i =0 ; i <sizeof (data->ipn); i++) + status->igtk.ipn[i] = data->ipn[sizeof (data->ipn) - i -1 ]; } static void iwl_mvm_convert_bigtk(struct iwl_wowlan_status_data *status,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 194/713 wifi: iwlwifi: always have 'uats_enabled'
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit f639602a58e7564dd091c7c0793f61042bad9bb6 ]
We check this in code that'd be complicated to put under ifdef (CONFIG_ACPI), so just always have 'uats_enabled'.
--- drivers/net/wireless/intel/iwlwifi/fw/runtime.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/fw/runtime.h +1 -1
@@ -173,9 +173,9 @@ struct iwl_fw_runtime {struct iwl_sar_offset_mapping_cmd sgom_table;bool sgom_enabled;u8 reduced_power_flags; -bool uats_enabled;struct iwl_uats_table_cmd uats_table;#endif +bool uats_enabled; }; void iwl_fw_runtime_init(struct iwl_fw_runtime *fwrt, struct iwl_trans *trans,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 195/713 wifi: iwlwifi: mvm: fix the TLC command after ADD_STA
In reply to Sasha LevinFrom: Emmanuel Grumbach <[email protected]>
[ Upstream commit 0fcdf55fced7121c43fa576433986f1c04115b73 ]
ADD_STA resets the link quality data inside the firmware. This is not supposed to happen and has been fixed for newer devices. For older devices (AX201 and down), this makes us send frames with rates that are not in the TLC table.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +8 -4
@@ -3795,13 +3795,17 @@ iwl_mvm_sta_state_assoc_to_authorized(struct iwl_mvm *mvm, mvm_sta->authorized = true; -iwl_mvm_rs_rate_init_all_links (mvm, vif, sta); -/* MFP is set by default before the station is authorized. * Clear it here in case it's not used. */ -if (!sta->mfp) -return callbacks->update_sta (mvm, vif, sta); +if (!sta->mfp) { +int ret = callbacks->update_sta (mvm, vif, sta); + +if (ret) +return ret; + } + +iwl_mvm_rs_rate_init_all_links (mvm, vif, sta);return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 196/713 wifi: iwlwifi: read BIOS PNVM only for non-Intel SKU
In reply to Sasha LevinFrom: Miri Korenblit <[email protected]>
[ Upstream commit c868a189ecfe8cc0b3173c2eaa7f0b659326c151 ]
The driver is supposed to read the PNVM from BIOS only for non-Intel SKUs. For Intel SKUs the OEM ID will be 0.
Read BIOS PNVM only when a non-Intel SKU is indicated.
--- drivers/net/wireless/intel/iwlwifi/fw/pnvm.c | 30 ++++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/pnvm.c +18 -12
@@ -255,21 +255,27 @@ static u8 *iwl_get_pnvm_image(struct iwl_trans *trans_p, size_t *len)struct pnvm_sku_package *package;u8 *image =NULL ; -/* First attempt to get the PNVM from BIOS */ - package =iwl_uefi_get_pnvm (trans_p, len); -if (!IS_ERR_OR_NULL (package)) { -if (*len >=sizeof (*package)) { -/* we need only the data */ - *len -=sizeof (*package); - image =kmemdup (package->data, *len,GFP_KERNEL ); +/* Get PNVM from BIOS for non-Intel SKU */ +if (trans_p->sku_id[2 ]) { + package =iwl_uefi_get_pnvm (trans_p, len); +if (!IS_ERR_OR_NULL (package)) { +if (*len >=sizeof (*package)) { +/* we need only the data */ + *len -=sizeof (*package); + image =kmemdup (package->data, + *len,GFP_KERNEL ); + } +/* +* free package regardless of whether kmemdup +* succeeded +*/ +kfree (package); +if (image) +return image; } -/* free package regardless of whether kmemdup succeeded */ -kfree (package); -if (image) -return image; } -/* If it's not available, try from the filesystem */ +/* If it's not available, or for Intel SKU, try from the filesystem */ if (iwl_pnvm_get_from_fs (trans_p, &image, len))return NULL ;return image;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 197/713 gpio: vf610: allow disabling the vf610 driver
In reply to Sasha LevinFrom: Martin Kaiser <[email protected]>
[ Upstream commit f57595788244a838deec2d3be375291327cbc035 ]
The vf610 gpio driver is enabled by default for all i.MX machines, without any option to disable it in a board-specific config file.
Most i.MX chipsets have no hardware for this driver. Change the default to enable GPIO_VF610 for SOC_VF610 and disable it otherwise.
Add a text description after the bool type, this makes the driver selectable by make config etc.
--- drivers/gpio/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/Kconfig +2 -1
@@ -691,7 +691,8 @@ config GPIO_UNIPHIER Say yes here to support UniPhier GPIOs. config GPIO_VF610 - def_bool y + bool "VF610 GPIO support" + default y if SOC_VF610 depends on ARCH_MXC select GPIOLIB_IRQCHIP help
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 198/713 selftests/bpf: trace_helpers.c: do not use poisoned type
In reply to Sasha LevinFrom: Shung-Hsi Yu <[email protected]>
[ Upstream commit a68b50f47bec8bd6a33b07b7e1562db2553981a7 ]
After commit c698eaebdf47 ("selftests/bpf: trace_helpers.c: Optimize kallsyms cache") trace_helpers.c now includes libbpf_internal.h, and thus can no longer use the u32 type (among others) since they are poison in libbpf_internal.h. Replace u32 with __u32 to fix the following error when building trace_helpers.c on powerpc:
error: attempt to use poisoned "u32"
--- tools/testing/selftests/bpf/trace_helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/trace_helpers.c +1 -1
@@ -271,7 +271,7 @@ ssize_t get_uprobe_offset(const void *addr)* addi r2,r2,XXXX */ { -const u32 *insn = (const u32 *)(uintptr_t )addr; +const __u32 *insn = (const __u32 *)(uintptr_t )addr; if ((((*insn & OP_RT_RA_MASK) == ADDIS_R2_R12) || ((*insn & OP_RT_RA_MASK) == LIS_R2)) &&
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 199/713 arm64: dts: imx8mm-venice-gw71xx: fix USB OTG VBUS
In reply to Sasha LevinFrom: Tim Harvey <[email protected]>
[ Upstream commit ec2cb52fcfef5d58574f2cfbc9a99ffc20ae5a9d ]
The GW71xx does not have a gpio controlled vbus regulator but it does require some pinctrl. Remove the regulator and move the valid pinctrl into the usbotg1 node.
--- .../dts/freescale/imx8mm-venice-gw71xx.dtsi | 29 ++++++------------- 1 file changed, 9 insertions(+), 20 deletions(-)
arch/arm64/boot/dts/freescale/imx8mm-venice-gw71xx.dtsi +9 -20
@@ -47,17 +47,6 @@ pps { gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>; status = "okay"; }; - - reg_usb_otg1_vbus: regulator-usb-otg1 { - pinctrl-names = "default"; - pinctrl-0 = <&pinctrl_reg_usb1_en>; - compatible = "regulator-fixed"; - regulator-name = "usb_otg1_vbus"; - gpio = <&gpio1 10 GPIO_ACTIVE_HIGH>; - enable-active-high; - regulator-min-microvolt = <5000000>; - regulator-max-microvolt = <5000000>; - }; }; /* off-board header */
@@ -144,9 +133,10 @@ &uart3 { }; &usbotg1 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_usbotg1>; dr_mode = "otg"; over-current-active-low; - vbus-supply = <®_usb_otg1_vbus>; status = "okay"; };
@@ -204,14 +194,6 @@ MX8MM_IOMUXC_GPIO1_IO15_GPIO1_IO15 0x41 >; }; - pinctrl_reg_usb1_en: regusb1grp { - fsl,pins = < - MX8MM_IOMUXC_GPIO1_IO10_GPIO1_IO10 0x41 - MX8MM_IOMUXC_GPIO1_IO12_GPIO1_IO12 0x141 - MX8MM_IOMUXC_GPIO1_IO13_USB1_OTG_OC 0x41 - >; - }; - pinctrl_spi2: spi2grp { fsl,pins = < MX8MM_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK 0xd6
@@ -234,4 +216,11 @@ MX8MM_IOMUXC_UART3_RXD_UART3_DCE_RX 0x140 MX8MM_IOMUXC_UART3_TXD_UART3_DCE_TX 0x140 >; }; + + pinctrl_usbotg1: usbotg1grp { + fsl,pins = < + MX8MM_IOMUXC_GPIO1_IO12_GPIO1_IO12 0x141 + MX8MM_IOMUXC_GPIO1_IO13_USB1_OTG_OC 0x41 + >; + }; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 200/713 pwm: atmel-hlcdc: Fix clock imbalance related to suspend support
In reply to Sasha LevinFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit e25ac87d3f831fed002c34aadddaf4ebb4ea45ec ]
The suspend callback disables the periph clock when the PWM is enabled and resume reenables this clock if the PWM was disabled before. Judging from the code comment it's suspend that is wrong here. Fix accordingly.
--- drivers/pwm/pwm-atmel-hlcdc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pwm/pwm-atmel-hlcdc.c +1 -1
@@ -186,7 +186,7 @@ static int atmel_hlcdc_pwm_suspend(struct device *dev)struct atmel_hlcdc_pwm *atmel =dev_get_drvdata (dev);/* Keep the periph clock enabled if the PWM is still running. */ -if (pwm_is_enabled (&atmel->chip.pwms[0 ])) +if (!pwm_is_enabled (&atmel->chip.pwms[0 ]))clk_disable_unprepare (atmel->hlcdc->periph_clk);return 0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 201/713 net: blackhole_dev: fix build warning for ethh set but not used
In reply to Sasha LevinFrom: Breno Leitao <[email protected]>
[ Upstream commit 843a8851e89e2e85db04caaf88d8554818319047 ]
lib/test_blackhole_dev.c sets a variable that is never read, causing this following building warning:
lib/test_blackhole_dev.c:32:17: warning: variable 'ethh' set but not used [-Wunused-but-set-variable]
Remove the variable struct ethhdr *ethh, which is unused.
--- lib/test_blackhole_dev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
lib/test_blackhole_dev.c +1 -2
@@ -29,7 +29,6 @@ static int __init test_blackholedev_init(void) {struct ipv6hdr *ip6h;struct sk_buff *skb; -struct ethhdr *ethh;struct udphdr *uh;int data_len;int ret;
@@ -61,7 +60,7 @@ static int __init test_blackholedev_init(void) ip6h->saddr = in6addr_loopback; ip6h->daddr = in6addr_loopback;/* Ether */ - ethh = (struct ethhdr *)skb_push (skb,sizeof (struct ethhdr )); +skb_push (skb,sizeof (struct ethhdr ));skb_set_mac_header (skb,0 ); skb->protocol =htons (ETH_P_IPV6 );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 202/713 arm64: dts: ti: k3-am62p5-sk: Enable CPSW MDIO node
In reply to Sasha LevinFrom: Ravi Gunasekaran <[email protected]>
[ Upstream commit 8839a9af397e803e0447a6b3e69fad54ed22d26d ]
Enable the CPSW MDIO node, and link the pinctrl information to enable ethernet on SK-AM62P.
Ethernet was unintentally broken on this board, even though these nodes were already present, as enabling them was missed in the original patch.
--- arch/arm64/boot/dts/ti/k3-am62p5-sk.dts | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/ti/k3-am62p5-sk.dts +4 -0
@@ -445,6 +445,10 @@ &cpsw_port2 { }; &cpsw3g_mdio { + pinctrl-names = "default"; + pinctrl-0 = <&main_mdio1_pins_default>; + status = "okay"; + cpsw3g_phy0: ethernet-phy@0 { reg = <0>; ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 203/713 arm64: dts: ti: k3-j721s2: Fix power domain for VTM node
In reply to Sasha LevinFrom: Manorit Chawdhry <[email protected]>
[ Upstream commit 5ef196ed912e80a1e64936119ced8d7eb5635f0f ]
Fix the power domain device ID for wkup_vtm0 node.
--- arch/arm64/boot/dts/ti/k3-j721s2-mcu-wakeup.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-j721s2-mcu-wakeup.dtsi +1 -1
@@ -652,7 +652,7 @@ wkup_vtm0: temperature-sensor@42040000 { compatible = "ti,j7200-vtm"; reg = <0x00 0x42040000 0x0 0x350>, <0x00 0x42050000 0x0 0x350>; - power-domains = <&k3_pds 154 TI_SCI_PD_SHARED>; + power-domains = <&k3_pds 180 TI_SCI_PD_SHARED>; #thermal-sensor-cells = <1>; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 204/713 arm64: dts: ti: k3-j784s4: Fix power domain for VTM node
In reply to Sasha LevinFrom: Manorit Chawdhry <[email protected]>
[ Upstream commit e4d252e6d29208aea56d4c04270523e306b1e3c2 ]
Fix the power domain device ID for wkup_vtm0 node.
--- arch/arm64/boot/dts/ti/k3-j784s4-mcu-wakeup.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-j784s4-mcu-wakeup.dtsi +1 -1
@@ -616,7 +616,7 @@ wkup_vtm0: temperature-sensor@42040000 { compatible = "ti,j7200-vtm"; reg = <0x00 0x42040000 0x00 0x350>, <0x00 0x42050000 0x00 0x350>; - power-domains = <&k3_pds 154 TI_SCI_PD_SHARED>; + power-domains = <&k3_pds 243 TI_SCI_PD_SHARED>; #thermal-sensor-cells = <1>; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 205/713 wifi: ath11k: initialize rx_mcs_80 and rx_mcs_160 before use
In reply to Sasha LevinFrom: Baochen Qiang <[email protected]>
[ Upstream commit b802e7b7e771dee3377d071418281f8b64d2d832 ]
Currently in ath11k_peer_assoc_h_he() rx_mcs_80 and rx_mcs_160 are used to calculate max_nss, see
if (support_160) max_nss = min(rx_mcs_80, rx_mcs_160); else max_nss = rx_mcs_80;
Kernel test robot complains on uninitialized symbols:drivers/net/wireless/ath/ath11k/mac.c:2321 ath11k_peer_assoc_h_he() error: uninitialized symbol 'rx_mcs_80'. drivers/net/wireless/ath/ath11k/mac.c:2321 ath11k_peer_assoc_h_he() error: uninitialized symbol 'rx_mcs_160'. drivers/net/wireless/ath/ath11k/mac.c:2323 ath11k_peer_assoc_h_he() error: uninitialized symbol 'rx_mcs_80'.
This is because there are some code paths that never set them, so the assignment of max_nss can come from uninitialized variables. This could result in some unknown issues since a wrong peer_nss might be passed to firmware.
Change to initialize them to an invalid value at the beginning. This makes sense because even max_nss gets an invalid value, due to either or both of them being invalid, we can get an valid peer_nss with following guard:
arg->peer_nss = min(sta->deflink.rx_nss, max_nss)
Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.23
--- drivers/net/wireless/ath/ath11k/mac.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/ath/ath11k/mac.c +4 -0
@@ -2297,6 +2297,8 @@ static void ath11k_peer_assoc_h_he(struct ath11k *ar, mcs_160_map =le16_to_cpu (he_cap->he_mcs_nss_supp.rx_mcs_160); mcs_80_map =le16_to_cpu (he_cap->he_mcs_nss_supp.rx_mcs_80); +/* Initialize rx_mcs_160 to 9 which is an invalid value */ + rx_mcs_160 =9 ;if (support_160) {for (i =7 ; i >=0 ; i--) {u8 mcs_160 = (mcs_160_map >> (2 * i)) &3 ;
@@ -2308,6 +2310,8 @@ static void ath11k_peer_assoc_h_he(struct ath11k *ar, } } +/* Initialize rx_mcs_80 to 9 which is an invalid value */ + rx_mcs_80 =9 ;for (i =7 ; i >=0 ; i--) {u8 mcs_80 = (mcs_80_map >> (2 * i)) &3 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 206/713 wifi: libertas: fix some memleaks in lbs_allocate_cmd_buffer()
In reply to Sasha LevinFrom: Zhipeng Lu <[email protected]>
[ Upstream commit 5f0e4aede01cb01fa633171f0533affd25328c3a ]
In the for statement of lbs_allocate_cmd_buffer(), if the allocation of cmdarray[i].cmdbuf fails, both cmdarray and cmdarray[i].cmdbuf needs to be freed. Otherwise, there will be memleaks in lbs_allocate_cmd_buffer().
--- drivers/net/wireless/marvell/libertas/cmd.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/net/wireless/marvell/libertas/cmd.c +11 -2
@@ -1132,7 +1132,7 @@ int lbs_allocate_cmd_buffer(struct lbs_private *priv)if (!cmdarray[i].cmdbuf) {lbs_deb_host ("ALLOC_CMD_BUF: ptempvirtualaddr is NULL\n" ); ret =-1 ; - goto done; + goto free_cmd_array; } }
@@ -1140,8 +1140,17 @@ int lbs_allocate_cmd_buffer(struct lbs_private *priv)init_waitqueue_head (&cmdarray[i].cmdwait_q);lbs_cleanup_and_insert_cmd (priv, &cmdarray[i]); } - ret =0 ; +return 0 ; +free_cmd_array: +for (i =0 ; i <LBS_NUM_CMD_BUFFERS ; i++) { +if (cmdarray[i].cmdbuf) { +kfree (cmdarray[i].cmdbuf); + cmdarray[i].cmdbuf =NULL ; + } + } +kfree (priv->cmd_array); + priv->cmd_array =NULL ; done:return ret; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 207/713 arm64: dts: ti: k3-am69-sk: remove assigned-clock-parents for unused VP
In reply to Sasha LevinFrom: Jayesh Choudhary <[email protected]>
[ Upstream commit cfdb4f7ffdb855c1a3d274dc7757e780dcbf2d55 ]
VP2 and VP3 are unused video ports and VP3 share the same parent clock as VP1 causing issue with pixel clock setting for HDMI (VP1). The current DM firmware does not support changing parent clock if it is shared by another component. It returns 0 for the determine_rate query before causing set_rate to set the clock at default maximum of 1.8GHz which is a lot more than the maximum frequency videoports can support (600MHz) causing SYNC LOST issues.
So remove the parent clocks for unused VPs to avoid conflict.
--- arch/arm64/boot/dts/ti/k3-am69-sk.dts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/ti/k3-am69-sk.dts +2 -6
@@ -824,13 +824,9 @@ &dss { pinctrl-names = "default"; pinctrl-0 = <&dss_vout0_pins_default>; assigned-clocks = <&k3_clks 218 2>, - <&k3_clks 218 5>, - <&k3_clks 218 14>, - <&k3_clks 218 18>; + <&k3_clks 218 5>; assigned-clock-parents = <&k3_clks 218 3>, - <&k3_clks 218 7>, - <&k3_clks 218 16>, - <&k3_clks 218 22>; + <&k3_clks 218 7>; }; &serdes_wiz4 {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 208/713 arm64: dts: ti: k3-am62p-mcu/wakeup: Disable MCU and wakeup R5FSS nodes
In reply to Sasha LevinFrom: Vaishnav Achath <[email protected]>
[ Upstream commit dfc90e5f1a0fe0f8124521bc1911e38aa6cd9118 ]
K3 Remoteproc R5 driver requires reserved memory carveouts and mailbox configuration to instantiate the cores successfully. Since this is a board level dependency, keep the R5 subsytem disabled at SoC dtsi, otherwise it results in probe errors like below during AM62P SK boot:
r5fss@79000000: reserved memory init failed, ret = -22 r5fss@79000000: k3_r5_cluster_rproc_init failed, ret = -22 r5fss@78000000: reserved memory init failed, ret = -22 r5fss@78000000: k3_r5_cluster_rproc_init failed, ret = -22
--- arch/arm64/boot/dts/ti/k3-am62p-mcu.dtsi | 2 ++ arch/arm64/boot/dts/ti/k3-am62p-wakeup.dtsi | 1 + 2 files changed, 3 insertions(+)
arch/arm64/boot/dts/ti/k3-am62p-mcu.dtsi +2 -0
@@ -187,6 +187,8 @@ mcu_r5fss0: r5fss@79000000 { ranges = <0x79000000 0x00 0x79000000 0x8000>, <0x79020000 0x00 0x79020000 0x8000>; power-domains = <&k3_pds 7 TI_SCI_PD_EXCLUSIVE>; + status = "disabled"; + mcu_r5fss0_core0: r5f@79000000 { compatible = "ti,am62-r5f"; reg = <0x79000000 0x00008000>,
arch/arm64/boot/dts/ti/k3-am62p-wakeup.dtsi +1 -0
@@ -78,6 +78,7 @@ wkup_r5fss0: r5fss@78000000 { ranges = <0x78000000 0x00 0x78000000 0x8000>, <0x78100000 0x00 0x78100000 0x8000>; power-domains = <&k3_pds 119 TI_SCI_PD_EXCLUSIVE>; + status = "disabled"; wkup_r5fss0_core0: r5f@78000000 { compatible = "ti,am62-r5f";
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 209/713 libbpf: Use OPTS_SET() macro in bpf_xdp_query()
In reply to Sasha LevinFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 92a871ab9fa59a74d013bc04f321026a057618e7 ]
When the feature_flags and xdp_zc_max_segs fields were added to the libbpf bpf_xdp_query_opts, the code writing them did not use the OPTS_SET() macro. This causes libbpf to write to those fields unconditionally, which means that programs compiled against an older version of libbpf (with a smaller size of the bpf_xdp_query_opts struct) will have its stack corrupted by libbpf writing out of bounds.
The patch adding the feature_flags field has an early bail out if the feature_flags field is not part of the opts struct (via the OPTS_HAS) macro, but the patch adding xdp_zc_max_segs does not. For consistency, this fix just changes the assignments to both fields to use the OPTS_SET() macro.
--- tools/lib/bpf/netlink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/lib/bpf/netlink.c +2 -2
@@ -496,8 +496,8 @@ int bpf_xdp_query(int ifindex, int xdp_flags, struct bpf_xdp_query_opts *opts)if (err)return libbpf_err (err); - opts->feature_flags = md.flags; - opts->xdp_zc_max_segs = md.xdp_zc_max_segs; +OPTS_SET (opts, feature_flags, md.flags); +OPTS_SET (opts, xdp_zc_max_segs, md.xdp_zc_max_segs); skip_feature_flags:return 0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 210/713 wifi: wfx: fix memory leak when starting AP
In reply to Sasha LevinFrom: Jérôme Pouiller <[email protected]>
[ Upstream commit b8cfb7c819dd39965136a66fe3a7fde688d976fc ]
Kmemleak reported this error:
unreferenced object 0xd73d1180 (size 184):
comm "wpa_supplicant", pid 1559, jiffies 13006305 (age 964.245s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 1e 00 01 00 00 00 00 00 ................
backtrace:
[<5ca11420>] kmem_cache_alloc+0x20c/0x5ac
[<127bdd74>] __alloc_skb+0x144/0x170
[<fb8a5e38>] __netdev_alloc_skb+0x50/0x180
[<0f9fa1d5>] __ieee80211_beacon_get+0x290/0x4d4 [mac80211]
[<7accd02d>] ieee80211_beacon_get_tim+0x54/0x18c [mac80211]
[<41e25cc3>] wfx_start_ap+0xc8/0x234 [wfx]
[<93a70356>] ieee80211_start_ap+0x404/0x6b4 [mac80211]
[<a4a661cd>] nl80211_start_ap+0x76c/0x9e0 [cfg80211]
[<47bd8b68>] genl_rcv_msg+0x198/0x378
[<453ef796>] netlink_rcv_skb+0xd0/0x130
[<6b7c977a>] genl_rcv+0x34/0x44
[<66b2d04d>] netlink_unicast+0x1b4/0x258
[<f965b9b6>] netlink_sendmsg+0x1e8/0x428
[<aadb8231>] ____sys_sendmsg+0x1e0/0x274
[<d2b5212d>] ___sys_sendmsg+0x80/0xb4
[<69954f45>] __sys_sendmsg+0x64/0xa8
unreferenced object 0xce087000 (size 1024):
comm "wpa_supplicant", pid 1559, jiffies 13006305 (age 964.246s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
10 00 07 40 00 00 00 00 00 00 00 00 00 00 00 00 ...@............
backtrace:
[<9a993714>] __kmalloc_track_caller+0x230/0x600
[<f83ea192>] kmalloc_reserve.constprop.0+0x30/0x74
[<a2c61343>] __alloc_skb+0xa0/0x170
[<fb8a5e38>] __netdev_alloc_skb+0x50/0x180
[<0f9fa1d5>] __ieee80211_beacon_get+0x290/0x4d4 [mac80211]
[<7accd02d>] ieee80211_beacon_get_tim+0x54/0x18c [mac80211]
[<41e25cc3>] wfx_start_ap+0xc8/0x234 [wfx]
[<93a70356>] ieee80211_start_ap+0x404/0x6b4 [mac80211]
[<a4a661cd>] nl80211_start_ap+0x76c/0x9e0 [cfg80211]
[<47bd8b68>] genl_rcv_msg+0x198/0x378
[<453ef796>] netlink_rcv_skb+0xd0/0x130
[<6b7c977a>] genl_rcv+0x34/0x44
[<66b2d04d>] netlink_unicast+0x1b4/0x258
[<f965b9b6>] netlink_sendmsg+0x1e8/0x428
[<aadb8231>] ____sys_sendmsg+0x1e0/0x274
[<d2b5212d>] ___sys_sendmsg+0x80/0xb4However, since the kernel is build optimized, it seems the stack is not accurate. It appears the issue is related to wfx_set_mfp_ap(). The issue is obvious in this function: memory allocated by ieee80211_beacon_get() is never released. Fixing this leak makes kmemleak happy.
--- drivers/net/wireless/silabs/wfx/sta.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/net/wireless/silabs/wfx/sta.c +10 -5
@@ -344,6 +344,7 @@ static int wfx_set_mfp_ap(struct wfx_vif *wvif)const int pairwise_cipher_suite_count_offset =8 /sizeof (u16);const int pairwise_cipher_suite_size =4 /sizeof (u16);const int akm_suite_size =4 /sizeof (u16); +int ret = -EINVAL ;const u16 *ptr;if (unlikely (!skb))
@@ -352,22 +353,26 @@ static int wfx_set_mfp_ap(struct wfx_vif *wvif) ptr = (u16 *)cfg80211_find_ie (WLAN_EID_RSN , skb->data + ieoffset, skb->len - ieoffset);if (unlikely (!ptr)) -return -EINVAL ; + goto free_skb; ptr += pairwise_cipher_suite_count_offset;if (WARN_ON (ptr > (u16 *)skb_tail_pointer (skb))) -return -EINVAL ; + goto free_skb; ptr +=1 + pairwise_cipher_suite_size * *ptr;if (WARN_ON (ptr > (u16 *)skb_tail_pointer (skb))) -return -EINVAL ; + goto free_skb; ptr +=1 + akm_suite_size * *ptr;if (WARN_ON (ptr > (u16 *)skb_tail_pointer (skb))) -return -EINVAL ; + goto free_skb;wfx_hif_set_mfp (wvif, *ptr &BIT (7 ), *ptr &BIT (6 )); -return 0 ; + ret =0 ; + +free_skb: +dev_kfree_skb (skb); +return ret; } int wfx_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 211/713 arm64: dts: qcom: msm8998: switch USB QMP PHY to new style of bindings
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit b7efebfeb2e8ad8187cdabba5f0212ba2e6c1069 ]
Change the USB QMP PHY to use newer style of QMP PHY bindings (single resource region, no per-PHY subnodes).
Stable-dep-of: fc835b2311d4 ("arm64: dts: qcom: msm8998: declare VLS CLAMP register for USB3 PHY")
--- arch/arm64/boot/dts/qcom/msm8998.dtsi | 35 +++++++++++---------------- 1 file changed, 14 insertions(+), 21 deletions(-)
arch/arm64/boot/dts/qcom/msm8998.dtsi +14 -21
@@ -2157,7 +2157,7 @@ usb3_dwc3: usb@a800000 { interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>; snps,dis_u2_susphy_quirk; snps,dis_enblslpm_quirk; - phys = <&qusb2phy>, <&usb1_ssphy>; + phys = <&qusb2phy>, <&usb3phy>; phy-names = "usb2-phy", "usb3-phy"; snps,has-lpm-erratum; snps,hird-threshold = /bits/ 8 <0x10>;
@@ -2166,33 +2166,26 @@ usb3_dwc3: usb@a800000 { usb3phy: phy@c010000 { compatible = "qcom,msm8998-qmp-usb3-phy"; - reg = <0x0c010000 0x18c>; - status = "disabled"; - #address-cells = <1>; - #size-cells = <1>; - ranges; + reg = <0x0c010000 0x1000>; clocks = <&gcc GCC_USB3_PHY_AUX_CLK>, + <&gcc GCC_USB3_CLKREF_CLK>, <&gcc GCC_USB_PHY_CFG_AHB2PHY_CLK>, - <&gcc GCC_USB3_CLKREF_CLK>; - clock-names = "aux", "cfg_ahb", "ref"; + <&gcc GCC_USB3_PHY_PIPE_CLK>; + clock-names = "aux", + "ref", + "cfg_ahb", + "pipe"; + clock-output-names = "usb3_phy_pipe_clk_src"; + #clock-cells = <0>; + #phy-cells = <0>; resets = <&gcc GCC_USB3_PHY_BCR>, <&gcc GCC_USB3PHY_PHY_BCR>; - reset-names = "phy", "common"; + reset-names = "phy", + "phy_phy"; - usb1_ssphy: phy@c010200 { - reg = <0xc010200 0x128>, - <0xc010400 0x200>, - <0xc010c00 0x20c>, - <0xc010600 0x128>, - <0xc010800 0x200>; - #phy-cells = <0>; - #clock-cells = <0>; - clocks = <&gcc GCC_USB3_PHY_PIPE_CLK>; - clock-names = "pipe0"; - clock-output-names = "usb3_phy_pipe_clk_src"; - }; + status = "disabled"; }; qusb2phy: phy@c012000 {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 212/713 arm64: dts: qcom: msm8998: declare VLS CLAMP register for USB3 PHY
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit fc835b2311d4deb85d776c1d73562338462aa7ac ]
The USB3 PHY on the MSM8998 platform doesn't have built-in PCS_MISC_CLAMP_ENABLE register. Instead clamping is handled separately via the register in the TCSR space. Declare corresponding register.
--- arch/arm64/boot/dts/qcom/msm8998.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/qcom/msm8998.dtsi +7 -0
@@ -1082,6 +1082,11 @@ tcsr_regs_1: syscon@1f60000 { reg = <0x01f60000 0x20000>; }; + tcsr_regs_2: syscon@1fc0000 { + compatible = "qcom,msm8998-tcsr", "syscon"; + reg = <0x01fc0000 0x26000>; + }; + tlmm: pinctrl@3400000 { compatible = "qcom,msm8998-pinctrl"; reg = <0x03400000 0xc00000>;
@@ -2185,6 +2190,8 @@ usb3phy: phy@c010000 { reset-names = "phy", "phy_phy"; + qcom,tcsr-reg = <&tcsr_regs_2 0xb244>; + status = "disabled"; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 213/713 arm64: dts: qcom: qcm2290: declare VLS CLAMP register for USB3 PHY
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit acb94d67f5a23dbb2e0021b6c30609ed05d7d6a5 ]
The USB3 PHY on the QCM2290 platform doesn't have built-in PCS_MISC_CLAMP_ENABLE register. Instead clamping is handled separately via the register in the TCSR space. Declare corresponding register.
--- arch/arm64/boot/dts/qcom/qcm2290.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/qcom/qcm2290.dtsi +7 -0
@@ -418,6 +418,11 @@ tcsr_mutex: hwlock@340000 { #hwlock-cells = <1>; }; + tcsr_regs: syscon@3c0000 { + compatible = "qcom,qcm2290-tcsr", "syscon"; + reg = <0x0 0x003c0000 0x0 0x40000>; + }; + tlmm: pinctrl@500000 { compatible = "qcom,qcm2290-tlmm"; reg = <0x0 0x00500000 0x0 0x300000>;
@@ -665,6 +670,8 @@ usb_qmpphy: phy@1615000 { #phy-cells = <0>; + qcom,tcsr-reg = <&tcsr_regs 0xb244>; + status = "disabled"; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 214/713 arm64: dts: qcom: sm6115: declare VLS CLAMP register for USB3 PHY
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 95d739ed962c9aaa17d77b739606dbdf31879f6e ]
The USB3 PHY on the SM6115 platform doesn't have built-in PCS_MISC_CLAMP_ENABLE register. Instead clamping is handled separately via the register in the TCSR space. Declare corresponding register.
--- arch/arm64/boot/dts/qcom/sm6115.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/qcom/sm6115.dtsi +7 -0
@@ -591,6 +591,11 @@ tcsr_mutex: hwlock@340000 { #hwlock-cells = <1>; }; + tcsr_regs: syscon@3c0000 { + compatible = "qcom,sm6115-tcsr", "syscon"; + reg = <0x0 0x003c0000 0x0 0x40000>; + }; + tlmm: pinctrl@500000 { compatible = "qcom,sm6115-tlmm"; reg = <0x0 0x00500000 0x0 0x400000>,
@@ -856,6 +861,8 @@ usb_qmpphy: phy@1615000 { #phy-cells = <0>; + qcom,tcsr-reg = <&tcsr_regs 0xb244>; + status = "disabled"; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 215/713 wifi: ath12k: fix incorrect logic of calculating vdev_stats_id
In reply to Sasha LevinFrom: Kang Yang <[email protected]>
[ Upstream commit 019b58dcb6ed267e17b7efd03ec8575c1b67d942 ]
During calculate vdev_stats_id, will compare vdev_stats_id with ATH12K_INVAL_VDEV_STATS_ID by '<='. If vdev_stats_id is relatively small, then assign ATH12K_INVAL_VDEV_STATS_ID to vdev_stats_id.
This logic is incorrect. Firstly, should use '>=' instead of '<=' to check if this u8 variable exceeds the max valid range.
Secondly, should use the maximum value as comparison value.
Correct comparison symbols and use the maximum value ATH12K_MAX_VDEV_STATS_ID for comparison.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
--- drivers/net/wireless/ath/ath12k/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath12k/mac.c +1 -1
@@ -5261,7 +5261,7 @@ ath12k_mac_get_vdev_stats_id(struct ath12k_vif *arvif) do { if (ab->free_vdev_stats_id_map & (1LL << vdev_stats_id)) { vdev_stats_id++; - if (vdev_stats_id <= ATH12K_INVAL_VDEV_STATS_ID) { + if (vdev_stats_id >= ATH12K_MAX_VDEV_STATS_ID) { vdev_stats_id = ATH12K_INVAL_VDEV_STATS_ID; break; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 216/713 printk: nbcon: Relocate 32bit seq macros
In reply to Sasha LevinFrom: John Ogness <[email protected]>
[ Upstream commit 5b73e706f00f3553e1a4efbb31951ce9fe18f2dc ]
The macros __seq_to_nbcon_seq() and __nbcon_seq_to_seq() are used to provide support for atomic handling of sequence numbers on 32bit systems. Until now this was only used by nbcon.c, which is why they were located in nbcon.c and include nbcon in the name.
In a follow-up commit this functionality is also needed by printk_ringbuffer. Rather than duplicating the functionality, relocate the macros to printk_ringbuffer.h.
Also, since the macros will be no longer nbcon-specific, rename them to __u64seq_to_ulseq() and __ulseq_to_u64seq().
This does not result in any functional change.
Stable-dep-of: 5f72e52ba959 ("printk: ringbuffer: Do not skip non-finalized records with prb_next_seq()")
--- kernel/printk/nbcon.c | 41 +++---------------------------- kernel/printk/printk_ringbuffer.h | 33 +++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 37 deletions(-)
kernel/printk/nbcon.c +4 -37
@@ -140,39 +140,6 @@ static inline bool nbcon_state_try_cmpxchg(struct console *con, struct nbcon_stareturn atomic_try_cmpxchg (&ACCESS_PRIVATE (con, nbcon_state), &cur->atom, new->atom); } -#ifdef CONFIG_64BIT - -#define __seq_to_nbcon_seq (seq) (seq) -#define __nbcon_seq_to_seq (seq) (seq) - -#else /* CONFIG_64BIT */ - -#define __seq_to_nbcon_seq (seq) ((u32)seq) - -static inline u64 __nbcon_seq_to_seq (u32 nbcon_seq) -{ -u64 seq; -u64 rb_next_seq; - -/* -* The provided sequence is only the lower 32 bits of the ringbuffer -* sequence. It needs to be expanded to 64bit. Get the next sequence -* number from the ringbuffer and fold it. -* -* Having a 32bit representation in the console is sufficient. -* If a console ever gets more than 2^31 records behind -* the ringbuffer then this is the least of the problems. -* -* Also the access to the ring buffer is always safe. -*/ - rb_next_seq =prb_next_seq (prb); - seq = rb_next_seq - ((u32 )rb_next_seq - nbcon_seq); - -return seq; -} - -#endif /* CONFIG_64BIT */ -/** * nbcon_seq_read - Read the current console sequence * @con: Console to read the sequence of
@@ -183,7 +150,7 @@ u64 nbcon_seq_read(struct console *con) {unsigned long nbcon_seq =atomic_long_read (&ACCESS_PRIVATE (con, nbcon_seq)); -return __nbcon_seq_to_seq (nbcon_seq); +return __ulseq_to_u64seq (prb, nbcon_seq); }/**
@@ -204,7 +171,7 @@ void nbcon_seq_force(struct console *con, u64 seq)*/ u64 valid_seq =max_t (u64, seq,prb_first_valid_seq (prb)); -atomic_long_set (&ACCESS_PRIVATE (con, nbcon_seq),__seq_to_nbcon_seq (valid_seq)); +atomic_long_set (&ACCESS_PRIVATE (con, nbcon_seq),__u64seq_to_ulseq (valid_seq));/* Clear con->seq since nbcon consoles use con->nbcon_seq instead. */ con->seq =0 ;
@@ -223,11 +190,11 @@ void nbcon_seq_force(struct console *con, u64 seq)*/ static void nbcon_seq_try_update (struct nbcon_context *ctxt,u64 new_seq) { -unsigned long nbcon_seq =__seq_to_nbcon_seq (ctxt->seq); +unsigned long nbcon_seq =__u64seq_to_ulseq (ctxt->seq);struct console *con = ctxt->console;if (atomic_long_try_cmpxchg (&ACCESS_PRIVATE (con, nbcon_seq), &nbcon_seq, -__seq_to_nbcon_seq (new_seq))) { +__u64seq_to_ulseq (new_seq))) { ctxt->seq = new_seq; }else { ctxt->seq =nbcon_seq_read (con);
kernel/printk/printk_ringbuffer.h +33 -0
@@ -381,4 +381,37 @@ bool prb_read_valid_info(struct printk_ringbuffer *rb, u64 seq,u64 prb_first_valid_seq (struct printk_ringbuffer *rb);u64 prb_next_seq (struct printk_ringbuffer *rb); +#ifdef CONFIG_64BIT + +#define __u64seq_to_ulseq (u64seq) (u64seq) +#define __ulseq_to_u64seq (rb, ulseq) (ulseq) + +#else /* CONFIG_64BIT */ + +#define __u64seq_to_ulseq (u64seq) ((u32)u64seq) + +static inline u64 __ulseq_to_u64seq (struct printk_ringbuffer *rb,u32 ulseq) +{ +u64 seq; +u64 rb_next_seq; + +/* +* The provided sequence is only the lower 32 bits of the ringbuffer +* sequence. It needs to be expanded to 64bit. Get the next sequence +* number from the ringbuffer and fold it. +* +* Having a 32bit representation in the console is sufficient. +* If a console ever gets more than 2^31 records behind +* the ringbuffer then this is the least of the problems. +* +* Also the access to the ring buffer is always safe. +*/ + rb_next_seq =prb_next_seq (rb); + seq = rb_next_seq - ((u32 )rb_next_seq - ulseq); + +return seq; +} + +#endif /* CONFIG_64BIT */ +#endif /* _KERNEL_PRINTK_RINGBUFFER_H */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 217/713 printk: ringbuffer: Do not skip non-finalized records with prb_next_seq()
In reply to Sasha LevinFrom: John Ogness <[email protected]>
[ Upstream commit 5f72e52ba959e50680b8d83599da1368cd7a6ee2 ]
Commit f244b4dc53e5 ("printk: ringbuffer: Improve prb_next_seq() performance") introduced an optimization for prb_next_seq() by using best-effort to track recently finalized records. However, the order of finalization does not necessarily match the order of the records. The optimization changed prb_next_seq() to return inconsistent results, possibly yielding sequence numbers that are not available to readers because they are preceded by non-finalized records or they are not yet visible to the reader CPU.
Rather than simply best-effort tracking recently finalized records, force the committing writer to read records and increment the last "contiguous block" of finalized records. In order to do this, the sequence number instead of ID must be stored because ID's cannot be directly compared.
A new memory barrier pair is introduced to guarantee that a reader can always read the records up until the sequence number returned by prb_next_seq() (unless the records have since been overwritten in the ringbuffer).
This restores the original functionality of prb_next_seq() while also keeping the optimization.
For 32bit systems, only the lower 32 bits of the sequence number are stored. When reading the value, it is expanded to the full 64bit sequence number using the 32bit seq macros, which fold in the value returned by prb_first_seq().
--- kernel/printk/printk_ringbuffer.c | 164 +++++++++++++++++++++++------- kernel/printk/printk_ringbuffer.h | 4 +- 2 files changed, 127 insertions(+), 41 deletions(-)
kernel/printk/printk_ringbuffer.c +125 -39
@@ -6,6 +6,7 @@#include <linux/errno.h> #include <linux/bug.h> #include "printk_ringbuffer.h" +#include "internal.h" /** * DOC: printk_ringbuffer overview
@@ -303,6 +304,9 @@* * desc_push_tail:B / desc_reserve:D * set descriptor reusable (state), then push descriptor tail (id) +* +* desc_update_last_finalized:A / desc_last_finalized_seq:A +* store finalized record, then set new highest finalized sequence number */ #define DATA_SIZE (data_ring) _DATA_SIZE((data_ring)->size_bits)
@@ -1441,20 +1445,118 @@ bool prb_reserve_in_last(struct prb_reserved_entry *e, struct printk_ringbufferreturn false; } +/* +* @last_finalized_seq value guarantees that all records up to and including +* this sequence number are finalized and can be read. The only exception are +* too old records which have already been overwritten. +* +* It is also guaranteed that @last_finalized_seq only increases. +* +* Be aware that finalized records following non-finalized records are not +* reported because they are not yet available to the reader. For example, +* a new record stored via printk() will not be available to a printer if +* it follows a record that has not been finalized yet. However, once that +* non-finalized record becomes finalized, @last_finalized_seq will be +* appropriately updated and the full set of finalized records will be +* available to the printer. And since each printk() caller will either +* directly print or trigger deferred printing of all available unprinted +* records, all printk() messages will get printed. +*/ +static u64 desc_last_finalized_seq (struct printk_ringbuffer *rb) +{ +struct prb_desc_ring *desc_ring = &rb->desc_ring; +unsigned long ulseq; + +/* +* Guarantee the sequence number is loaded before loading the +* associated record in order to guarantee that the record can be +* seen by this CPU. This pairs with desc_update_last_finalized:A. +*/ + ulseq =atomic_long_read_acquire (&desc_ring->last_finalized_seq + );/* LMM(desc_last_finalized_seq:A) */ + +return __ulseq_to_u64seq (rb, ulseq); +} + +static bool _prb_read_valid (struct printk_ringbuffer *rb,u64 *seq, +struct printk_record *r,unsigned int *line_count); + +/* +* Check if there are records directly following @last_finalized_seq that are +* finalized. If so, update @last_finalized_seq to the latest of these +* records. It is not allowed to skip over records that are not yet finalized. +*/ +static void desc_update_last_finalized (struct printk_ringbuffer *rb) +{ +struct prb_desc_ring *desc_ring = &rb->desc_ring; +u64 old_seq =desc_last_finalized_seq (rb); +unsigned long oldval; +unsigned long newval; +u64 finalized_seq; +u64 try_seq; + +try_again: + finalized_seq = old_seq; + try_seq = finalized_seq +1 ; + +/* Try to find later finalized records. */ +while (_prb_read_valid (rb, &try_seq,NULL ,NULL )) { + finalized_seq = try_seq; + try_seq++; + } + +/* No update needed if no later finalized record was found. */ +if (finalized_seq == old_seq) +return ; + + oldval =__u64seq_to_ulseq (old_seq); + newval =__u64seq_to_ulseq (finalized_seq); + +/* +* Set the sequence number of a later finalized record that has been +* seen. +* +* Guarantee the record data is visible to other CPUs before storing +* its sequence number. This pairs with desc_last_finalized_seq:A. +* +* Memory barrier involvement: +* +* If desc_last_finalized_seq:A reads from +* desc_update_last_finalized:A, then desc_read:A reads from +* _prb_commit:B. +* +* Relies on: +* +* RELEASE from _prb_commit:B to desc_update_last_finalized:A +* matching +* ACQUIRE from desc_last_finalized_seq:A to desc_read:A +* +* Note: _prb_commit:B and desc_update_last_finalized:A can be +* different CPUs. However, the desc_update_last_finalized:A +* CPU (which performs the release) must have previously seen +* _prb_commit:B. +*/ +if (!atomic_long_try_cmpxchg_release (&desc_ring->last_finalized_seq, + &oldval, newval)) {/* LMM(desc_update_last_finalized:A) */ + old_seq =__ulseq_to_u64seq (rb, oldval); + goto try_again; + } +} +/* * Attempt to finalize a specified descriptor. If this fails, the descriptor * is either already final or it will finalize itself when the writer commits. */ -static void desc_make_final (struct prb_desc_ring *desc_ring,unsigned long id) +static void desc_make_final (struct printk_ringbuffer *rb,unsigned long id) { +struct prb_desc_ring *desc_ring = &rb->desc_ring;unsigned long prev_state_val =DESC_SV (id, desc_committed);struct prb_desc *d =to_desc (desc_ring, id); -atomic_long_cmpxchg_relaxed (&d->state_var, prev_state_val, -DESC_SV (id, desc_finalized));/* LMM(desc_make_final:A) */ - -/* Best effort to remember the last finalized @id. */ -atomic_long_set (&desc_ring->last_finalized_id, id); +if (atomic_long_try_cmpxchg_relaxed (&d->state_var, &prev_state_val, +DESC_SV (id, desc_finalized))) {/* LMM(desc_make_final:A) */ +desc_update_last_finalized (rb); + } }/**
@@ -1550,7 +1652,7 @@ bool prb_reserve(struct prb_reserved_entry *e, struct printk_ringbuffer *rb,* readers. (For seq==0 there is no previous descriptor.) */ if (info->seq >0 ) -desc_make_final (desc_ring,DESC_ID (id -1 )); +desc_make_final (rb,DESC_ID (id -1 )); r->text_buf =data_alloc (rb, r->text_buf_size, &d->text_blk_lpos, id);/* If text data allocation fails, a data-less record is committed. */
@@ -1643,7 +1745,7 @@ void prb_commit(struct prb_reserved_entry *e)*/ head_id =atomic_long_read (&desc_ring->head_id);/* LMM(prb_commit:A) */ if (head_id != e->id) -desc_make_final (desc_ring, e->id); +desc_make_final (e->rb, e->id); }/**
@@ -1663,12 +1765,9 @@ void prb_commit(struct prb_reserved_entry *e)*/ void prb_final_commit (struct prb_reserved_entry *e) { -struct prb_desc_ring *desc_ring = &e->rb->desc_ring; -_prb_commit (e, desc_finalized); -/* Best effort to remember the last finalized @id. */ -atomic_long_set (&desc_ring->last_finalized_id, e->id); +desc_update_last_finalized (e->rb); }/*
@@ -2008,7 +2107,9 @@ u64 prb_first_valid_seq(struct printk_ringbuffer *rb)* newest sequence number available to readers will be. * * This provides readers a sequence number to jump to if all currently -* available records should be skipped. +* available records should be skipped. It is guaranteed that all records +* previous to the returned value have been finalized and are (or were) +* available to the reader. * * Context: Any context. * Return: The sequence number of the next newest (not yet available) record
@@ -2016,34 +2117,19 @@ u64 prb_first_valid_seq(struct printk_ringbuffer *rb)*/ u64 prb_next_seq (struct printk_ringbuffer *rb) { -struct prb_desc_ring *desc_ring = &rb->desc_ring; -enum desc_state d_state; -unsigned long id;u64 seq; -/* Check if the cached @id still points to a valid @seq. */ - id =atomic_long_read (&desc_ring->last_finalized_id); - d_state =desc_read (desc_ring, id,NULL , &seq,NULL ); + seq =desc_last_finalized_seq (rb); -if (d_state == desc_finalized || d_state == desc_reusable) { -/* -* Begin searching after the last finalized record. -* -* On 0, the search must begin at 0 because of hack#2 -* of the bootstrapping phase it is not known if a -* record at index 0 exists. -*/ -if (seq !=0 ) - seq++; - }else { -/* -* The information about the last finalized sequence number -* has gone. It should happen only when there is a flood of -* new messages and the ringbuffer is rapidly recycled. -* Give up and start from the beginning. -*/ - seq =0 ; - } +/* +* Begin searching after the last finalized record. +* +* On 0, the search must begin at 0 because of hack#2 +* of the bootstrapping phase it is not known if a +* record at index 0 exists. +*/ +if (seq !=0 ) + seq++;/* * The information about the last finalized @seq might be inaccurate.
@@ -2085,7 +2171,7 @@ void prb_init(struct printk_ringbuffer *rb, rb->desc_ring.infos = infos;atomic_long_set (&rb->desc_ring.head_id,DESC0_ID (descbits));atomic_long_set (&rb->desc_ring.tail_id,DESC0_ID (descbits)); -atomic_long_set (&rb->desc_ring.last_finalized_id,DESC0_ID (descbits)); +atomic_long_set (&rb->desc_ring.last_finalized_seq,0 ); rb->text_data_ring.size_bits = textbits; rb->text_data_ring.data = text_buf;
kernel/printk/printk_ringbuffer.h +2 -2
@@ -75,7 +75,7 @@ struct prb_desc_ring {struct printk_info *infos;atomic_long_t head_id;atomic_long_t tail_id; -atomic_long_t last_finalized_id; +atomic_long_t last_finalized_seq; };/*
@@ -259,7 +259,7 @@ static struct printk_ringbuffer name = { \ .infos = &_##name##_infos[0], \ .head_id = ATOMIC_INIT(DESC0_ID(descbits)), \ .tail_id = ATOMIC_INIT(DESC0_ID(descbits)), \ - .last_finalized_id = ATOMIC_INIT(DESC0_ID(descbits)), \ + .last_finalized_seq = ATOMIC_INIT(0), \ }, \ .text_data_ring = { \ .size_bits = (avgtextbits) + (descbits), \
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 218/713 printk: Wait for all reserved records with pr_flush()
In reply to Sasha LevinFrom: John Ogness <[email protected]>
[ Upstream commit ac7d7844c64d15603daa3e905a311ddcfbb4bc91 ]
Currently pr_flush() will only wait for records that were available to readers at the time of the call (using prb_next_seq()). But there may be more records (non-finalized) that have following finalized records. pr_flush() should wait for these to print as well. Particularly because any trailing finalized records may be the messages that the calling context wants to ensure are printed.
Add a new ringbuffer function prb_next_reserve_seq() to return the sequence number following the most recently reserved record. This guarantees that pr_flush() will wait until all current printk() messages (completed or in progress) have been printed.
--- kernel/printk/printk.c | 2 +- kernel/printk/printk_ringbuffer.c | 105 ++++++++++++++++++++++++++++++ kernel/printk/printk_ringbuffer.h | 1 + 3 files changed, 107 insertions(+), 1 deletion(-)
kernel/printk/printk.c +1 -1
@@ -3761,7 +3761,7 @@ static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progremight_sleep (); - seq =prb_next_seq (prb); + seq =prb_next_reserve_seq (prb);/* Flush the consoles so that records up to @seq are printed. */ console_lock ();
kernel/printk/printk_ringbuffer.c +105 -0
111 lines not on this page · raw message
kernel/printk/printk_ringbuffer.h +1 -0
@@ -380,6 +380,7 @@ bool prb_read_valid_info(struct printk_ringbuffer *rb, u64 seq,u64 prb_first_valid_seq (struct printk_ringbuffer *rb);u64 prb_next_seq (struct printk_ringbuffer *rb); +u64 prb_next_reserve_seq (struct printk_ringbuffer *rb);#ifdef CONFIG_64BIT
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 219/713 printk: Add this_cpu_in_panic()
In reply to Sasha LevinFrom: John Ogness <[email protected]>
[ Upstream commit 36652d0f3bf34899e82d31a5fa9e2bdd02fd6381 ]
There is already panic_in_progress() and other_cpu_in_panic(), but checking if the current CPU is the panic CPU must still be open coded.
Add this_cpu_in_panic() to complete the set.
Stable-dep-of: b1c4c67a5e90 ("printk: ringbuffer: Skip non-finalized records in panic")
--- kernel/printk/internal.h | 1 + kernel/printk/printk.c | 43 +++++++++++++++++++++------------------- 2 files changed, 24 insertions(+), 20 deletions(-)
kernel/printk/internal.h +1 -0
@@ -130,6 +130,7 @@ struct printk_message { };bool other_cpu_in_panic (void ); +bool this_cpu_in_panic (void );bool printk_get_next_message (struct printk_message *pmsg,u64 seq,bool is_extended,bool may_supress);
kernel/printk/printk.c +23 -20
55 lines not on this page · raw message
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 220/713 printk: ringbuffer: Cleanup reader terminology
In reply to Sasha LevinFrom: John Ogness <[email protected]>
[ Upstream commit 584528d621459d1a5c31da7a591218ad3bb96d6c ]
With the lockless ringbuffer, it is allowed that multiple CPUs/contexts write simultaneously into the buffer. This creates an ambiguity as some writers will finalize sooner.
The documentation for the prb_read functions is not clear as it refers to "not yet written" and "no data available". Clarify the return values and language to be in terms of the reader: records available for reading.
Stable-dep-of: b1c4c67a5e90 ("printk: ringbuffer: Skip non-finalized records in panic")
--- kernel/printk/printk_ringbuffer.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
kernel/printk/printk_ringbuffer.c +9 -7
@@ -2080,11 +2080,13 @@ u64 prb_next_reserve_seq(struct printk_ringbuffer *rb) }/* -* Non-blocking read of a record. Updates @seq to the last finalized record -* (which may have no data available). +* Non-blocking read of a record. * -* See the description of prb_read_valid() and prb_read_valid_info() -* for details. +* On success @seq is updated to the record that was read and (if provided) +* @r and @line_count will contain the read/calculated data. +* +* On failure @seq is updated to a record that is not yet available to the +* reader, but it will be the next record available to the reader. */ static bool _prb_read_valid (struct printk_ringbuffer *rb,u64 *seq,struct printk_record *r,unsigned int *line_count)
@@ -2103,7 +2105,7 @@ static bool _prb_read_valid(struct printk_ringbuffer *rb, u64 *seq, *seq = tail_seq; }else if (err == -ENOENT ) { -/* Record exists, but no data available. Skip. */ +/* Record exists, but the data was lost. Skip. */ (*seq)++; }else {
@@ -2136,7 +2138,7 @@ static bool _prb_read_valid(struct printk_ringbuffer *rb, u64 *seq,* On success, the reader must check r->info.seq to see which record was * actually read. This allows the reader to detect dropped records. * -* Failure means @seq refers to a not yet written record. +* Failure means @seq refers to a record not yet available to the reader. */ bool prb_read_valid (struct printk_ringbuffer *rb,u64 seq,struct printk_record *r)
@@ -2166,7 +2168,7 @@ bool prb_read_valid(struct printk_ringbuffer *rb, u64 seq,* On success, the reader must check info->seq to see which record meta data * was actually read. This allows the reader to detect dropped records. * -* Failure means @seq refers to a not yet written record. +* Failure means @seq refers to a record not yet available to the reader. */ bool prb_read_valid_info (struct printk_ringbuffer *rb,u64 seq,struct printk_info *info,unsigned int *line_count)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 221/713 printk: ringbuffer: Skip non-finalized records in panic
In reply to Sasha LevinFrom: John Ogness <[email protected]>
[ Upstream commit b1c4c67a5e90db8fbdb5b5504fe16e17b564cca8 ]
Normally a reader will stop once reaching a non-finalized record. However, when a panic happens, writers from other CPUs (or an interrupted context on the panic CPU) may have been writing a record and were unable to finalize it. The panic CPU will reserve/commit/finalize its panic records, but these will be located after the non-finalized records. This results in panic() not flushing the panic messages.
Extend _prb_read_valid() to skip over non-finalized records if on the panic CPU.
--- kernel/printk/printk_ringbuffer.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-)
kernel/printk/printk_ringbuffer.c +26 -2
@@ -2087,6 +2087,10 @@ u64 prb_next_reserve_seq(struct printk_ringbuffer *rb)* * On failure @seq is updated to a record that is not yet available to the * reader, but it will be the next record available to the reader. +* +* Note: When the current CPU is in panic, this function will skip over any +* non-existent/non-finalized records in order to allow the panic CPU +* to print any and all records that have been finalized. */ static bool _prb_read_valid (struct printk_ringbuffer *rb,u64 *seq,struct printk_record *r,unsigned int *line_count)
@@ -2109,8 +2113,28 @@ static bool _prb_read_valid(struct printk_ringbuffer *rb, u64 *seq, (*seq)++; }else { -/* Non-existent/non-finalized record. Must stop. */ -return false; +/* +* Non-existent/non-finalized record. Must stop. +* +* For panic situations it cannot be expected that +* non-finalized records will become finalized. But +* there may be other finalized records beyond that +* need to be printed for a panic situation. If this +* is the panic CPU, skip this +* non-existent/non-finalized record unless it is +* at or beyond the head, in which case it is not +* possible to continue. +* +* Note that new messages printed on panic CPU are +* finalized when we are here. The only exception +* might be the last message without trailing newline. +* But it would have the sequence number returned +* by "prb_next_reserve_seq() - 1". +*/ +if (this_cpu_in_panic () && ((*seq +1 ) <prb_next_reserve_seq (rb))) + (*seq)++; +else +return false; } }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 222/713 printk: Disable passing console lock owner completely during panic()
In reply to Sasha LevinFrom: Petr Mladek <[email protected]>
[ Upstream commit d04d5882cd678b898a9d7c5aee6afbe9e6e77fcd ]
The commit d51507098ff91 ("printk: disable optimistic spin during panic") added checks to avoid becoming a console waiter if a panic is in progress.
However, the transition to panic can occur while there is already a waiter. The current owner should not pass the lock to the waiter because it might get stopped or blocked anytime.
Also the panic context might pass the console lock owner to an already stopped waiter by mistake. It might happen when console_flush_on_panic() ignores the current lock owner, for example:
CPU0 CPU1
---- ----console_lock_spinning_enable()
console_trylock_spinning()
[CPU1 now console waiter]
NMI: panic()
panic_other_cpus_shutdown()
[stopped as console waiter]
console_flush_on_panic()
console_lock_spinning_enable()
[print 1 record] console_lock_spinning_disable_and_check()
[handover to stopped CPU1]
This results in panic() not flushing the panic messages.
Fix these problems by disabling all spinning operations completely during panic().
Another advantage is that it prevents possible deadlocks caused by "console_owner_lock". The panic() context does not need to take it any longer. The lockless checks are safe because the functions become NOPs when they see the panic in progress. All operations manipulating the state are still synchronized by the lock even when non-panic CPUs would notice the panic synchronously.
The current owner might stay spinning. But non-panic() CPUs would get stopped anyway and the panic context will never start spinning.
--- kernel/printk/printk.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
kernel/printk/printk.c +29 -0
@@ -1869,10 +1869,23 @@ static bool console_waiter;*/ static void console_lock_spinning_enable (void ) { +/* +* Do not use spinning in panic(). The panic CPU wants to keep the lock. +* Non-panic CPUs abandon the flush anyway. +* +* Just keep the lockdep annotation. The panic-CPU should avoid +* taking console_owner_lock because it might cause a deadlock. +* This looks like the easiest way how to prevent false lockdep +* reports without handling races a lockless way. +*/ +if (panic_in_progress ()) + goto lockdep; +raw_spin_lock (&console_owner_lock); console_owner = current;raw_spin_unlock (&console_owner_lock); +lockdep:/* The waiter may spin on us after setting console_owner */ spin_acquire (&console_owner_dep_map,0 ,0 , _THIS_IP_); }
@@ -1897,6 +1910,22 @@ static int console_lock_spinning_disable_and_check(int cookie) {int waiter; +/* +* Ignore spinning waiters during panic() because they might get stopped +* or blocked at any time, +* +* It is safe because nobody is allowed to start spinning during panic +* in the first place. If there has been a waiter then non panic CPUs +* might stay spinning. They would get stopped anyway. The panic context +* will never start spinning and an interrupted spin on panic CPU will +* never continue. +*/ +if (panic_in_progress ()) { +/* Keep lockdep happy. */ +spin_release (&console_owner_dep_map, _THIS_IP_); +return 0 ; + } +raw_spin_lock (&console_owner_lock); waiter =READ_ONCE (console_waiter); console_owner =NULL ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 223/713 pwm: sti: Fix capture for st,pwm-num-chan < st,capture-num-chan
In reply to Sasha LevinFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit 5f623835584f1c8d1030666796f40c47a448ce0b ]
The driver only used the number of pwm channels to set the pwm_chip's npwm member. The result is that if there are more capture channels than PWM channels specified in the device tree, only a part of the capture channel is usable. Fix that by passing the bigger channel count to the pwm framework. This makes it possible that the .apply() callback is called with .hwpwm >= pwm_num_devs, catch that case and return an error code.
--- drivers/pwm/pwm-sti.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
drivers/pwm/pwm-sti.c +10 -1
@@ -395,8 +395,17 @@ static int sti_pwm_capture(struct pwm_chip *chip, struct pwm_device *pwm,static int sti_pwm_apply (struct pwm_chip *chip,struct pwm_device *pwm,const struct pwm_state *state) { +struct sti_pwm_chip *pc =to_sti_pwmchip (chip); +struct sti_pwm_compat_data *cdata = pc->cdata; +struct device *dev = pc->dev;int err; +if (pwm->hwpwm >= cdata->pwm_num_devs) { +dev_err (dev,"device %u is not valid for pwm mode\n" , + pwm->hwpwm); +return -EINVAL ; + } +if (state->polarity !=PWM_POLARITY_NORMAL )return -EINVAL ;
@@ -646,7 +655,7 @@ static int sti_pwm_probe(struct platform_device *pdev) pc->chip.dev = dev; pc->chip.ops = &sti_pwm_ops; - pc->chip.npwm = pc->cdata->pwm_num_devs; + pc->chip.npwm =max (cdata->pwm_num_devs, cdata->cpt_num_devs);for (i =0 ; i < cdata->cpt_num_devs; i++) {struct sti_cpt_ddata *ddata = &cdata->ddata[i];
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 224/713 tools/resolve_btfids: Refactor set sorting with types from btf_ids.h
In reply to Sasha LevinFrom: Viktor Malik <[email protected]>
[ Upstream commit 9707ac4fe2f5bac6406d2403f8b8a64d7b3d8e43 ]
Instead of using magic offsets to access BTF ID set data, leverage types from btf_ids.h (btf_id_set and btf_id_set8) which define the actual layout of the data. Thanks to this change, set sorting should also continue working if the layout changes.
This requires to sync the definition of 'struct btf_id_set8' from include/linux/btf_ids.h to tools/include/linux/btf_ids.h. We don't sync the rest of the file at the moment, b/c that would require to also sync multiple dependent headers and we don't need any other defs from btf_ids.h.
Stable-dep-of: 903fad439466 ("tools/resolve_btfids: Fix cross-compilation to non-host endianness")
--- tools/bpf/resolve_btfids/main.c | 35 ++++++++++++++++++++------------- tools/include/linux/btf_ids.h | 9 +++++++++ 2 files changed, 30 insertions(+), 14 deletions(-)
tools/bpf/resolve_btfids/main.c +21 -14
@@ -70,6 +70,7 @@#include <sys/stat.h> #include <fcntl.h> #include <errno.h> +#include <linux/btf_ids.h> #include <linux/rbtree.h> #include <linux/zalloc.h> #include <linux/err.h>
@@ -78,7 +79,7 @@#include <subcmd/parse-options.h> #define BTF_IDS_SECTION ".BTF_ids" -#define BTF_ID "__BTF_ID__" +#define BTF_ID_PREFIX "__BTF_ID__"#define BTF_STRUCT "struct"#define BTF_UNION "union"
@@ -161,7 +162,7 @@ static int eprintf(int level, int var, const char *fmt, ...)static bool is_btf_id (const char *name) { -return name && !strncmp (name,BTF_ID ,sizeof (BTF_ID ) -1 ); +return name && !strncmp (name,BTF_ID_PREFIX ,sizeof (BTF_ID_PREFIX ) -1 ); }static struct btf_id *btf_id__find (struct rb_root *root,const char *name)
@@ -441,7 +442,7 @@ static int symbols_collect(struct object *obj)* __BTF_ID__TYPE__vfs_truncate__0 * prefix = ^ */ - prefix = name +sizeof (BTF_ID ) -1 ; + prefix = name +sizeof (BTF_ID_PREFIX ) -1 ;/* struct */ if (!strncmp (prefix,BTF_STRUCT ,sizeof (BTF_STRUCT ) -1 )) {
@@ -649,19 +650,18 @@ static int cmp_id(const void *pa, const void *pb)static int sets_patch (struct object *obj) {Elf_Data *data = obj->efile.idlist; -int *ptr = data->d_buf;struct rb_node *next; next =rb_first (&obj->sets);while (next) { -unsigned long addr, idx; +struct btf_id_set8 *set8; +struct btf_id_set *set; +unsigned long addr, off;struct btf_id *id; -int *base; -int cnt; id = rb_entry(next, struct btf_id, rb_node); addr = id->addr[0 ]; - idx = addr - obj->efile.idlist_addr; + off = addr - obj->efile.idlist_addr;/* sets are unique */ if (id->addr_cnt !=1 ) {
@@ -670,14 +670,21 @@ static int sets_patch(struct object *obj)return -1 ; } - idx = idx /sizeof (int ); - base = &ptr[idx] + (id->is_set8 ?2 :1 ); - cnt = ptr[idx]; +if (id->is_set) { + set = data->d_buf + off; +qsort (set->ids, set->cnt,sizeof (set->ids[0 ]), cmp_id); + }else { + set8 = data->d_buf + off; +/* +* Make sure id is at the beginning of the pairs +* struct, otherwise the below qsort would not work. +*/ +BUILD_BUG_ON (set8->pairs != &set8->pairs[0 ].id); +qsort (set8->pairs, set8->cnt,sizeof (set8->pairs[0 ]), cmp_id); + }pr_debug ("sorting addr %5lu: cnt %6d [%s]\n" , - (idx +1 ) *sizeof (int ), cnt, id->name); - -qsort (base, cnt, id->is_set8 ?sizeof (uint64_t ) :sizeof (int ), cmp_id); + off, id->is_set ? set->cnt : set8->cnt, id->name); next =rb_next (next); }
tools/include/linux/btf_ids.h +9 -0
@@ -8,6 +8,15 @@ struct btf_id_set {u32 ids[]; }; +struct btf_id_set8 { +u32 cnt; +u32 flags; +struct { +u32 id; +u32 flags; + } pairs[]; +}; +#ifdef CONFIG_DEBUG_INFO_BTF #include <linux/compiler.h> /* for __PASTE */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 225/713 tools/resolve_btfids: Fix cross-compilation to non-host endianness
In reply to Sasha LevinFrom: Viktor Malik <[email protected]>
[ Upstream commit 903fad4394666bc23975c93fb58f137ce64b5192 ]
The .BTF_ids section is pre-filled with zeroed BTF ID entries during the build and afterwards patched by resolve_btfids with correct values. Since resolve_btfids always writes in host-native endianness, it relies on libelf to do the translation when the target ELF is cross-compiled to a different endianness (this was introduced in commit 61e8aeda9398 ("bpf: Fix libelf endian handling in resolv_btfids")).
Unfortunately, the translation will corrupt the flags fields of SET8 entries because these were written during vmlinux compilation and are in the correct endianness already. This will lead to numerous selftests failures such as:
$ sudo ./test_verifier 502 502
#502/p sleepable fentry accept FAIL
Failed to load prog 'Invalid argument'!
bpf_fentry_test1 is not sleepable
verification time 34 usec
stack depth 0
processed 0 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0
Summary: 0 PASSED, 0 SKIPPED, 1 FAILEDSince it's not possible to instruct libelf to translate just certain values, let's manually bswap the flags (both global and entry flags) in resolve_btfids when needed, so that libelf then translates everything correctly.
--- tools/bpf/resolve_btfids/main.c | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+)
tools/bpf/resolve_btfids/main.c +35 -0
@@ -90,6 +90,14 @@#define ADDR_CNT 100 +#if __BYTE_ORDER == __LITTLE_ENDIAN +# define ELFDATANATIVE ELFDATA2LSB +#elif __BYTE_ORDER == __BIG_ENDIAN +# define ELFDATANATIVE ELFDATA2MSB +#else +# error "Unknown machine endianness!" +#endif +struct btf_id {struct rb_node rb_node;char *name;
@@ -117,6 +125,7 @@ struct object {int idlist_shndx;size_t strtabidx;unsigned long idlist_addr; +int encoding; } efile;struct rb_root sets;
@@ -320,6 +329,7 @@ static int elf_collect(struct object *obj) {Elf_Scn *scn =NULL ;size_t shdrstrndx; +GElf_Ehdr ehdr;int idx =0 ;Elf *elf;int fd;
@@ -351,6 +361,13 @@ static int elf_collect(struct object *obj)return -1 ; } +if (gelf_getehdr (obj->efile.elf, &ehdr) ==NULL ) { +pr_err ("FAILED cannot get ELF header: %s\n" , +elf_errmsg (-1 )); +return -1 ; + } + obj->efile.encoding = ehdr.e_ident[EI_DATA ]; +/* * Scan all the elf sections and look for save data * from .BTF_ids section and symbols.
@@ -681,6 +698,24 @@ static int sets_patch(struct object *obj)*/ BUILD_BUG_ON (set8->pairs != &set8->pairs[0 ].id);qsort (set8->pairs, set8->cnt,sizeof (set8->pairs[0 ]), cmp_id); + +/* +* When ELF endianness does not match endianness of the +* host, libelf will do the translation when updating +* the ELF. This, however, corrupts SET8 flags which are +* already in the target endianness. So, let's bswap +* them to the host endianness and libelf will then +* correctly translate everything. +*/ +if (obj->efile.encoding !=ELFDATANATIVE ) { +int i; + + set8->flags =bswap_32 (set8->flags); +for (i =0 ; i < set8->cnt; i++) { + set8->pairs[i].flags = +bswap_32 (set8->pairs[i].flags); + } + } } pr_debug("sorting addr %5lu: cnt %6d [%s]\n",
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 226/713 wifi: iwlwifi: support EHT for WH
In reply to Sasha LevinFrom: Miri Korenblit <[email protected]>
[ Upstream commit f51d6431824f0afb9f73d68971d154c47c26b86a ]
sku_cap_11be_enable should be set to true also for WH.
--- drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c +1 -1
@@ -2090,7 +2090,7 @@ struct iwl_nvm_data *iwl_get_nvm(struct iwl_trans *trans, !!(mac_flags &NVM_MAC_SKU_FLAGS_BAND_5_2_ENABLED ); nvm->sku_cap_mimo_disabled = !!(mac_flags &NVM_MAC_SKU_FLAGS_MIMO_DISABLED ); -if (CSR_HW_RFID_TYPE (trans->hw_rf_id) ==IWL_CFG_RF_TYPE_FM ) +if (CSR_HW_RFID_TYPE (trans->hw_rf_id) >=IWL_CFG_RF_TYPE_FM ) nvm->sku_cap_11be_enable = true;/* Initialize PHY sku data */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 227/713 wifi: iwlwifi: properly check if link is active
In reply to Sasha LevinFrom: Miri Korenblit <[email protected]>
[ Upstream commit 556c7cd721b5262579ba1710c3b4e7ffdb5573ac ]
Before sending SESSION PROTECTION cmd the driver verifies that the link for which the cmd is going to be sent is active. The existing code is checking it only for MLD vifs,
but also the deflink (in non-MLD vifs) needs to be active in order the have a session protection for it.
Fix this by checking if the link is active also for non-MLD vifs
--- drivers/net/wireless/intel/iwlwifi/mvm/time-event.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/time-event.c +1 -2
@@ -706,8 +706,7 @@ static int iwl_mvm_get_session_prot_id(struct iwl_mvm *mvm, "Invalid link ID for session protection: %u\n", link_id))return -EINVAL ; -if (WARN (ieee80211_vif_is_mld (vif) && - !(vif->active_links &BIT (link_id)), +if (WARN (!mvmvif->link[link_id]->active,"Session Protection on an inactive link: %u\n" , link_id))return -EINVAL ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 228/713 wifi: iwlwifi: mvm: fix erroneous queue index mask
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 2e0e766bd8a7f14f10c3e70b8203c4c1e6d9ec76 ]
When retrieving the queue index ("SCD SSN") from the TX response, it's currently masked with 0xFFF. However, now that we have queues longer than 4k, that became wrong, so make the mask depend on the hardware family.
This fixes an issue where if we get a single frame reclaim while in the top half of an 8k long queue, we'd reclaim-wrap the queue twice (once on this and then again on the next non-single reclaim) which at least triggers the WARN_ON_ONCE() in iwl_txq_reclaim(), but could have other negative side effects (such as unmapping a frame that wasn't transmitted yet, and then taking an IOMMU fault) as well.
--- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/tx.c +9 -3
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* -* Copyright (C) 2012-2014, 2018-2023 Intel Corporation +* Copyright (C) 2012-2014, 2018-2024 Intel Corporation * Copyright (C) 2013-2015 Intel Mobile Communications GmbH * Copyright (C) 2016-2017 Intel Deutschland GmbH */
@@ -1636,12 +1636,18 @@ static void iwl_mvm_tx_status_check_trigger(struct iwl_mvm *mvm,* of the batch. This is why the SSN of the SCD is written at the end of the * whole struct at a variable offset. This function knows how to cope with the * variable offset and returns the SSN of the SCD. +* +* For 22000-series and lower, this is just 12 bits. For later, 16 bits. */ static inline u32 iwl_mvm_get_scd_ssn (struct iwl_mvm *mvm,struct iwl_mvm_tx_resp *tx_resp) { -return le32_to_cpup ((__le32 *)iwl_mvm_get_agg_status (mvm, tx_resp) + - tx_resp->frame_count) &0xfff ; +u32 val =le32_to_cpup ((__le32 *)iwl_mvm_get_agg_status (mvm, tx_resp) + + tx_resp->frame_count); + +if (mvm->trans->trans_cfg->device_family >=IWL_DEVICE_FAMILY_AX210 ) +return val &0xFFFF ; +return val &0xFFF ; } static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 229/713 wifi: iwlwifi: mvm: don't set the MFP flag for the GTK
In reply to Sasha LevinFrom: Emmanuel Grumbach <[email protected]>
[ Upstream commit e35f316bce9e5733c9826120c1838f4c447b2c4c ]
The firmware doesn't need the MFP flag for the GTK, it can even make the firmware crash. in case the AP is configured with: group cipher TKIP and MFPC. We would send the GTK with cipher = TKIP and MFP which is of course not possible.
--- .../net/wireless/intel/iwlwifi/mvm/mld-key.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/mld-key.c +11 -7
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* -* Copyright (C) 2022 - 2023 Intel Corporation +* Copyright (C) 2022 - 2024 Intel Corporation */ #include <linux/kernel.h> #include <net/mac80211.h>
@@ -62,11 +62,13 @@ u32 iwl_mvm_get_sec_flags(struct iwl_mvm *mvm, struct ieee80211_key_conf *keyconf) {struct iwl_mvm_vif *mvmvif =iwl_mvm_vif_from_mac80211 (vif); +bool pairwise = keyconf->flags &IEEE80211_KEY_FLAG_PAIRWISE ; +bool igtk = keyconf->keyidx ==4 || keyconf->keyidx ==5 ;u32 flags =0 ;lockdep_assert_held (&mvm->mutex); -if (!(keyconf->flags &IEEE80211_KEY_FLAG_PAIRWISE )) +if (!pairwise) flags |=IWL_SEC_KEY_FLAG_MCAST_KEY ;switch (keyconf->cipher) {
@@ -96,12 +98,14 @@ u32 iwl_mvm_get_sec_flags(struct iwl_mvm *mvm,if (!sta && vif->type ==NL80211_IFTYPE_STATION ) sta = mvmvif->ap_sta; -/* Set the MFP flag also for an AP interface where the key is an IGTK -* key as in such a case the station would always be NULL +/* +* If we are installing an iGTK (in AP or STA mode), we need to tell +* the firmware this key will en/decrypt MGMT frames. +* Same goes if we are installing a pairwise key for an MFP station. +* In case we're installing a groupwise key (which is not an iGTK), +* then, we will not use this key for MGMT frames. */ -if ((!IS_ERR_OR_NULL (sta) && sta->mfp) || - (vif->type ==NL80211_IFTYPE_AP && - (keyconf->keyidx ==4 || keyconf->keyidx ==5 ))) +if ((!IS_ERR_OR_NULL (sta) && sta->mfp && pairwise) || igtk) flags |=IWL_SEC_KEY_FLAG_MFP ;return flags;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 230/713 wifi: iwlwifi: mvm: don't set replay counters to 0xff
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit d5bd4041cd70faf26fc9a54bd6f172537bbe77f3 ]
The firmware (later) actually uses the values even for keys that are invalid as far as the host is concerned, later in rekeying, and then only sets the low 48 bits since the PNs are only 48 bits over the air. It does, however, compare the full 64 bits later, obviously causing problems.
Remove the memset and use kzalloc instead to avoid any old heap data leaking to the firmware. We already init all the other fields in the struct anyway. This leaves the data set to zero for any unused fields, so the firmware can look at them safely even if they're not used right now.
--- drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/d3.c +1 -3
@@ -461,12 +461,10 @@ static int iwl_mvm_wowlan_config_rsc_tsc(struct iwl_mvm *mvm,struct wowlan_key_rsc_v5_data data = {};int i; - data.rsc =kmalloc (sizeof (*data.rsc),GFP_KERNEL ); + data.rsc =kzalloc (sizeof (*data.rsc),GFP_KERNEL );if (!data.rsc)return -ENOMEM ; -memset (data.rsc,0xff ,sizeof (*data.rsc)); -for (i =0 ; i <ARRAY_SIZE (data.rsc->mcast_key_id_map); i++) data.rsc->mcast_key_id_map[i] =IWL_MCAST_KEY_MAP_INVALID ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 231/713 s390/pai: fix attr_event_free upper limit for pai device drivers
In reply to Sasha LevinFrom: Thomas Richter <[email protected]>
[ Upstream commit 225d09d6e5f3870560665a1829d2db79330b4c58 ]
When the device drivers are initialized, a sysfs directory is created. This contains many attributes which are allocated with kzalloc(). Should it fail, the memory for the attributes already created is freed in attr_event_free(). Its second parameter is number of attribute elements to delete. This parameter is off by one. When i. e. the 10th attribute fails to get created, attributes numbered 0 to 9 should be deleted. Currently only attributes numbered 0 to 8 are deleted.
--- arch/s390/kernel/perf_pai_crypto.c | 2 +- arch/s390/kernel/perf_pai_ext.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/s390/kernel/perf_pai_crypto.c +1 -1
@@ -715,7 +715,7 @@ static int __init attr_event_init(void)for (i =0 ; i <ARRAY_SIZE (paicrypt_ctrnames); i++) { ret =attr_event_init_one (attrs, i);if (ret) { -attr_event_free (attrs, i -1 ); +attr_event_free (attrs, i);return ret; } }
arch/s390/kernel/perf_pai_ext.c +1 -1
@@ -604,7 +604,7 @@ static int __init attr_event_init(void)for (i =0 ; i <ARRAY_SIZE (paiext_ctrnames); i++) { ret =attr_event_init_one (attrs, i);if (ret) { -attr_event_free (attrs, i -1 ); +attr_event_free (attrs, i);return ret; } }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 232/713 s390/vdso: drop '-fPIC' from LDFLAGS
In reply to Sasha LevinFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 0628c03934187be33942580e10bb9afcc61adeed ]
'-fPIC' as an option to the linker does not do what it seems like it should. With ld.bfd, it is treated as '-f PIC', which does not make sense based on the meaning of '-f':
-f SHLIB, --auxiliary SHLIB Auxiliary filter for shared object symbol table
When building with ld.lld (currently under review in a GitHub pull request), it just errors out because '-f' means nothing and neither does '-fPIC':
ld.lld: error: unknown argument '-fPIC'
'-fPIC' was blindly copied from CFLAGS when the vDSO stopped being linked with '$(CC)', it should not be needed. Remove it to clear up the build failure with ld.lld.
--- arch/s390/kernel/vdso32/Makefile | 2 +- arch/s390/kernel/vdso64/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/s390/kernel/vdso32/Makefile +1 -1
@@ -22,7 +22,7 @@ KBUILD_CFLAGS_32 := $(filter-out -m64,$(KBUILD_CFLAGS)) KBUILD_CFLAGS_32 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_32)) KBUILD_CFLAGS_32 += -m31 -fPIC -shared -fno-common -fno-builtin -LDFLAGS_vdso32.so.dbg += -fPIC -shared -soname=linux-vdso32.so.1 \ +LDFLAGS_vdso32.so.dbg += -shared -soname=linux-vdso32.so.1 \ --hash-style=both --build-id=sha1 -melf_s390 -T $(targets:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_32)
arch/s390/kernel/vdso64/Makefile +1 -1
@@ -26,7 +26,7 @@ KBUILD_AFLAGS_64 += -m64 KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS)) KBUILD_CFLAGS_64 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_64)) KBUILD_CFLAGS_64 += -m64 -fPIC -fno-common -fno-builtin -ldflags-y := -fPIC -shared -soname=linux-vdso64.so.1 \ +ldflags-y := -shared -soname=linux-vdso64.so.1 \ --hash-style=both --build-id=sha1 -T $(targets:%=$(obj)/%.dbg): KBUILD_CFLAGS = $(KBUILD_CFLAGS_64)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 233/713 selftests: forwarding: Add missing config entries
In reply to Sasha LevinFrom: Petr Machata <[email protected]>
[ Upstream commit 4acf4e62cd572b0c806035046b3698f5585ab821 ]
The config file contains a partial kernel configuration to be used by `virtme-configkernel --custom'. The presumption is that the config file contains all Kconfig options needed by the selftests from the directory.
In net/forwarding/config, many are missing, which manifests as spurious failures when running the selftests, with messages about unknown device types, qdisc kinds or classifier actions. Add the missing configurations.
Tested the resulting configuration using virtme-ng as follows:
# vng -b -f tools/testing/selftests/net/forwarding/config # vng --user root (within the VM:) # make -C tools/testing/selftests TARGETS=net/forwarding run_tests
Stable-dep-of: f0ddf15f0a74 ("selftests: forwarding: Add missing multicast routing config entries")
--- tools/testing/selftests/net/forwarding/config | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+)
tools/testing/selftests/net/forwarding/config +28 -0
@@ -6,14 +6,42 @@ CONFIG_IPV6_MULTIPLE_TABLES=y CONFIG_NET_VRF=m CONFIG_BPF_SYSCALL=y CONFIG_CGROUP_BPF=y +CONFIG_DUMMY=m +CONFIG_IPV6=y +CONFIG_IPV6_GRE=m +CONFIG_MACVLAN=m CONFIG_NET_ACT_CT=m CONFIG_NET_ACT_MIRRED=m CONFIG_NET_ACT_MPLS=m +CONFIG_NET_ACT_PEDIT=m +CONFIG_NET_ACT_POLICE=m +CONFIG_NET_ACT_SAMPLE=m +CONFIG_NET_ACT_SKBEDIT=m +CONFIG_NET_ACT_TUNNEL_KEY=m CONFIG_NET_ACT_VLAN=m CONFIG_NET_CLS_FLOWER=m CONFIG_NET_CLS_MATCHALL=m +CONFIG_NET_CLS_BASIC=m +CONFIG_NET_EMATCH=y +CONFIG_NET_EMATCH_META=m +CONFIG_NET_IPGRE=m +CONFIG_NET_IPGRE_DEMUX=m +CONFIG_NET_IPIP=m +CONFIG_NET_SCH_ETS=m CONFIG_NET_SCH_INGRESS=m CONFIG_NET_ACT_GACT=m +CONFIG_NET_SCH_PRIO=m +CONFIG_NET_SCH_RED=m +CONFIG_NET_SCH_TBF=m +CONFIG_NET_TC_SKB_EXT=y +CONFIG_NET_TEAM=y +CONFIG_NET_TEAM_MODE_LOADBALANCE=y +CONFIG_NETFILTER=y +CONFIG_NF_CONNTRACK=m +CONFIG_NF_FLOW_TABLE=m +CONFIG_NF_TABLES=m CONFIG_VETH=m CONFIG_NAMESPACES=y CONFIG_NET_NS=y +CONFIG_VXLAN=m +CONFIG_XFRM_USER=m
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 234/713 selftests: forwarding: Add missing multicast routing config entries
In reply to Sasha LevinFrom: Ido Schimmel <[email protected]>
[ Upstream commit f0ddf15f0a74c27eb4b2271a90e69948acc3fa2c ]
The two tests that make use of multicast routig (router.sh and router_multicast.sh) are currently failing in the netdev CI because the kernel is missing multicast routing support.
Fix by adding the required config entries.
--- tools/testing/selftests/net/forwarding/config | 7 +++++++ 1 file changed, 7 insertions(+)
tools/testing/selftests/net/forwarding/config +7 -0
@@ -9,6 +9,13 @@ CONFIG_CGROUP_BPF=y CONFIG_DUMMY=m CONFIG_IPV6=y CONFIG_IPV6_GRE=m +CONFIG_IPV6_MROUTE=y +CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y +CONFIG_IPV6_PIMSM_V2=y +CONFIG_IP_MROUTE=y +CONFIG_IP_MROUTE_MULTIPLE_TABLES=y +CONFIG_IP_PIMSM_V1=y +CONFIG_IP_PIMSM_V2=y CONFIG_MACVLAN=m CONFIG_NET_ACT_CT=m CONFIG_NET_ACT_MIRRED=m
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 235/713 ipv6: mcast: remove one synchronize_net() barrier in ipv6_mc_down()
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit 17ef8efc00b34918b966388b2af0993811895a8c ]
As discussed in the past (commit 2d3916f31891 ("ipv6: fix skb drops in igmp6_event_query() and igmp6_event_report()")) I think the synchronize_net() call in ipv6_mc_down() is not needed.
Under load, synchronize_net() can last between 200 usec and 5 ms.
KASAN seems to agree as well.
--- net/ipv6/mcast.c | 1 - 1 file changed, 1 deletion(-)
net/ipv6/mcast.c +0 -1
@@ -2719,7 +2719,6 @@ void ipv6_mc_down(struct inet6_dev *idev)/* Should stop work after group drop. or we will * start work again in mld_ifc_event() */ -synchronize_net ();mld_query_stop_work (idev);mld_report_stop_work (idev);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 236/713 arm64: dts: mt8183: Move CrosEC base detection node to kukui-based DTs
In reply to Sasha LevinFrom: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 04bd6411f506357fd1faedc2b2156e7ef206aa9a ]
The cbas node is used to describe base detection functionality in the ChromeOS EC, which is used for units that have a detachable keyboard and thus rely on this functionality to switch between tablet and laptop mode.
Despite the original commit having added the cbas node to the mt8183-kukui.dtsi, not all machines that include it are detachables. In fact all machines that include from mt8183-kukui-jacuzzi.dtsi are either clamshells (ie normal laptops) or convertibles, meaning the keyboard can be flipped but not detached. The detection for the keyboard getting flipped is handled by the driver bound to the keyboard-controller node in the EC.
Move the base detection node from the base kukui dtsi to the dtsis where all machines are detachables, and thus actually make use of the node.
--- arch/arm64/boot/dts/mediatek/mt8183-kukui-kakadu.dtsi | 4 ++++ arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama.dtsi | 4 ++++ arch/arm64/boot/dts/mediatek/mt8183-kukui-krane.dtsi | 4 ++++ arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 4 ---- 4 files changed, 12 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/mediatek/mt8183-kukui-kakadu.dtsi +4 -0
@@ -373,6 +373,10 @@ pen_eject { }; &cros_ec { + cbas { + compatible = "google,cros-cbas"; + }; + keyboard-controller { compatible = "google,cros-ec-keyb-switches"; };
arch/arm64/boot/dts/mediatek/mt8183-kukui-kodama.dtsi +4 -0
@@ -340,6 +340,10 @@ touch_pin_reset: pin_reset { }; &cros_ec { + cbas { + compatible = "google,cros-cbas"; + }; + keyboard-controller { compatible = "google,cros-ec-keyb-switches"; };
arch/arm64/boot/dts/mediatek/mt8183-kukui-krane.dtsi +4 -0
@@ -344,6 +344,10 @@ rst_pin { }; &cros_ec { + cbas { + compatible = "google,cros-cbas"; + }; + keyboard-controller { compatible = "google,cros-ec-keyb-switches"; };
arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +0 -4
@@ -935,10 +935,6 @@ usbc_extcon: extcon0 { google,usb-port-id = <0>; }; - cbas { - compatible = "google,cros-cbas"; - }; - typec { compatible = "google,cros-ec-typec"; #address-cells = <1>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 237/713 arm64: dts: mediatek: mt7986: fix reference to PWM in fan node
In reply to Sasha LevinFrom: Rafał Miłecki <[email protected]>
[ Upstream commit 7865abbbdf1e1ee57a0bb8ec83079f8840c16854 ]
This fixes typo and resolves following validation error:arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dtb: pwm-fan: pwms: [[54, 0, 10000], [0]] is too long
from schema $id: http://devicetree.org/schemas/hwmon/pwm-fan.yaml#
--- arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts +1 -1
@@ -43,7 +43,7 @@ fan: pwm-fan { #cooling-cells = <2>; /* cooling level (0, 1, 2) - pwm inverted */ cooling-levels = <255 96 0>; - pwms = <&pwm 0 10000 0>; + pwms = <&pwm 0 10000>; status = "okay"; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 238/713 arm64: dts: mediatek: mt7986: drop crypto's unneeded/invalid clock name
In reply to Sasha LevinFrom: Rafał Miłecki <[email protected]>
[ Upstream commit bb69d19c649669f700149df309245cd925612f7c ]
According to the "inside-secure,safexcel-eip97" binding "clock-names" is required only if there are two clocks specified. If present the first name must by "core".
Name "infra_eip97_ck" is invalid and was probably just a typo. Drop it.
--- arch/arm64/boot/dts/mediatek/mt7986a.dtsi | 1 - 1 file changed, 1 deletion(-)
arch/arm64/boot/dts/mediatek/mt7986a.dtsi +0 -1
@@ -234,7 +234,6 @@ crypto: crypto@10320000 { <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "ring0", "ring1", "ring2", "ring3"; clocks = <&infracfg CLK_INFRA_EIP97_CK>; - clock-names = "infra_eip97_ck"; assigned-clocks = <&topckgen CLK_TOP_EIP_B_SEL>; assigned-clock-parents = <&apmixedsys CLK_APMIXED_NET2PLL>; status = "disabled";
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 239/713 arm64: dts: mediatek: mt7986: fix SPI bus width properties
In reply to Sasha LevinFrom: Rafał Miłecki <[email protected]>
[ Upstream commit 4e7dc18a753cec130b06f1ddbae10ea9dcfb1723 ]
This fixes SPI setup and resolves following validation errors:arch/arm64/boot/dts/mediatek/mt7986a-rfb.dtb: spi_nand@0: Unevaluated properties are not allowed ('spi-rx-buswidth', 'spi-tx-buswidth' were unexpected)
from schema $id: http://devicetree.org/schemas/mtd/spi-nand.yaml#arch/arm64/boot/dts/mediatek/mt7986b-rfb.dtb: spi_nand@0: Unevaluated properties are not allowed ('spi-rx-buswidth', 'spi-tx-buswidth' were unexpected)
from schema $id: http://devicetree.org/schemas/mtd/spi-nand.yaml#
--- arch/arm64/boot/dts/mediatek/mt7986a-rfb.dts | 4 ++-- arch/arm64/boot/dts/mediatek/mt7986b-rfb.dts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/mediatek/mt7986a-rfb.dts +2 -2
@@ -241,8 +241,8 @@ spi_nand: spi_nand@0 { compatible = "spi-nand"; reg = <0>; spi-max-frequency = <10000000>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; }; };
arch/arm64/boot/dts/mediatek/mt7986b-rfb.dts +2 -2
@@ -156,8 +156,8 @@ spi_nand: spi_nand@0 { compatible = "spi-nand"; reg = <0>; spi-max-frequency = <10000000>; - spi-tx-buswidth = <4>; - spi-rx-buswidth = <4>; + spi-tx-bus-width = <4>; + spi-rx-bus-width = <4>; }; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 240/713 arm64: dts: mediatek: mt7986: fix SPI nodename
In reply to Sasha LevinFrom: Rafał Miłecki <[email protected]>
[ Upstream commit bbe266c70e1343ee3e71ca31138141b3da265085 ]
This fixes following validation errors:arch/arm64/boot/dts/mediatek/mt7986a-rfb.dtb: spi_nand@0: $nodename:0: 'spi_nand@0' does not match '^(flash|.*sram|nand)(@.*)?$'
from schema $id: http://devicetree.org/schemas/mtd/spi-nand.yaml#arch/arm64/boot/dts/mediatek/mt7986b-rfb.dtb: spi_nand@0: $nodename:0: 'spi_nand@0' does not match '^(flash|.*sram|nand)(@.*)?$'
from schema $id: http://devicetree.org/schemas/mtd/spi-nand.yaml#
--- arch/arm64/boot/dts/mediatek/mt7986a-rfb.dts | 3 ++- arch/arm64/boot/dts/mediatek/mt7986b-rfb.dts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/mediatek/mt7986a-rfb.dts +2 -1
@@ -237,7 +237,8 @@ &spi0 { pinctrl-0 = <&spi_flash_pins>; cs-gpios = <0>, <0>; status = "okay"; - spi_nand: spi_nand@0 { + + spi_nand: flash@0 { compatible = "spi-nand"; reg = <0>; spi-max-frequency = <10000000>;
arch/arm64/boot/dts/mediatek/mt7986b-rfb.dts +2 -1
@@ -152,7 +152,8 @@ &spi0 { pinctrl-0 = <&spi_flash_pins>; cs-gpios = <0>, <0>; status = "okay"; - spi_nand: spi_nand@0 { + + spi_nand: flash@0 { compatible = "spi-nand"; reg = <0>; spi-max-frequency = <10000000>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 241/713 arm64: dts: mediatek: mt7986: drop "#clock-cells" from PWM
In reply to Sasha LevinFrom: Rafał Miłecki <[email protected]>
[ Upstream commit 0b721691f0c80af682d0ef3aa4a177c23d41b072 ]
PWM is not a clock provider and its binding doesn't specify "#clock-cells" property.
This fixes:arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dtb: pwm@10048000: '#clock-cells' does not match any of the regexes: 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/pwm/mediatek,mt2712-pwm.yaml#
--- arch/arm64/boot/dts/mediatek/mt7986a.dtsi | 1 - 1 file changed, 1 deletion(-)
arch/arm64/boot/dts/mediatek/mt7986a.dtsi +0 -1
@@ -242,7 +242,6 @@ crypto: crypto@10320000 { pwm: pwm@10048000 { compatible = "mediatek,mt7986-pwm"; reg = <0 0x10048000 0 0x1000>; - #clock-cells = <1>; #pwm-cells = <2>; interrupts = <GIC_SPI 137 IRQ_TYPE_LEVEL_HIGH>; clocks = <&topckgen CLK_TOP_PWM_SEL>,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 242/713 arm64: dts: mediatek: mt7986: add "#reset-cells" to infracfg
In reply to Sasha LevinFrom: Rafał Miłecki <[email protected]>
[ Upstream commit d993daff5962b2dd08f32a83bb1c0e5fa75732ea ]
MT7986's Infrastructure System Configuration Controller includes reset controller. It can reset blocks as specified in the include/dt-bindings/reset/mt7986-resets.h . Add #reset-cells so it can be referenced properly.
This fixes:arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dtb: infracfg@10001000: '#reset-cells' is a required property
from schema $id: http://devicetree.org/schemas/arm/mediatek/mediatek,infracfg.yaml#
--- arch/arm64/boot/dts/mediatek/mt7986a.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/mediatek/mt7986a.dtsi +1 -0
@@ -153,6 +153,7 @@ infracfg: infracfg@10001000 { compatible = "mediatek,mt7986-infracfg", "syscon"; reg = <0 0x10001000 0 0x1000>; #clock-cells = <1>; + #reset-cells = <1>; }; wed_pcie: wed-pcie@10003000 {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 243/713 arm64: dts: mediatek: mt8192-asurada: Remove CrosEC base detection node
In reply to Sasha LevinFrom: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 9b49cabe631b0a25aaf8fc2ba81b5b9ea6ff01b7 ]
The commit adding the ChromeOS EC to the Asurada Devicetree mistakenly added a base detection node. While tablet mode detection is supported by CrosEC and used by Hayato, it is done through the cros-ec-keyb driver. The base detection node, which is handled by the hid-google-hammer driver, also provides tablet mode detection but by checking base attachment status on the CrosEC, which is not supported for Asurada.
Hence, remove the unused CrosEC base detection node for Asurada.
--- arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi | 4 ---- 1 file changed, 4 deletions(-)
arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi +0 -4
@@ -1336,10 +1336,6 @@ cros_ec: ec@0 { #address-cells = <1>; #size-cells = <0>; - base_detection: cbas { - compatible = "google,cros-cbas"; - }; - cros_ec_pwm: pwm { compatible = "google,cros-ec-pwm"; #pwm-cells = <1>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 244/713 arm64: dts: mediatek: mt8192: fix vencoder clock name
In reply to Sasha LevinFrom: Eugen Hristev <[email protected]>
[ Upstream commit 76aac0f2a46847ed4a7a4fdd848dd66023c19ad1 ]
Clock name should be venc_sel as per binding.
Fix the warning message :arch/arm64/boot/dts/mediatek/mt8192-asurada-hayato-r1.dtb: vcodec@17020000: clock-names:0: 'venc_sel' was expected
from schema $id: http://devicetree.org/schemas/media/mediatek,vcodec-encoder.yaml#
--- arch/arm64/boot/dts/mediatek/mt8192.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/mediatek/mt8192.dtsi +1 -1
@@ -1770,7 +1770,7 @@ vcodec_enc: vcodec@17020000 { mediatek,scp = <&scp>; power-domains = <&spm MT8192_POWER_DOMAIN_VENC>; clocks = <&vencsys CLK_VENC_SET1_VENC>; - clock-names = "venc-set1"; + clock-names = "venc_sel"; assigned-clocks = <&topckgen CLK_TOP_VENC_SEL>; assigned-clock-parents = <&topckgen CLK_TOP_UNIVPLL_D4>; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 245/713 arm64: dts: mediatek: mt8186: fix VENC power domain clocks
In reply to Sasha LevinFrom: Eugen Hristev <[email protected]>
[ Upstream commit 09860910c589a3bb3b5268ff6f704cf6b18ada73 ]
The larb clock is in fact a subsys clock, so it must be prefixed by 'subsys-' to be correctly identified in the driver.
--- arch/arm64/boot/dts/mediatek/mt8186.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/mediatek/mt8186.dtsi +1 -1
@@ -1061,7 +1061,7 @@ power-domain@MT8186_POWER_DOMAIN_VENC { reg = <MT8186_POWER_DOMAIN_VENC>; clocks = <&topckgen CLK_TOP_VENC>, <&vencsys CLK_VENC_CKE1_VENC>; - clock-names = "venc0", "larb"; + clock-names = "venc0", "subsys-larb"; mediatek,infracfg = <&infracfg_ao>; #power-domain-cells = <0>; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 246/713 arm64: dts: mediatek: mt7622: add missing "device_type" to memory nodes
In reply to Sasha LevinFrom: Rafał Miłecki <[email protected]>
[ Upstream commit 99d100e00144bc01b49a697f4bc4398f2f7e7ce4 ]
This fixes:arch/arm64/boot/dts/mediatek/mt7622-rfb1.dtb: /: memory@40000000: 'device_type' is a required property
from schema $id: http://devicetree.org/schemas/memory.yaml#arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dtb: /: memory@40000000: 'device_type' is a required property
from schema $id: http://devicetree.org/schemas/memory.yaml#
--- arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts | 1 + arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts | 1 + 2 files changed, 2 insertions(+)
arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +1 -0
@@ -75,6 +75,7 @@ led-1 { memory@40000000 { reg = <0 0x40000000 0 0x40000000>; + device_type = "memory"; }; reg_1p8v: regulator-1p8v {
arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts +1 -0
@@ -57,6 +57,7 @@ key-wps { memory@40000000 { reg = <0 0x40000000 0 0x20000000>; + device_type = "memory"; }; reg_1p8v: regulator-1p8v {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 247/713 can: m_can: Start/Cancel polling timer together with interrupts
In reply to Sasha LevinFrom: Markus Schneider-Pargmann <[email protected]>
[ Upstream commit a163c5761019b94258ca655b27b46e82657fd6f5 ]
Interrupts are enabled/disabled in more places than just m_can_start() and m_can_stop(). Couple the polling timer with enabling/disabling of all interrupts to achieve equivalent behavior.
--- drivers/net/can/m_can/m_can.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)
drivers/net/can/m_can/m_can.c +12 -11
@@ -418,6 +418,13 @@ static void m_can_config_endisable(struct m_can_classdev *cdev, bool enable)static inline void m_can_enable_all_interrupts (struct m_can_classdev *cdev) { +if (!cdev->net->irq) { +dev_dbg (cdev->dev,"Start hrtimer\n" ); +hrtimer_start (&cdev->hrtimer, +ms_to_ktime (HRTIMER_POLL_INTERVAL_MS ), +HRTIMER_MODE_REL_PINNED ); + } +/* Only interrupt line 0 is used in this driver */ m_can_write (cdev,M_CAN_ILE ,ILE_EINT0 ); }
@@ -425,6 +432,11 @@ static inline void m_can_enable_all_interrupts(struct m_can_classdev *cdev)static inline void m_can_disable_all_interrupts (struct m_can_classdev *cdev) {m_can_write (cdev,M_CAN_ILE ,0x0 ); + +if (!cdev->net->irq) { +dev_dbg (cdev->dev,"Stop hrtimer\n" ); +hrtimer_cancel (&cdev->hrtimer); + } }/* Retrieve internal timestamp counter from TSCV.TSC, and shift it to 32-bit
@@ -1417,12 +1429,6 @@ static int m_can_start(struct net_device *dev)m_can_enable_all_interrupts (cdev); -if (!dev->irq) { -dev_dbg (cdev->dev,"Start hrtimer\n" ); -hrtimer_start (&cdev->hrtimer,ms_to_ktime (HRTIMER_POLL_INTERVAL_MS ), -HRTIMER_MODE_REL_PINNED ); - } -return 0 ; }
@@ -1577,11 +1583,6 @@ static void m_can_stop(struct net_device *dev) {struct m_can_classdev *cdev =netdev_priv (dev); -if (!dev->irq) { -dev_dbg (cdev->dev,"Stop hrtimer\n" ); -hrtimer_cancel (&cdev->hrtimer); - } -/* disable all interrupts */ m_can_disable_all_interrupts (cdev);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 248/713 wifi: iwlwifi: mvm: Fix the listener MAC filter flags
In reply to Sasha LevinFrom: Ilan Peer <[email protected]>
[ Upstream commit 4cdb86487e3eaddb4b3a7df30ae709e810aac84b ]
One of the flags was from the wrong API.
--- drivers/net/wireless/intel/iwlwifi/mvm/mld-mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac.c +1 -1
@@ -167,7 +167,7 @@ static int iwl_mvm_mld_mac_ctxt_cmd_listener(struct iwl_mvm *mvm,iwl_mvm_mld_mac_ctxt_cmd_common (mvm, vif, &cmd, action); cmd.filter_flags =cpu_to_le32 (MAC_CFG_FILTER_PROMISC | -MAC_FILTER_IN_CONTROL_AND_MGMT | +MAC_CFG_FILTER_ACCEPT_CONTROL_AND_MGMT |MAC_CFG_FILTER_ACCEPT_BEACON |MAC_CFG_FILTER_ACCEPT_PROBE_REQ |MAC_CFG_FILTER_ACCEPT_GRP );
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 249/713 bpf: Mark bpf_spin_{lock,unlock}() helpers with notrace correctly
In reply to Sasha LevinFrom: Yonghong Song <[email protected]>
[ Upstream commit 178c54666f9c4d2f49f2ea661d0c11b52f0ed190 ]
Currently tracing is supposed not to allow for bpf_spin_{lock,unlock}() helper calls. This is to prevent deadlock for the following cases:
- there is a prog (prog-A) calling bpf_spin_{lock,unlock}().
- there is a tracing program (prog-B), e.g., fentry, attached to bpf_spin_lock() and/or bpf_spin_unlock().
- prog-B calls bpf_spin_{lock,unlock}().
For such a case, when prog-A calls bpf_spin_{lock,unlock}(), a deadlock will happen.
The related source codes are below in kernel/bpf/helpers.c:
notrace BPF_CALL_1(bpf_spin_lock, struct bpf_spin_lock *, lock) notrace BPF_CALL_1(bpf_spin_unlock, struct bpf_spin_lock *, lock)
notrace is supposed to prevent fentry prog from attaching to bpf_spin_{lock,unlock}().
But actually this is not the case and fentry prog can successfully attached to bpf_spin_lock(). Siddharth Chintamaneni reported the issue in [1]. The following is the macro definition for above BPF_CALL_1:
#define BPF_CALL_x(x, name, ...) \
static __always_inline \
u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)); \
typedef u64 (*btf_##name)(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)); \
u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)); \
u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)) \
{ \
return ((btf_##name)____##name)(__BPF_MAP(x,__BPF_CAST,__BPF_N,__VA_ARGS__));\
} \
static __always_inline \
u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__))#define BPF_CALL_1(name, ...) BPF_CALL_x(1, name, __VA_ARGS__)
The notrace attribute is actually applied to the static always_inline function ____bpf_spin_{lock,unlock}(). The actual callback function bpf_spin_{lock,unlock}() is not marked with notrace, hence allowing fentry prog to attach to two helpers, and this
may cause the above mentioned deadlock. Siddharth Chintamaneni actually has a reproducer in [2].
To fix the issue, a new macro NOTRACE_BPF_CALL_1 is introduced which will add notrace attribute to the original function instead of the hidden always_inline function and this fixed the problem.
[1] https://lore.kernel.org/bpf/CAE5sdEigPnoGrzN8WU7Tx-h-iFuMZgW06qp0KHWtpvoXxf1OAQ@mail.gmail.com/
[2] https://lore.kernel.org/bpf/CAE5sdEg6yUc_Jz50AnUXEEUh6O73yQ1Z6NV2srJnef0ZrQkZew@mail.gmail.com/
--- include/linux/filter.h | 21 ++++++++++++--------- kernel/bpf/helpers.c | 4 ++-- 2 files changed, 14 insertions(+), 11 deletions(-)
include/linux/filter.h +12 -9
@@ -547,24 +547,27 @@ static inline bool insn_is_zext(const struct bpf_insn *insn)__BPF_MAP (n, __BPF_DECL_ARGS, __BPF_N, u64, __ur_1, u64, __ur_2, \ u64, __ur_3, u64, __ur_4, u64, __ur_5) -#define BPF_CALL_x (x, name, ...) \ +#define BPF_CALL_x (x, attr, name, ...) \ static __always_inline \ u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)); \ typedef u64 (*btf_##name)(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)); \ - u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)); \ - u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)) \ + attr u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)); \ + attr u64 name(__BPF_REG(x, __BPF_DECL_REGS, __BPF_N, __VA_ARGS__)) \ { \ return ((btf_##name)____##name)(__BPF_MAP(x,__BPF_CAST,__BPF_N,__VA_ARGS__));\ } \ static __always_inline \ u64 ____##name(__BPF_MAP(x, __BPF_DECL_ARGS, __BPF_V, __VA_ARGS__)) -#define BPF_CALL_0 (name, ...) BPF_CALL_x(0, name, __VA_ARGS__) -#define BPF_CALL_1 (name, ...) BPF_CALL_x(1, name, __VA_ARGS__) -#define BPF_CALL_2 (name, ...) BPF_CALL_x(2, name, __VA_ARGS__) -#define BPF_CALL_3 (name, ...) BPF_CALL_x(3, name, __VA_ARGS__) -#define BPF_CALL_4 (name, ...) BPF_CALL_x(4, name, __VA_ARGS__) -#define BPF_CALL_5 (name, ...) BPF_CALL_x(5, name, __VA_ARGS__) +#define __NOATTR +#define BPF_CALL_0 (name, ...) BPF_CALL_x(0, __NOATTR, name, __VA_ARGS__) +#define BPF_CALL_1 (name, ...) BPF_CALL_x(1, __NOATTR, name, __VA_ARGS__) +#define BPF_CALL_2 (name, ...) BPF_CALL_x(2, __NOATTR, name, __VA_ARGS__) +#define BPF_CALL_3 (name, ...) BPF_CALL_x(3, __NOATTR, name, __VA_ARGS__) +#define BPF_CALL_4 (name, ...) BPF_CALL_x(4, __NOATTR, name, __VA_ARGS__) +#define BPF_CALL_5 (name, ...) BPF_CALL_x(5, __NOATTR, name, __VA_ARGS__) + +#define NOTRACE_BPF_CALL_1 (name, ...) BPF_CALL_x(1, notrace, name, __VA_ARGS__)#define bpf_ctx_range (TYPE ,MEMBER ) \ offsetof(TYPE, MEMBER) ... offsetofend(TYPE, MEMBER) - 1
kernel/bpf/helpers.c +2 -2
@@ -334,7 +334,7 @@ static inline void __bpf_spin_lock_irqsave(struct bpf_spin_lock *lock)__this_cpu_write (irqsave_flags, flags); } -notrace BPF_CALL_1 (bpf_spin_lock ,struct bpf_spin_lock *,lock ) +NOTRACE_BPF_CALL_1(bpf_spin_lock, struct bpf_spin_lock *, lock) {__bpf_spin_lock_irqsave (lock);return 0 ;
@@ -357,7 +357,7 @@ static inline void __bpf_spin_unlock_irqrestore(struct bpf_spin_lock *lock)local_irq_restore (flags); } -notrace BPF_CALL_1 (bpf_spin_unlock ,struct bpf_spin_lock *,lock ) +NOTRACE_BPF_CALL_1(bpf_spin_unlock, struct bpf_spin_lock *, lock) {__bpf_spin_unlock_irqrestore (lock);return 0 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 250/713 bpf: don't infer PTR_TO_CTX for programs with unnamed context type
In reply to Sasha LevinFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 879bbe7aa4afa80acf72a1cad7f52416ea78c52d ]
For program types that don't have named context type name (e.g., BPF iterator programs or tracepoint programs), ctx_tname will be a non-NULL empty string. For such programs it shouldn't be possible to have PTR_TO_CTX argument for global subprogs based on type name alone. arg:ctx tag is the only way to have PTR_TO_CTX passed into global subprog for such program types.
Fix this loophole, which currently would assume PTR_TO_CTX whenever user uses a pointer to anonymous struct as an argument to their global subprogs. This happens in practice with the following (quite common, in practice) approach:
typedef struct { /* anonymous */
int x; } my_type_t;
int my_subprog(my_type_t *arg) { ... }
User's intent is to have PTR_TO_MEM argument for arg, but verifier will complain about expecting PTR_TO_CTX.
This fix also closes unintended s390x-specific KPROBE handling of PTR_TO_CTX case. Selftest change is necessary to accommodate this.
--- kernel/bpf/btf.c | 3 +++ .../bpf/progs/test_global_func_ctx_args.c | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+)
kernel/bpf/btf.c +3 -0
@@ -5665,6 +5665,9 @@ btf_get_prog_ctx_type(struct bpf_verifier_log *log, const struct btf *btf,bpf_log (log,"Please fix kernel include/linux/bpf_types.h\n" );return NULL ; } +/* program types without named context types work only with arg:ctx tag */ +if (ctx_tname[0 ] =='\0' ) +return false;/* only compare that prog's ctx type name is the same as * kernel expects. No need to compare field by field. * It's ok for bpf prog to do:
tools/testing/selftests/bpf/progs/test_global_func_ctx_args.c +19 -0
@@ -26,6 +26,23 @@ int kprobe_typedef_ctx(void *ctx)return kprobe_typedef_ctx_subprog (ctx); } +/* s390x defines: +* +* typedef user_pt_regs bpf_user_pt_regs_t; +* typedef struct { ... } user_pt_regs; +* +* And so "canonical" underlying struct type is anonymous. +* So on s390x only valid ways to have PTR_TO_CTX argument in global subprogs +* are: +* - bpf_user_pt_regs_t *ctx (typedef); +* - struct bpf_user_pt_regs_t *ctx (backwards compatible struct hack); +* - void *ctx __arg_ctx (arg:ctx tag) +* +* Other architectures also allow using underlying struct types (e.g., +* `struct pt_regs *ctx` for x86-64) +*/ +#ifndef bpf_target_s390 +#define pt_regs_struct_t typeof(*(__PT_REGS_CAST((struct pt_regs *)NULL)))__weak int kprobe_struct_ctx_subprog (pt_regs_struct_t *ctx)
@@ -40,6 +57,8 @@ int kprobe_resolved_ctx(void *ctx) return kprobe_struct_ctx_subprog(ctx); } +#endif +/* this is current hack to make this work on old kernels */ struct bpf_user_pt_regs_t {};
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 251/713 arm64: dts: qcom: sdm845: Use the Low Power Island CX/MX for SLPI
In reply to Sasha LevinFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 5dd227ccfb9568935bdaf82bc1893b36457dd4d3 ]
The SLPI is powered by the Low Power Island power rails. Fix the incorrect assignment.
--- arch/arm64/boot/dts/qcom/sdm845.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sdm845.dtsi +2 -2
@@ -3353,8 +3353,8 @@ slpi_pas: remoteproc@5c00000 { qcom,qmp = <&aoss_qmp>; - power-domains = <&rpmhpd SDM845_CX>, - <&rpmhpd SDM845_MX>; + power-domains = <&rpmhpd SDM845_LCX>, + <&rpmhpd SDM845_LMX>; power-domain-names = "lcx", "lmx"; memory-region = <&slpi_mem>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 252/713 soc: qcom: llcc: Check return value on Broadcast_OR reg read
In reply to Sasha LevinFrom: Unnathi Chalicheemala <[email protected]>
[ Upstream commit ceeaddc19a90039861564d8e1078b778a8f95101 ]
Commit c72ca343f911 ("soc: qcom: llcc: Add v4.1 HW version support") introduced a new 4.1 if statement in llcc_update_act_ctrl() without considering that ret might be overwritten. So, add return value check after Broadcast_OR register read in llcc_update_act_ctrl().
--- drivers/soc/qcom/llcc-qcom.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/soc/qcom/llcc-qcom.c +2 -0
@@ -766,6 +766,8 @@ static int llcc_update_act_ctrl(u32 sid, ret =regmap_read_poll_timeout (drv_data->bcast_regmap, status_reg, slice_status, !(slice_status & status),0 ,LLCC_STATUS_READ_DELAY ); +if (ret) +return ret;if (drv_data->version >=LLCC_VERSION_4_1_0_0 ) ret = regmap_write(drv_data->bcast_regmap, act_clear_reg,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 253/713 ARM: dts: qcom: msm8974: correct qfprom node size
In reply to Sasha LevinFrom: Craig Tatlor <[email protected]>
[ Upstream commit 724c4bf0e4bf81dba77736afb93964c986c3c123 ]
The qfprom actually is bigger than 0x1000, so adjust the reg.
Note that the non-ECC-corrected qfprom can be found at 0xfc4b8000 (-0x4000). The current reg points to the ECC-corrected qfprom block which should have equivalent values at all offsets compared to the non-corrected version.
[[email protected]: extract to standalone patch and adjust for review comments]
--- arch/arm/boot/dts/qcom/qcom-msm8974.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/qcom/qcom-msm8974.dtsi +1 -1
@@ -1226,7 +1226,7 @@ restart@fc4ab000 { qfprom: qfprom@fc4bc000 { compatible = "qcom,msm8974-qfprom", "qcom,qfprom"; - reg = <0xfc4bc000 0x1000>; + reg = <0xfc4bc000 0x2100>; #address-cells = <1>; #size-cells = <1>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 254/713 arm64: dts: mediatek: mt8186: Add missing clocks to ssusb power domains
In reply to Sasha LevinFrom: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit a00d4a98af44e025891e97c490b2545368a25e08 ]
The ssusb power domains currently don't list any clocks, despite depending on some, and thus rely on the bootloader leaving the required clocks on in order to work.
When booting with the upstream arm64 defconfig, the power domain controller will defer probe until modules have loaded since it has an indirect dependency on CONFIG_MTK_CMDQ, which is configured as a module. However at the point where modules are loaded, unused clocks are also disabled, causing the ssusb domains to fail to be enabled and consequently the controller to fail probe:
mtk-power-controller 10006000.syscon:power-controller: /soc/syscon@10006000/power-controller/power-domain@4: failed to power on domain: -110
mtk-power-controller: probe of 10006000.syscon:power-controller failed with error -110
Add the missing clocks for the ssusb power domains so that they can successfully probe without relying on the bootloader state.
--- arch/arm64/boot/dts/mediatek/mt8186.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/mediatek/mt8186.dtsi +6 -0
@@ -931,11 +931,17 @@ power-domain@MT8186_POWER_DOMAIN_CSIRX_TOP { power-domain@MT8186_POWER_DOMAIN_SSUSB { reg = <MT8186_POWER_DOMAIN_SSUSB>; + clocks = <&topckgen CLK_TOP_USB_TOP>, + <&infracfg_ao CLK_INFRA_AO_SSUSB_TOP_REF>; + clock-names = "sys_ck", "ref_ck"; #power-domain-cells = <0>; }; power-domain@MT8186_POWER_DOMAIN_SSUSB_P1 { reg = <MT8186_POWER_DOMAIN_SSUSB_P1>; + clocks = <&infracfg_ao CLK_INFRA_AO_SSUSB_TOP_P1_SYS>, + <&infracfg_ao CLK_INFRA_AO_SSUSB_TOP_P1_REF>; + clock-names = "sys_ck", "ref_ck"; #power-domain-cells = <0>; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 255/713 arm64: dts: mediatek: mt8186: Add missing xhci clock to usb controllers
In reply to Sasha LevinFrom: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 1af98c3e53da5a8f627855cecd68b017e753ffd3 ]
The mtu3 usb controllers don't list the xhci clock, though they require it, and thus rely on the bootloader leaving it on in order to work.
When booting with the upstream arm64 defconfig, the usb controllers will defer probe until modules have loaded since they have an indirect dependency on CONFIG_MTK_CMDQ, which is configured as a module. However at the point where modules are loaded, unused clocks are also disabled, causing the usb controllers to probe without the xhci clock enabled and fail to probe:
mtu3 11201000.usb: clks of sts1 are not stable! mtu3 11201000.usb: device enable failed -110 mtu3 11201000.usb: mtu3 hw init failed:-110 mtu3 11201000.usb: failed to initialize gadget
mtu3: probe of 11201000.usb failed with error -110
(and same for the one at 11281000)
Add the missing clock for the usb controllers so that they can successfully probe without relying on the bootloader state.
--- arch/arm64/boot/dts/mediatek/mt8186.dtsi | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/mediatek/mt8186.dtsi +6 -4
@@ -1536,8 +1536,9 @@ ssusb0: usb@11201000 { clocks = <&topckgen CLK_TOP_USB_TOP>, <&infracfg_ao CLK_INFRA_AO_SSUSB_TOP_REF>, <&infracfg_ao CLK_INFRA_AO_SSUSB_TOP_HCLK>, - <&infracfg_ao CLK_INFRA_AO_ICUSB>; - clock-names = "sys_ck", "ref_ck", "mcu_ck", "dma_ck"; + <&infracfg_ao CLK_INFRA_AO_ICUSB>, + <&infracfg_ao CLK_INFRA_AO_SSUSB_TOP_XHCI>; + clock-names = "sys_ck", "ref_ck", "mcu_ck", "dma_ck", "xhci_ck"; interrupts = <GIC_SPI 303 IRQ_TYPE_LEVEL_HIGH 0>; phys = <&u2port0 PHY_TYPE_USB2>; power-domains = <&spm MT8186_POWER_DOMAIN_SSUSB>;
@@ -1601,8 +1602,9 @@ ssusb1: usb@11281000 { clocks = <&infracfg_ao CLK_INFRA_AO_SSUSB_TOP_P1_SYS>, <&infracfg_ao CLK_INFRA_AO_SSUSB_TOP_P1_REF>, <&infracfg_ao CLK_INFRA_AO_SSUSB_TOP_P1_HCLK>, - <&clk26m>; - clock-names = "sys_ck", "ref_ck", "mcu_ck", "dma_ck"; + <&clk26m>, + <&infracfg_ao CLK_INFRA_AO_SSUSB_TOP_P1_XHCI>; + clock-names = "sys_ck", "ref_ck", "mcu_ck", "dma_ck", "xhci_ck"; interrupts = <GIC_SPI 331 IRQ_TYPE_LEVEL_HIGH 0>; phys = <&u2port1 PHY_TYPE_USB2>, <&u3port1 PHY_TYPE_USB3>; power-domains = <&spm MT8186_POWER_DOMAIN_SSUSB_P1>;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 256/713 arm64: dts: ti: am65x: Fix dtbs_install for Rocktech OLDI overlay
In reply to Sasha LevinFrom: Roger Quadros <[email protected]>
[ Upstream commit 8ada14cafc5e185c668198617cd1ab4f1d8d325a ]
Add the overlay dtbo file to a Makefile target so it can be picked by the dtbs_install command.
--- arch/arm64/boot/dts/ti/Makefile | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/ti/Makefile +1 -0
@@ -57,6 +57,7 @@ dtb-$(CONFIG_ARCH_K3) += k3-am654-base-board.dtb dtb-$(CONFIG_ARCH_K3) += k3-am654-gp-evm.dtb dtb-$(CONFIG_ARCH_K3) += k3-am654-evm.dtb dtb-$(CONFIG_ARCH_K3) += k3-am654-idk.dtb +dtb-$(CONFIG_ARCH_K3) += k3-am654-base-board-rocktech-rk101-panel.dtbo # Boards with J7200 SoC k3-j7200-evm-dtbs := k3-j7200-common-proc-board.dtb k3-j7200-evm-quad-port-eth-exp.dtbo
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 257/713 cpufreq: qcom-hw: add CONFIG_COMMON_CLK dependency
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 3093fa33539b54db77171d2919352ad4f044a1c5 ]
It is still possible to compile-test a kernel without CONFIG_COMMON_CLK for some ancient ARM boards or other architectures, but this causes a link failure in the qcom-cpufreq-hw driver:
ERROR: modpost: "devm_clk_hw_register" [drivers/cpufreq/qcom-cpufreq-hw.ko] undefined!
ERROR: modpost: "devm_of_clk_add_hw_provider" [drivers/cpufreq/qcom-cpufreq-hw.ko] undefined!
ERROR: modpost: "of_clk_hw_onecell_get" [drivers/cpufreq/qcom-cpufreq-hw.ko] undefined!
Add a Kconfig dependency here to make sure this always work. Apparently this bug has been in the kernel for a while without me running into it on randconfig builds as COMMON_CLK is almost always enabled.
I have cross-checked by building an allmodconfig kernel with COMMON_CLK disabled, which showed no other driver having this problem.
--- drivers/cpufreq/Kconfig.arm | 1 + 1 file changed, 1 insertion(+)
drivers/cpufreq/Kconfig.arm +1 -0
@@ -173,6 +173,7 @@ config ARM_QCOM_CPUFREQ_NVMEM config ARM_QCOM_CPUFREQ_HW tristate "QCOM CPUFreq HW driver" depends on ARCH_QCOM || COMPILE_TEST + depends on COMMON_CLK help Support for the CPUFreq HW driver. Some QCOM chipsets have a HW engine to offload the steps
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 258/713 wifi: wilc1000: prevent use-after-free on vif when cleaning up all interfaces
In reply to Sasha LevinFrom: Alexis Lothoré <[email protected]>
[ Upstream commit cb5942b77c05d54310a0420cac12935e9b6aa21c ]
wilc_netdev_cleanup currently triggers a KASAN warning, which can be observed on interface registration error path, or simply by removing the module/unbinding device from driver:
echo spi0.1 > /sys/bus/spi/drivers/wilc1000_spi/unbind
==================================================================
BUG: KASAN: slab-use-after-free in wilc_netdev_cleanup+0x508/0x5cc Read of size 4 at addr c54d1ce8 by task sh/86 CPU: 0 PID: 86 Comm: sh Not tainted 6.8.0-rc1+ #117 Hardware name: Atmel SAMA5 unwind_backtrace from show_stack+0x18/0x1c show_stack from dump_stack_lvl+0x34/0x58 dump_stack_lvl from print_report+0x154/0x500 print_report from kasan_report+0xac/0xd8 kasan_report from wilc_netdev_cleanup+0x508/0x5cc wilc_netdev_cleanup from wilc_bus_remove+0xc8/0xec wilc_bus_remove from spi_remove+0x8c/0xac spi_remove from device_release_driver_internal+0x434/0x5f8 device_release_driver_internal from unbind_store+0xbc/0x108 unbind_store from kernfs_fop_write_iter+0x398/0x584 kernfs_fop_write_iter from vfs_write+0x728/0xf88 vfs_write from ksys_write+0x110/0x1e4 ksys_write from ret_fast_syscall+0x0/0x1c
[...]
Allocated by task 1: kasan_save_track+0x30/0x5c __kasan_kmalloc+0x8c/0x94 __kmalloc_node+0x1cc/0x3e4 kvmalloc_node+0x48/0x180 alloc_netdev_mqs+0x68/0x11dc alloc_etherdev_mqs+0x28/0x34 wilc_netdev_ifc_init+0x34/0x8ec wilc_cfg80211_init+0x690/0x910 wilc_bus_probe+0xe0/0x4a0 spi_probe+0x158/0x1b0 really_probe+0x270/0xdf4 __driver_probe_device+0x1dc/0x580 driver_probe_device+0x60/0x140 __driver_attach+0x228/0x5d4 bus_for_each_dev+0x13c/0x1a8 bus_add_driver+0x2a0/0x608 driver_register+0x24c/0x578 do_one_initcall+0x180/0x310 kernel_init_freeable+0x424/0x484 kernel_init+0x20/0x148 ret_from_fork+0x14/0x28 Freed by task 86: kasan_save_track+0x30/0x5c kasan_save_free_info+0x38/0x58 __kasan_slab_free+0xe4/0x140 kfree+0xb0/0x238 device_release+0xc0/0x2a8 kobject_put+0x1d4/0x46c netdev_run_todo+0x8fc/0x11d0 wilc_netdev_cleanup+0x1e4/0x5cc wilc_bus_remove+0xc8/0xec spi_remove+0x8c/0xac device_release_driver_internal+0x434/0x5f8 unbind_store+0xbc/0x108 kernfs_fop_write_iter+0x398/0x584 vfs_write+0x728/0xf88 ksys_write+0x110/0x1e4 ret_fast_syscall+0x0/0x1c [...]
David Mosberger-Tan initial investigation [1] showed that this use-after-free is due to netdevice unregistration during vif list traversal. When unregistering a net device, since the needs_free_netdev has been set to true during registration, the netdevice object is also freed, and as a consequence, the corresponding vif object too, since it is attached to it as private netdevice data. The next occurrence of the loop then tries to access freed vif pointer to the list to move forward in the list.
Fix this use-after-free thanks to two mechanisms:
- navigate in the list with list_for_each_entry_safe, which allows to safely modify the list as we go through each element. For each element, remove it from the list with list_del_rcu
- make sure to wait for RCU grace period end after each vif removal to make sure it is safe to free the corresponding vif too (through unregister_netdev)
Since we are in a RCU "modifier" path (not a "reader" path), and because such path is expected not to be concurrent to any other modifier (we are using the vif_mutex lock), we do not need to use RCU list API, that's why we can benefit from list_for_each_entry_safe.
[1] https://lore.kernel.org/linux-wireless/[email protected]/
--- .../net/wireless/microchip/wilc1000/netdev.c | 28 +++++-------------- 1 file changed, 7 insertions(+), 21 deletions(-)
drivers/net/wireless/microchip/wilc1000/netdev.c +7 -21
@@ -890,8 +890,7 @@ static const struct net_device_ops wilc_netdev_ops = {void wilc_netdev_cleanup (struct wilc *wilc) { -struct wilc_vif *vif; -int srcu_idx, ifc_cnt =0 ; +struct wilc_vif *vif, *vif_tmp;if (!wilc)return ;
@@ -901,32 +900,19 @@ void wilc_netdev_cleanup(struct wilc *wilc) wilc->firmware =NULL ; } - srcu_idx =srcu_read_lock (&wilc->srcu); -list_for_each_entry_rcu (vif, &wilc->vif_list, list) { +list_for_each_entry_safe (vif, vif_tmp, &wilc->vif_list, list) { +mutex_lock (&wilc->vif_mutex); +list_del_rcu (&vif->list); + wilc->vif_num--; +mutex_unlock (&wilc->vif_mutex); +synchronize_srcu (&wilc->srcu);if (vif->ndev)unregister_netdev (vif->ndev); } -srcu_read_unlock (&wilc->srcu, srcu_idx);wilc_wfi_deinit_mon_interface (wilc, false);destroy_workqueue (wilc->hif_workqueue); -while (ifc_cnt <WILC_NUM_CONCURRENT_IFC ) { -mutex_lock (&wilc->vif_mutex); -if (wilc->vif_num <=0 ) { -mutex_unlock (&wilc->vif_mutex); -break ; - } - vif =wilc_get_wl_to_vif (wilc); -if (!IS_ERR (vif)) -list_del_rcu (&vif->list); - - wilc->vif_num--; -mutex_unlock (&wilc->vif_mutex); -synchronize_srcu (&wilc->srcu); - ifc_cnt++; - } -wilc_wlan_cfg_deinit (wilc);wlan_deinit_locks (wilc);wiphy_unregister (wilc->wiphy);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 259/713 arm64: dts: ti: k3-am62-main: disable usb lpm
In reply to Sasha LevinFrom: Andrejs Cainikovs <[email protected]>
[ Upstream commit 9c99b337a8755a09df7735d4324ae26a6eca6261 ]
AM62 USB works with some devices, while failing to operate with others.
[ 560.189822] xhci-hcd xhci-hcd.4.auto: xHCI Host Controller [ 560.195631] xhci-hcd xhci-hcd.4.auto: new USB bus registered, assigned bus number 2 [ 574.388509] xhci-hcd xhci-hcd.4.auto: can't setup: -110 [ 574.393814] xhci-hcd xhci-hcd.4.auto: USB bus 2 deregistered [ 574.399544] xhci-hcd: probe of xhci-hcd.4.auto failed with error -110
This seems to be related to LPM (Link Power Management), and disabling it turns USB into reliable working state.
As per AM62 reference manual:
Quoted 6 lines
4.8.2.1 USB2SS Unsupported Features
The following features are not supported on this family of devices:
...
- USB 2.0 ECN: Link Power Management (LPM)
...
--- arch/arm64/boot/dts/ti/k3-am62-main.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/ti/k3-am62-main.dtsi +4 -0
@@ -623,6 +623,8 @@ usb0: usb@31000000 { interrupt-names = "host", "peripheral"; maximum-speed = "high-speed"; dr_mode = "otg"; + snps,usb2-gadget-lpm-disable; + snps,usb2-lpm-disable; }; };
@@ -646,6 +648,8 @@ usb1: usb@31100000 { interrupt-names = "host", "peripheral"; maximum-speed = "high-speed"; dr_mode = "otg"; + snps,usb2-gadget-lpm-disable; + snps,usb2-lpm-disable; }; };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 260/713 ACPI: processor_idle: Fix memory leak in acpi_processor_power_exit()
In reply to Sasha LevinFrom: Armin Wolf <[email protected]>
[ Upstream commit e18afcb7b2a12b635ac10081f943fcf84ddacc51 ]
After unregistering the CPU idle device, the memory associated with it is not freed, leading to a memory leak:
unreferenced object 0xffff896282f6c000 (size 1024):
comm "swapper/0", pid 1, jiffies 4294893170 hex dump (first 32 bytes):
00 00 00 00 0b 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace (crc 8836a742):
[<ffffffff993495ed>] kmalloc_trace+0x29d/0x340
[<ffffffff9972f3b3>] acpi_processor_power_init+0xf3/0x1c0
[<ffffffff9972d263>] __acpi_processor_start+0xd3/0xf0
[<ffffffff9972d2bc>] acpi_processor_start+0x2c/0x50
[<ffffffff99805872>] really_probe+0xe2/0x480
[<ffffffff99805c98>] __driver_probe_device+0x78/0x160
[<ffffffff99805daf>] driver_probe_device+0x1f/0x90
[<ffffffff9980601e>] __driver_attach+0xce/0x1c0
[<ffffffff99803170>] bus_for_each_dev+0x70/0xc0
[<ffffffff99804822>] bus_add_driver+0x112/0x210
[<ffffffff99807245>] driver_register+0x55/0x100
[<ffffffff9aee4acb>] acpi_processor_driver_init+0x3b/0xc0
[<ffffffff990012d1>] do_one_initcall+0x41/0x300
[<ffffffff9ae7c4b0>] kernel_init_freeable+0x320/0x470
[<ffffffff99b231f6>] kernel_init+0x16/0x1b0
[<ffffffff99042e6d>] ret_from_fork+0x2d/0x50Fix this by freeing the CPU idle device after unregistering it.
--- drivers/acpi/processor_idle.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/acpi/processor_idle.c +2 -0
@@ -1430,6 +1430,8 @@ int acpi_processor_power_exit(struct acpi_processor *pr) acpi_processor_registered--;if (acpi_processor_registered ==0 )cpuidle_unregister_driver (&acpi_idle_driver); + +kfree (dev); } pr->flags.power_setup_done =0 ;
Signature · 1 line
2.43.0