Merge 09b288fb7f ("maple_tree: simplify split calculation") into android14-6.1-lts

Steps on the way to 6.1.129

Change-Id: I0eb60408f7d9735b0d1cb27dbb9379661b50fdef
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman
2025-03-10 15:07:26 +00:00
committed by Treehugger Robot
23 changed files with 144 additions and 62 deletions

View File

@@ -248,7 +248,7 @@ int ftrace_disable_ftrace_graph_caller(void)
#define S_R_SP (0xafb0 << 16) /* s{d,w} R, offset(sp) */
#define OFFSET_MASK 0xffff /* stack offset range: 0 ~ PT_SIZE */
unsigned long ftrace_get_parent_ra_addr(unsigned long self_ra, unsigned long
static unsigned long ftrace_get_parent_ra_addr(unsigned long self_ra, unsigned long
old_parent_ra, unsigned long parent_ra_addr, unsigned long fp)
{
unsigned long sp, ip, tmp;

View File

@@ -52,7 +52,6 @@
* @dir: GPIO direction shadow register
* @gpio_lock: Lock used for synchronization
* @irq: IRQ used by GPIO device
* @irqchip: IRQ chip
* @enable: GPIO IRQ enable/disable bitfield
* @rising_edge: GPIO IRQ rising edge enable/disable bitfield
* @falling_edge: GPIO IRQ falling edge enable/disable bitfield

View File

@@ -937,6 +937,8 @@ static int nxp_c45_soft_reset(struct phy_device *phydev)
if (ret)
return ret;
usleep_range(2000, 2050);
return phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1,
VEND1_DEVICE_CONTROL, ret,
!(ret & DEVICE_CONTROL_RESET), 20000,

View File

@@ -1149,7 +1149,7 @@ static int samsung_pinctrl_probe(struct platform_device *pdev)
ret = platform_get_irq_optional(pdev, 0);
if (ret < 0 && ret != -ENXIO)
return ret;
goto err_put_banks;
if (ret > 0)
drvdata->irq = ret;

View File

@@ -188,6 +188,11 @@ static int ptp_getcycles64(struct ptp_clock_info *info, struct timespec64 *ts)
return info->gettime64(info, ts);
}
static int ptp_enable(struct ptp_clock_info *ptp, struct ptp_clock_request *request, int on)
{
return -EOPNOTSUPP;
}
static void ptp_aux_kworker(struct kthread_work *work)
{
struct ptp_clock *ptp = container_of(work, struct ptp_clock,
@@ -250,6 +255,9 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
ptp->info->getcrosscycles = ptp->info->getcrosststamp;
}
if (!ptp->info->enable)
ptp->info->enable = ptp_enable;
if (ptp->info->do_aux_work) {
kthread_init_delayed_work(&ptp->aux_work, ptp_aux_kworker);
ptp->kworker = kthread_create_worker(0, "ptp%d", ptp->index);

View File

@@ -318,8 +318,8 @@ static int xlnx_rtc_probe(struct platform_device *pdev)
return ret;
}
/* Getting the rtc_clk info */
xrtcdev->rtc_clk = devm_clk_get_optional(&pdev->dev, "rtc_clk");
/* Getting the rtc info */
xrtcdev->rtc_clk = devm_clk_get_optional(&pdev->dev, "rtc");
if (IS_ERR(xrtcdev->rtc_clk)) {
if (PTR_ERR(xrtcdev->rtc_clk) != -EPROBE_DEFER)
dev_warn(&pdev->dev, "Device clock not found.\n");

View File

@@ -268,7 +268,7 @@ static void cdns_uart_handle_rx(void *dev_id, unsigned int isrstatus)
continue;
}
if (uart_handle_sysrq_char(port, data))
if (uart_prepare_sysrq_char(port, data))
continue;
if (is_rxbs_support) {
@@ -371,7 +371,7 @@ static irqreturn_t cdns_uart_isr(int irq, void *dev_id)
!(readl(port->membase + CDNS_UART_CR) & CDNS_UART_CR_RX_DIS))
cdns_uart_handle_rx(dev_id, isrstatus);
spin_unlock(&port->lock);
uart_unlock_and_check_sysrq(port);
return IRQ_HANDLED;
}
@@ -1231,10 +1231,8 @@ static void cdns_uart_console_write(struct console *co, const char *s,
unsigned int imr, ctrl;
int locked = 1;
if (port->sysrq)
locked = 0;
else if (oops_in_progress)
locked = spin_trylock_irqsave(&port->lock, flags);
if (oops_in_progress)
locked = uart_port_trylock_irqsave(port, &flags);
else
spin_lock_irqsave(&port->lock, flags);

View File

@@ -327,6 +327,8 @@ static void cachefiles_commit_object(struct cachefiles_object *object,
static void cachefiles_clean_up_object(struct cachefiles_object *object,
struct cachefiles_cache *cache)
{
struct file *file;
if (test_bit(FSCACHE_COOKIE_RETIRED, &object->cookie->flags)) {
if (!test_bit(CACHEFILES_OBJECT_USING_TMPFILE, &object->flags)) {
cachefiles_see_object(object, cachefiles_obj_see_clean_delete);
@@ -342,10 +344,14 @@ static void cachefiles_clean_up_object(struct cachefiles_object *object,
}
cachefiles_unmark_inode_in_use(object, object->file);
if (object->file) {
fput(object->file);
object->file = NULL;
}
spin_lock(&object->lock);
file = object->file;
object->file = NULL;
spin_unlock(&object->lock);
if (file)
fput(file);
}
/*

View File

@@ -61,20 +61,26 @@ static ssize_t cachefiles_ondemand_fd_write_iter(struct kiocb *kiocb,
{
struct cachefiles_object *object = kiocb->ki_filp->private_data;
struct cachefiles_cache *cache = object->volume->cache;
struct file *file = object->file;
struct file *file;
size_t len = iter->count;
loff_t pos = kiocb->ki_pos;
const struct cred *saved_cred;
int ret;
if (!file)
spin_lock(&object->lock);
file = object->file;
if (!file) {
spin_unlock(&object->lock);
return -ENOBUFS;
}
get_file(file);
spin_unlock(&object->lock);
cachefiles_begin_secure(cache, &saved_cred);
ret = __cachefiles_prepare_write(object, file, &pos, &len, true);
cachefiles_end_secure(cache, saved_cred);
if (ret < 0)
return ret;
goto out;
trace_cachefiles_ondemand_fd_write(object, file_inode(file), pos, len);
ret = __cachefiles_write(object, file, pos, iter, NULL, NULL);
@@ -83,6 +89,8 @@ static ssize_t cachefiles_ondemand_fd_write_iter(struct kiocb *kiocb,
kiocb->ki_pos += ret;
}
out:
fput(file);
return ret;
}
@@ -90,12 +98,22 @@ static loff_t cachefiles_ondemand_fd_llseek(struct file *filp, loff_t pos,
int whence)
{
struct cachefiles_object *object = filp->private_data;
struct file *file = object->file;
struct file *file;
loff_t ret;
if (!file)
spin_lock(&object->lock);
file = object->file;
if (!file) {
spin_unlock(&object->lock);
return -ENOBUFS;
}
get_file(file);
spin_unlock(&object->lock);
return vfs_llseek(file, pos, whence);
ret = vfs_llseek(file, pos, whence);
fput(file);
return ret;
}
static long cachefiles_ondemand_fd_ioctl(struct file *filp, unsigned int ioctl,

View File

@@ -1065,26 +1065,39 @@ int ocfs2_find_entry(const char *name, int namelen,
{
struct buffer_head *bh;
struct ocfs2_dir_entry *res_dir = NULL;
int ret = 0;
if (ocfs2_dir_indexed(dir))
return ocfs2_find_entry_dx(name, namelen, dir, lookup);
if (unlikely(i_size_read(dir) <= 0)) {
ret = -EFSCORRUPTED;
mlog_errno(ret);
goto out;
}
/*
* The unindexed dir code only uses part of the lookup
* structure, so there's no reason to push it down further
* than this.
*/
if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL)
if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
if (unlikely(i_size_read(dir) > dir->i_sb->s_blocksize)) {
ret = -EFSCORRUPTED;
mlog_errno(ret);
goto out;
}
bh = ocfs2_find_entry_id(name, namelen, dir, &res_dir);
else
} else {
bh = ocfs2_find_entry_el(name, namelen, dir, &res_dir);
}
if (bh == NULL)
return -ENOENT;
lookup->dl_leaf_bh = bh;
lookup->dl_entry = res_dir;
return 0;
out:
return ret;
}
/*
@@ -2011,6 +2024,7 @@ int ocfs2_lookup_ino_from_name(struct inode *dir, const char *name,
*
* Return 0 if the name does not exist
* Return -EEXIST if the directory contains the name
* Return -EFSCORRUPTED if found corruption
*
* Callers should have i_rwsem + a cluster lock on dir
*/
@@ -2024,9 +2038,12 @@ int ocfs2_check_dir_for_entry(struct inode *dir,
trace_ocfs2_check_dir_for_entry(
(unsigned long long)OCFS2_I(dir)->ip_blkno, namelen, name);
if (ocfs2_find_entry(name, namelen, dir, &lookup) == 0) {
ret = ocfs2_find_entry(name, namelen, dir, &lookup);
if (ret == 0) {
ret = -EEXIST;
mlog_errno(ret);
} else if (ret == -ENOENT) {
ret = 0;
}
ocfs2_free_dir_lookup_result(&lookup);

View File

@@ -1624,6 +1624,7 @@ bool io_alloc_async_data(struct io_kiocb *req)
int io_req_prep_async(struct io_kiocb *req)
{
const struct io_op_def *def = &io_op_defs[req->opcode];
int ret;
/* assign early for deferred execution for non-fixed file */
if (def->needs_file && !(req->flags & REQ_F_FIXED_FILE) && !req->file)
@@ -1636,7 +1637,9 @@ int io_req_prep_async(struct io_kiocb *req)
if (io_alloc_async_data(req))
return -EAGAIN;
}
return def->prep_async(req);
ret = def->prep_async(req);
io_kbuf_recycle(req, 0);
return ret;
}
static u32 io_get_sequence(struct io_kiocb *req)

View File

@@ -307,6 +307,8 @@ static int io_poll_check_events(struct io_kiocb *req, bool *locked)
}
} else {
int ret = io_poll_issue(req, locked);
io_kbuf_recycle(req, 0);
if (ret == IOU_STOP_MULTISHOT)
return IOU_POLL_REMOVE_POLL_USE_RES;
if (ret < 0)

View File

@@ -772,6 +772,8 @@ static int __io_read(struct io_kiocb *req, unsigned int issue_flags)
goto done;
ret = 0;
} else if (ret == -EIOCBQUEUED) {
req->flags |= REQ_F_PARTIAL_IO;
io_kbuf_recycle(req, issue_flags);
if (iovec)
kfree(iovec);
return IOU_ISSUE_SKIP_COMPLETE;
@@ -795,6 +797,9 @@ static int __io_read(struct io_kiocb *req, unsigned int issue_flags)
goto done;
}
req->flags |= REQ_F_PARTIAL_IO;
io_kbuf_recycle(req, issue_flags);
io = req->async_data;
s = &io->s;
/*
@@ -935,6 +940,11 @@ int io_write(struct io_kiocb *req, unsigned int issue_flags)
else
ret2 = -EINVAL;
if (ret2 == -EIOCBQUEUED) {
req->flags |= REQ_F_PARTIAL_IO;
io_kbuf_recycle(req, issue_flags);
}
if (req->flags & REQ_F_REISSUE) {
req->flags &= ~REQ_F_REISSUE;
ret2 = -EAGAIN;

View File

@@ -1896,11 +1896,11 @@ static inline int mab_no_null_split(struct maple_big_node *b_node,
* Return: The first split location. The middle split is set in @mid_split.
*/
static inline int mab_calc_split(struct ma_state *mas,
struct maple_big_node *bn, unsigned char *mid_split, unsigned long min)
struct maple_big_node *bn, unsigned char *mid_split)
{
unsigned char b_end = bn->b_end;
int split = b_end / 2; /* Assume equal split. */
unsigned char slot_min, slot_count = mt_slots[bn->type];
unsigned char slot_count = mt_slots[bn->type];
/*
* To support gap tracking, all NULL entries are kept together and a node cannot
@@ -1933,17 +1933,7 @@ static inline int mab_calc_split(struct ma_state *mas,
split = b_end / 3;
*mid_split = split * 2;
} else {
slot_min = mt_min_slots[bn->type];
*mid_split = 0;
/*
* Avoid having a range less than the slot count unless it
* causes one node to be deficient.
* NOTE: mt_min_slots is 1 based, b_end and split are zero.
*/
while (((bn->pivot[split] - min) < slot_count - 1) &&
(split < slot_count - 1) && (b_end - split > slot_min))
split++;
}
/* Avoid ending a node on a NULL entry */
@@ -2452,7 +2442,7 @@ static inline struct maple_enode
static inline unsigned char mas_mab_to_node(struct ma_state *mas,
struct maple_big_node *b_node, struct maple_enode **left,
struct maple_enode **right, struct maple_enode **middle,
unsigned char *mid_split, unsigned long min)
unsigned char *mid_split)
{
unsigned char split = 0;
unsigned char slot_count = mt_slots[b_node->type];
@@ -2465,7 +2455,7 @@ static inline unsigned char mas_mab_to_node(struct ma_state *mas,
if (b_node->b_end < slot_count) {
split = b_node->b_end;
} else {
split = mab_calc_split(mas, b_node, mid_split, min);
split = mab_calc_split(mas, b_node, mid_split);
*right = mas_new_ma_node(mas, b_node);
}
@@ -2955,7 +2945,7 @@ static int mas_spanning_rebalance(struct ma_state *mas,
mast->bn->b_end--;
mast->bn->type = mte_node_type(mast->orig_l->node);
split = mas_mab_to_node(mas, mast->bn, &left, &right, &middle,
&mid_split, mast->orig_l->min);
&mid_split);
mast_set_split_parents(mast, left, middle, right, split,
mid_split);
mast_cp_to_nodes(mast, left, middle, right, split, mid_split);
@@ -3464,7 +3454,7 @@ static int mas_split(struct ma_state *mas, struct maple_big_node *b_node)
if (mas_push_data(mas, height, &mast, false))
break;
split = mab_calc_split(mas, b_node, &mid_split, prev_l_mas.min);
split = mab_calc_split(mas, b_node, &mid_split);
mast_split_data(&mast, mas, split);
/*
* Usually correct, mab_mas_cp in the above call overwrites

View File

@@ -2086,7 +2086,8 @@ static int mptcp_nl_cmd_set_flags(struct sk_buff *skb, struct genl_info *info)
return -EINVAL;
}
if ((addr.flags & MPTCP_PM_ADDR_FLAG_FULLMESH) &&
(entry->flags & MPTCP_PM_ADDR_FLAG_SIGNAL)) {
(entry->flags & (MPTCP_PM_ADDR_FLAG_SIGNAL |
MPTCP_PM_ADDR_FLAG_IMPLICIT))) {
spin_unlock_bh(&pernet->lock);
return -EINVAL;
}

View File

@@ -149,6 +149,7 @@ static bool mptcp_try_coalesce(struct sock *sk, struct sk_buff *to,
int delta;
if (MPTCP_SKB_CB(from)->offset ||
((to->len + from->len) > (sk->sk_rcvbuf >> 3)) ||
!skb_try_coalesce(to, from, &fragstolen, &delta))
return false;

View File

@@ -1385,6 +1385,12 @@ static void ncsi_probe_channel(struct ncsi_dev_priv *ndp)
nd->state = ncsi_dev_state_probe_package;
break;
case ncsi_dev_state_probe_package:
if (ndp->package_probe_id >= 8) {
/* Last package probed, finishing */
ndp->flags |= NCSI_DEV_PROBED;
break;
}
ndp->pending_req_num = 1;
nca.type = NCSI_PKT_CMD_SP;
@@ -1501,13 +1507,8 @@ static void ncsi_probe_channel(struct ncsi_dev_priv *ndp)
if (ret)
goto error;
/* Probe next package */
/* Probe next package after receiving response */
ndp->package_probe_id++;
if (ndp->package_probe_id >= 8) {
/* Probe finished */
ndp->flags |= NCSI_DEV_PROBED;
break;
}
nd->state = ncsi_dev_state_probe_package;
ndp->active_package = NULL;
break;

View File

@@ -1089,14 +1089,12 @@ static int ncsi_rsp_handler_netlink(struct ncsi_request *nr)
static int ncsi_rsp_handler_gmcma(struct ncsi_request *nr)
{
struct ncsi_dev_priv *ndp = nr->ndp;
struct sockaddr *saddr = &ndp->pending_mac;
struct net_device *ndev = ndp->ndev.dev;
struct ncsi_rsp_gmcma_pkt *rsp;
struct sockaddr saddr;
int ret = -1;
int i;
rsp = (struct ncsi_rsp_gmcma_pkt *)skb_network_header(nr->rsp);
saddr.sa_family = ndev->type;
ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
netdev_info(ndev, "NCSI: Received %d provisioned MAC addresses\n",
@@ -1108,20 +1106,20 @@ static int ncsi_rsp_handler_gmcma(struct ncsi_request *nr)
rsp->addresses[i][4], rsp->addresses[i][5]);
}
saddr->sa_family = ndev->type;
for (i = 0; i < rsp->address_count; i++) {
memcpy(saddr.sa_data, &rsp->addresses[i], ETH_ALEN);
ret = ndev->netdev_ops->ndo_set_mac_address(ndev, &saddr);
if (ret < 0) {
if (!is_valid_ether_addr(rsp->addresses[i])) {
netdev_warn(ndev, "NCSI: Unable to assign %pM to device\n",
saddr.sa_data);
rsp->addresses[i]);
continue;
}
netdev_warn(ndev, "NCSI: Set MAC address to %pM\n", saddr.sa_data);
memcpy(saddr->sa_data, rsp->addresses[i], ETH_ALEN);
netdev_warn(ndev, "NCSI: Will set MAC address to %pM\n", saddr->sa_data);
break;
}
ndp->gma_flag = ret == 0;
return ret;
ndp->gma_flag = 1;
return 0;
}
static struct ncsi_rsp_handler {

View File

@@ -693,7 +693,7 @@ int osnoise_set_tracing_thresh(struct osnoise_context *context, long long tracin
retval = osnoise_write_ll_config("tracing_thresh", tracing_thresh);
if (retval < 0)
return -1;
return -2;
context->tracing_thresh = tracing_thresh;

View File

@@ -783,9 +783,12 @@ out_err:
}
static int stop_tracing;
static struct trace_instance *hist_inst = NULL;
static void stop_hist(int sig)
{
stop_tracing = 1;
if (hist_inst)
trace_instance_stop(hist_inst);
}
/*
@@ -828,6 +831,12 @@ int timerlat_hist_main(int argc, char *argv[])
}
trace = &tool->trace;
/*
* Save trace instance into global variable so that SIGINT can stop
* the timerlat tracer.
* Otherwise, rtla could loop indefinitely when overloaded.
*/
hist_inst = trace;
retval = enable_timerlat(trace);
if (retval) {
@@ -894,7 +903,7 @@ int timerlat_hist_main(int argc, char *argv[])
return_value = 0;
if (trace_is_off(&tool->trace, &record->trace)) {
if (trace_is_off(&tool->trace, &record->trace) && !stop_tracing) {
printf("rtla timerlat hit stop tracing\n");
if (params->trace_output) {
printf(" Saving trace to %s\n", params->trace_output);

View File

@@ -575,9 +575,12 @@ out_err:
}
static int stop_tracing;
static struct trace_instance *top_inst = NULL;
static void stop_top(int sig)
{
stop_tracing = 1;
if (top_inst)
trace_instance_stop(top_inst);
}
/*
@@ -620,6 +623,13 @@ int timerlat_top_main(int argc, char *argv[])
}
trace = &top->trace;
/*
* Save trace instance into global variable so that SIGINT can stop
* the timerlat tracer.
* Otherwise, rtla could loop indefinitely when overloaded.
*/
top_inst = trace;
retval = enable_timerlat(trace);
if (retval) {
@@ -690,7 +700,7 @@ int timerlat_top_main(int argc, char *argv[])
return_value = 0;
if (trace_is_off(&top->trace, &record->trace)) {
if (trace_is_off(&top->trace, &record->trace) && !stop_tracing) {
printf("rtla timerlat hit stop tracing\n");
if (params->trace_output) {
printf(" Saving trace to %s\n", params->trace_output);

View File

@@ -196,6 +196,14 @@ int trace_instance_start(struct trace_instance *trace)
return tracefs_trace_on(trace->inst);
}
/*
* trace_instance_stop - stop tracing a given rtla instance
*/
int trace_instance_stop(struct trace_instance *trace)
{
return tracefs_trace_off(trace->inst);
}
/*
* trace_events_free - free a list of trace events
*/

View File

@@ -21,6 +21,7 @@ struct trace_instance {
int trace_instance_init(struct trace_instance *trace, char *tool_name);
int trace_instance_start(struct trace_instance *trace);
int trace_instance_stop(struct trace_instance *trace);
void trace_instance_destroy(struct trace_instance *trace);
struct trace_seq *get_trace_seq(void);