of: overlay: check prevents multiple fragments touching same property
Add test case of two fragments updating the same property. After
adding the test case, the system hangs at end of boot, after
after slub stack dumps from kfree() in crypto modprobe code.
Multiple overlay fragments adding, modifying, or deleting the same
property is not supported. Add check to detect the attempt and fail
the overlay apply.
Before this patch, the first fragment error would terminate
processing. Allow fragment checking to proceed and report all
of the fragment errors before terminating the overlay apply. This
is not a hot path, thus not a performance issue (the error is not
transient and requires fixing the overlay before attempting to
apply it again).
After applying this patch, the devicetree unittest messages will
include:
OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/rpm_avail
...
### dt-test ### end of unittest - 212 passed, 0 failed
The check to detect two fragments updating the same property is
folded into the patch that created the test case to maintain
bisectability.
Tested-by: Alan Tull <atull@kernel.org>
Signed-off-by: Frank Rowand <frank.rowand@sony.com>
2018-10-05 11:36:18 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
/dts-v1/;
|
|
|
|
/plugin/;
|
|
|
|
|
|
|
|
/*
|
2020-04-17 05:42:50 +08:00
|
|
|
* &electric_1/motor-1/electric and &spin_ctrl_1/electric are the same node:
|
|
|
|
* /testcase-data-2/substation@100/motor-1/electric
|
of: overlay: check prevents multiple fragments touching same property
Add test case of two fragments updating the same property. After
adding the test case, the system hangs at end of boot, after
after slub stack dumps from kfree() in crypto modprobe code.
Multiple overlay fragments adding, modifying, or deleting the same
property is not supported. Add check to detect the attempt and fail
the overlay apply.
Before this patch, the first fragment error would terminate
processing. Allow fragment checking to proceed and report all
of the fragment errors before terminating the overlay apply. This
is not a hot path, thus not a performance issue (the error is not
transient and requires fixing the overlay before attempting to
apply it again).
After applying this patch, the devicetree unittest messages will
include:
OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/rpm_avail
...
### dt-test ### end of unittest - 212 passed, 0 failed
The check to detect two fragments updating the same property is
folded into the patch that created the test case to maintain
bisectability.
Tested-by: Alan Tull <atull@kernel.org>
Signed-off-by: Frank Rowand <frank.rowand@sony.com>
2018-10-05 11:36:18 +08:00
|
|
|
*
|
|
|
|
* Thus the property "rpm_avail" in each fragment will
|
|
|
|
* result in an attempt to update the same property twice.
|
|
|
|
* This will result in an error and the overlay apply
|
|
|
|
* will fail.
|
2020-04-17 05:42:50 +08:00
|
|
|
*
|
|
|
|
* The previous version of this test did not include the extra
|
|
|
|
* level of node 'electric'. That resulted in the 'rpm_avail'
|
|
|
|
* property being located in the pre-existing node 'motor-1'.
|
|
|
|
* Modifying a property results in a WARNING that a memory leak
|
|
|
|
* will occur if the overlay is removed. Since the overlay apply
|
|
|
|
* fails, the memory leak does actually occur, and kmemleak will
|
|
|
|
* further report the memory leak if CONFIG_DEBUG_KMEMLEAK is
|
|
|
|
* enabled. Adding the overlay node 'electric' avoids the
|
|
|
|
* memory leak and thus people who use kmemleak will not
|
|
|
|
* have to debug this non-problem again.
|
of: overlay: check prevents multiple fragments touching same property
Add test case of two fragments updating the same property. After
adding the test case, the system hangs at end of boot, after
after slub stack dumps from kfree() in crypto modprobe code.
Multiple overlay fragments adding, modifying, or deleting the same
property is not supported. Add check to detect the attempt and fail
the overlay apply.
Before this patch, the first fragment error would terminate
processing. Allow fragment checking to proceed and report all
of the fragment errors before terminating the overlay apply. This
is not a hot path, thus not a performance issue (the error is not
transient and requires fixing the overlay before attempting to
apply it again).
After applying this patch, the devicetree unittest messages will
include:
OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/rpm_avail
...
### dt-test ### end of unittest - 212 passed, 0 failed
The check to detect two fragments updating the same property is
folded into the patch that created the test case to maintain
bisectability.
Tested-by: Alan Tull <atull@kernel.org>
Signed-off-by: Frank Rowand <frank.rowand@sony.com>
2018-10-05 11:36:18 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
&electric_1 {
|
|
|
|
|
|
|
|
motor-1 {
|
2020-04-17 05:42:50 +08:00
|
|
|
electric {
|
|
|
|
rpm_avail = < 100 >;
|
|
|
|
};
|
of: overlay: check prevents multiple fragments touching same property
Add test case of two fragments updating the same property. After
adding the test case, the system hangs at end of boot, after
after slub stack dumps from kfree() in crypto modprobe code.
Multiple overlay fragments adding, modifying, or deleting the same
property is not supported. Add check to detect the attempt and fail
the overlay apply.
Before this patch, the first fragment error would terminate
processing. Allow fragment checking to proceed and report all
of the fragment errors before terminating the overlay apply. This
is not a hot path, thus not a performance issue (the error is not
transient and requires fixing the overlay before attempting to
apply it again).
After applying this patch, the devicetree unittest messages will
include:
OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/rpm_avail
...
### dt-test ### end of unittest - 212 passed, 0 failed
The check to detect two fragments updating the same property is
folded into the patch that created the test case to maintain
bisectability.
Tested-by: Alan Tull <atull@kernel.org>
Signed-off-by: Frank Rowand <frank.rowand@sony.com>
2018-10-05 11:36:18 +08:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
&spin_ctrl_1 {
|
2020-04-17 05:42:50 +08:00
|
|
|
electric {
|
|
|
|
rpm_avail = < 100 200 >;
|
|
|
|
};
|
of: overlay: check prevents multiple fragments touching same property
Add test case of two fragments updating the same property. After
adding the test case, the system hangs at end of boot, after
after slub stack dumps from kfree() in crypto modprobe code.
Multiple overlay fragments adding, modifying, or deleting the same
property is not supported. Add check to detect the attempt and fail
the overlay apply.
Before this patch, the first fragment error would terminate
processing. Allow fragment checking to proceed and report all
of the fragment errors before terminating the overlay apply. This
is not a hot path, thus not a performance issue (the error is not
transient and requires fixing the overlay before attempting to
apply it again).
After applying this patch, the devicetree unittest messages will
include:
OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/rpm_avail
...
### dt-test ### end of unittest - 212 passed, 0 failed
The check to detect two fragments updating the same property is
folded into the patch that created the test case to maintain
bisectability.
Tested-by: Alan Tull <atull@kernel.org>
Signed-off-by: Frank Rowand <frank.rowand@sony.com>
2018-10-05 11:36:18 +08:00
|
|
|
};
|