Re: [PATCH v3 2/8] s390/vfio_ccw: limit the number of channel program segments

From: Matthew Rosato

Date: Fri Jul 24 2026 - 11:55:08 EST


On 7/23/26 1:47 PM, Eric Farman wrote:
> The processing of channel programs, and the CCWs within them, is done
> recursively. As such, there is an arbitrary (but not architectural)
> limit to the number of CCWs that can exist in a single channel program.
>
> The vfio-ccw logic breaks these channel programs into segments whenever
> it encounters a Transfer-In-Channel (TIC) CCW, and the combined number
> of segments count towards the global limit. Impose an equivalent limit
> to the number of segments until such logic can be made non-recursive.
>

At a future point if/when this is made non-recursive, we should at that
time keep limits with sane defaults in-place but at also consider making
it kernel-configurable (like the vfio dma limit).

...

> * struct channel_program - manage information for channel program
> * @ccwchain_list: list head of ccwchains
> @@ -38,6 +43,7 @@ struct channel_program {
> union orb orb;
> bool initialized;
> struct ccw1 *guest_cp;
> + int ccwchain_count;

Nit: Unsigned?

Regardless:

Reviewed-by: Matthew Rosato <mjrosato@xxxxxxxxxxxxx>

> };
>
> int cp_init(struct channel_program *cp, union orb *orb);