Skip to content

Commit 53d5fc8

Browse files
committed
Merge tag 's390-5.15-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 fix from Vasily Gorbik: "One fix for 5.15-rc4: Avoid CIO excessive path-verification requests, which might cause unwanted delays" * tag 's390-5.15-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: s390/cio: avoid excessive path-verification requests
2 parents f5b667d + 172da89 commit 53d5fc8

File tree

3 files changed

+45
-13
lines changed

3 files changed

+45
-13
lines changed

drivers/s390/cio/blacklist.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,12 @@ static int blacklist_parse_proc_parameters(char *buf)
262262

263263
if (strcmp("free", parm) == 0) {
264264
rc = blacklist_parse_parameters(buf, free, 0);
265-
/* There could be subchannels without proper devices connected.
266-
* evaluate all the entries
265+
/*
266+
* Evaluate the subchannels without an online device. This way,
267+
* no path-verification will be triggered on those subchannels
268+
* and it avoids unnecessary delays.
267269
*/
268-
css_schedule_eval_all();
270+
css_schedule_eval_cond(CSS_EVAL_NOT_ONLINE, 0);
269271
} else if (strcmp("add", parm) == 0)
270272
rc = blacklist_parse_parameters(buf, add, 0);
271273
else if (strcmp("purge", parm) == 0)

drivers/s390/cio/css.c

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -788,27 +788,49 @@ static int __unset_registered(struct device *dev, void *data)
788788
return 0;
789789
}
790790

791-
void css_schedule_eval_all_unreg(unsigned long delay)
791+
static int __unset_online(struct device *dev, void *data)
792+
{
793+
struct idset *set = data;
794+
struct subchannel *sch = to_subchannel(dev);
795+
struct ccw_device *cdev = sch_get_cdev(sch);
796+
797+
if (cdev && cdev->online)
798+
idset_sch_del(set, sch->schid);
799+
800+
return 0;
801+
}
802+
803+
void css_schedule_eval_cond(enum css_eval_cond cond, unsigned long delay)
792804
{
793805
unsigned long flags;
794-
struct idset *unreg_set;
806+
struct idset *set;
795807

796808
/* Find unregistered subchannels. */
797-
unreg_set = idset_sch_new();
798-
if (!unreg_set) {
809+
set = idset_sch_new();
810+
if (!set) {
799811
/* Fallback. */
800812
css_schedule_eval_all();
801813
return;
802814
}
803-
idset_fill(unreg_set);
804-
bus_for_each_dev(&css_bus_type, NULL, unreg_set, __unset_registered);
815+
idset_fill(set);
816+
switch (cond) {
817+
case CSS_EVAL_UNREG:
818+
bus_for_each_dev(&css_bus_type, NULL, set, __unset_registered);
819+
break;
820+
case CSS_EVAL_NOT_ONLINE:
821+
bus_for_each_dev(&css_bus_type, NULL, set, __unset_online);
822+
break;
823+
default:
824+
break;
825+
}
826+
805827
/* Apply to slow_subchannel_set. */
806828
spin_lock_irqsave(&slow_subchannel_lock, flags);
807-
idset_add_set(slow_subchannel_set, unreg_set);
829+
idset_add_set(slow_subchannel_set, set);
808830
atomic_set(&css_eval_scheduled, 1);
809831
queue_delayed_work(cio_work_q, &slow_path_work, delay);
810832
spin_unlock_irqrestore(&slow_subchannel_lock, flags);
811-
idset_free(unreg_set);
833+
idset_free(set);
812834
}
813835

814836
void css_wait_for_slow_path(void)
@@ -820,7 +842,7 @@ void css_wait_for_slow_path(void)
820842
void css_schedule_reprobe(void)
821843
{
822844
/* Schedule with a delay to allow merging of subsequent calls. */
823-
css_schedule_eval_all_unreg(1 * HZ);
845+
css_schedule_eval_cond(CSS_EVAL_UNREG, 1 * HZ);
824846
}
825847
EXPORT_SYMBOL_GPL(css_schedule_reprobe);
826848

drivers/s390/cio/css.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@
3434
#define SNID_STATE3_MULTI_PATH 1
3535
#define SNID_STATE3_SINGLE_PATH 0
3636

37+
/*
38+
* Conditions used to specify which subchannels need evaluation
39+
*/
40+
enum css_eval_cond {
41+
CSS_EVAL_UNREG, /* unregistered subchannels */
42+
CSS_EVAL_NOT_ONLINE /* sch without an online-device */
43+
};
44+
3745
struct path_state {
3846
__u8 state1 : 2; /* path state value 1 */
3947
__u8 state2 : 2; /* path state value 2 */
@@ -136,7 +144,7 @@ static inline struct channel_subsystem *css_by_id(u8 cssid)
136144
/* Helper functions to build lists for the slow path. */
137145
void css_schedule_eval(struct subchannel_id schid);
138146
void css_schedule_eval_all(void);
139-
void css_schedule_eval_all_unreg(unsigned long delay);
147+
void css_schedule_eval_cond(enum css_eval_cond, unsigned long delay);
140148
int css_complete_work(void);
141149

142150
int sch_is_pseudo_sch(struct subchannel *);

0 commit comments

Comments
 (0)