Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751673AbdFOUq5 (ORCPT ); Thu, 15 Jun 2017 16:46:57 -0400 Received: from mail-co1nam03on0049.outbound.protection.outlook.com ([104.47.40.49]:21448 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750749AbdFOUqy (ORCPT ); Thu, 15 Jun 2017 16:46:54 -0400 Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=amd.com; Subject: Re: [PATCH] drm/core: Fail atomic IOCTL with no CRTC state but with signaling. To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, maarten.lankhorst@linux.intel.com References: <1497043819-28591-1-git-send-email-Andrey.Grodzovsky@amd.com> Cc: amd-gfx@lists.freedesktop.org, harry.wentland@amd.com From: Andrey Grodzovsky Message-ID: <41dc2978-419f-35cb-224e-8bfd345857c4@amd.com> Date: Thu, 15 Jun 2017 16:46:49 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <1497043819-28591-1-git-send-email-Andrey.Grodzovsky@amd.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.55.251] X-ClientProxiedBy: CY4PR1101CA0008.namprd11.prod.outlook.com (10.172.74.146) To DM5PR1201MB0107.namprd12.prod.outlook.com (10.174.106.136) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1201MB0107: X-MS-Office365-Filtering-Correlation-Id: 2208ddec-efac-4019-f625-08d4b42fa742 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(48565401081)(201703131423075)(201703031133081);SRVR:DM5PR1201MB0107; X-Microsoft-Exchange-Diagnostics: 1;DM5PR1201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h90jT3ot6oZTbhodvyqyTX11asqFtCwGNq/2BpjqO65gQZTRSnAzPqqx/fRbdUhpEDFBEw=;20:s+pyuiU2ju/VVrM8pahYLrUycfLX0gk/61+1blb0/k0RRrcFbEu4zUgMLxV3p4URUZZ0wdTTmBC9aBlAKI96BWRSsuuIyK1HZT86SbDMzKh6IlkBjhTUcDHMTIN0EIt5kMT1Wi6CBzeqU41aYenOcNE0NO/4NziZyCk2LV+A0x2N1AV0pIy3YUY1Sbz5Hxuq5xJh+FwA5GZ+ouxjZI2gurrraGb0UxefLiUK2QIKHpRYOhwGyFRh2t0GDQfaXjCYxvhjChA571ERFuQ3CNBQFcMGpypLFHoaC8b63aMzsLzGyTDtocufq6QlYEhADErVcLbp65cUgKiZKe03P52oL2UO/bF40EgxjqrqPp0epfTJKfFctfBKh7n70HWvVYTUp/e77MEfRjgvalsI/bi1o7vmsyCmQPwD5lSsfr12sRvhVM2/lfV3WwZr798a8+1JWdNUQ+ocYnt4YGTwde7isl6eqz1UZL5JkMN3yeT0azDP/pFrshS34J7yhZQ54QSO X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(10201501046)(100000703101)(100105400095)(6055026)(6041248)(20161123560025)(20161123555025)(20161123558100)(20161123564025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DM5PR1201MB0107;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DM5PR1201MB0107; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;DM5PR1201MB0107;4:e00y9RDMelTw9upd1lFArWip3JBy1qFF9yDu?= =?Windows-1252?Q?/keHd33AzBxaD3AWz2pNTDUPVW3y0K7SL9Y3MnfcQF3urDWZ4EIWPZLk?= =?Windows-1252?Q?hxhtQvuxXpmootQkBU5A9/Vm5ioRLcB0YOdNvvIlLoe/Z6nB1K0YYZex?= =?Windows-1252?Q?ZZPOnKhR88/U8WW/X/AVqpMzSAdrLjcsKBsApJsngkIB+V3Wlo71r8I9?= =?Windows-1252?Q?KzT+tzSlASl9iG4HLEXQVvHiiyki1yiPVSn9vflP0O9AMgqvuDskSSTQ?= =?Windows-1252?Q?HpJF0hls5uQW6lwfof7HbuP70cLtPkKktQFjh0mkEpokmLWvdaklFDxg?= =?Windows-1252?Q?VKGpgp+frM3m2J3HUGVgr4+PTgDLLATUWo4K4Yjn+TUXs8T92yBrvE0+?= =?Windows-1252?Q?JtD/dKDEfUgWKvDPE6ttkTFGsEHWyRgcIpYIImvReR48No3DPec9vwSW?= =?Windows-1252?Q?gQcoMiDFiQpgoToK6id84N7cvgUZsRDOojDllCinjuSShJXyLRuiF7nl?= =?Windows-1252?Q?b6EjFsrJY5rR6WUqHkHPY++xyfratEWe9IEMsKZmFN6SiCxApqWq+65v?= =?Windows-1252?Q?a8bZ/qdVx8Md4+DLleptUBA2IPSSzc82EWMUrB5Mtm83XS2YSgdzxHHp?= =?Windows-1252?Q?F83QlTdc9smvt9/2gngd2pr6DST/r910uIVR/nzLzZGgZq4WPbiBQneg?= =?Windows-1252?Q?devSAjVH2cdBFK6o2ItBxTiJbR1e/88J8NJCVMFdOOql8CiFjeHfWaS8?= =?Windows-1252?Q?adQ8jwnqxEgoCeaBk5P0HXCGJOs/ip1hV0lqAV6T9jflp+mcFrecuIhv?= =?Windows-1252?Q?dByYdEhL2jL6WiC5Q0TpotoRzUAPbrkF5/GQsbi5uaNTTjfJPOnV31lJ?= =?Windows-1252?Q?5pwnwzUaycdOm4ZlF8X3LypOb63SJgNQPcOMREYd+vrBiOIUMQbvsKUO?= =?Windows-1252?Q?fR/AY/6Nz/1T9o5eVO05rCUPb0vnx9WzpPvWtktkr0iObIH3cznOphal?= =?Windows-1252?Q?yoyYI3PodGC2dNVtSfDPlPqJqj9UOYs25rLcnn6xI4cSWGOZoKXtRaCk?= =?Windows-1252?Q?n7450uqFiWQ9wx9B7RjrwNXQLqX20RVkztwZ1uU+SGgQdJCZANRCeYPv?= =?Windows-1252?Q?sIgST1e8u5JGOi2BAlswMiNv/eVAzBhMFhpY2XgBov3tsxFhdvFWsxjE?= =?Windows-1252?Q?go7W+Ym9RrcjF1PgKLjVIwmOcLQESnLpcO3pl1BEXtN86l94chjwcP74?= =?Windows-1252?Q?TRAxt9QeTX2relohF40diBKyg0PFCYjTK53J0Hvb0+nx4NT9a5q1nVnr?= =?Windows-1252?Q?UXT1?= X-Forefront-PRVS: 0339F89554 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6049001)(6009001)(39410400002)(39850400002)(39450400003)(39400400002)(39840400002)(39860400002)(53434003)(24454002)(377454003)(38730400002)(478600001)(3846002)(53546009)(25786009)(53936002)(6116002)(66066001)(64126003)(4326008)(230700001)(31696002)(65826007)(50986999)(76176999)(5660300001)(81166006)(8676002)(36756003)(5890100001)(83506001)(86362001)(229853002)(31686004)(42186005)(189998001)(7736002)(305945005)(33646002)(4001350100001)(54356999)(50466002)(6486002)(90366009)(110136004)(2906002)(23746002)(77096006)(72206003)(47776003)(2950100002)(6666003);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR1201MB0107;H:[172.29.156.107];FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;DM5PR1201MB0107;23:RChhXMYcnbz1AyTN3RpZiJ46SScA64Rsb3/?= =?Windows-1252?Q?J9kjSSjZ9wYaKDA6g3sVfIEuDQguiFy+Pf3kcEPjGI1lDIWMnPVvSgid?= =?Windows-1252?Q?NnfATs+Au+kUxhJzvRYjzaNMpJJxLiL5R2Un7z5Q3h1swFZyolVe0SrS?= =?Windows-1252?Q?4d0rOjs2fi3iBgwxVs4ISgZBO5BLlmUyOUDrkFhhZdR4LewvbXc+7PJE?= =?Windows-1252?Q?gwNzz/K5ils659cdjRfjv8t7gBF3zmcvjL+sQFrUy4RMT9Nlq9Bwpfco?= =?Windows-1252?Q?T/49A3hqMWjjlmK9SR6GLo8592Bpm0ij3EaO/Su7O5T6UOSzBltid0oN?= =?Windows-1252?Q?1tLzta0DBUIUccruzysKfU2Rr9OTKL/f2lRB75o9gD81E4oJAKOAkU+A?= =?Windows-1252?Q?AgVcDUtk4cgB3VH3D9MeHHvGtN0i4tbcqjzmmDUnuwnNtfZVDLQ6feNF?= =?Windows-1252?Q?oj5nqEC4YMhsudch0OsreUeIKZ8Q1YcyAK9YmQrKRKptcTNWwDQjPjIW?= =?Windows-1252?Q?jJF+H5EShKjsZBvv4haFmU0GTHocZ+gtNPTOVfdiIYAvGMygvStbBZp4?= =?Windows-1252?Q?zH71D8xll2v9mV8CobuoCI53ygjMtYSnj+R0Z/toWdv49Ib10YHe/92D?= =?Windows-1252?Q?fit+2/LgoNI6DLbbtytB0HnOelRzlqtoe1Znsl8dqEGIpbnBAxTuPDW1?= =?Windows-1252?Q?G2AbkBdpqiNMrkvhO4B/O/CtCWjJ8N4sAFvlHM+EB9PylxaV2eH/+A1u?= =?Windows-1252?Q?1FSjLmY7IXGBgiG1PEP2FN9Exx30wqDm0UBOIJdDA9pYZ4S/IYkU90r0?= =?Windows-1252?Q?4qcqipow2NG/Jxg9fMv40zfOO9+vCxV6S1c94fZ3MOIoyxDAr2m5GxRj?= =?Windows-1252?Q?iyfQb1GA26WKc/fd14LEzA8RG1FeDQKBwC67GR4oCO9ahLGbNXYmc7My?= =?Windows-1252?Q?akaIKb4fbxPBoDNcLcEgbxZ/vbolP+bLsgfJYc79jz9GS3L4a81Rwfuz?= =?Windows-1252?Q?FiSw+jVdmTlkeuU+evYZVyDqVPvTSmYbW6CGYftKoMSARKXBCWlmWjiz?= =?Windows-1252?Q?FJJf0ZO8jH1HVyLkUiP3c87+SKd6b3dd8srsFOQACzB26dKu1PeU44uU?= =?Windows-1252?Q?NnSbUqW0QtRradFz0zjVsp/Ji8Itg7PKcBXGJB4sCbPlR8NEXOeXGyyl?= =?Windows-1252?Q?KCALJM/bJGaC6feCPlPYZDHog3rv0TX7LG1RhwIiSWJx5UE1BXt6SFES?= =?Windows-1252?Q?S8QcWG0rHTFt3hEXw/FPJb/1DScPYy/zR26avqo96G3yjC9Fpo7tKiJ6?= =?Windows-1252?Q?O/th+DEj1gcB18SJ2D+sO6n4pu5z9jdIn+76J/qXqwesu+/2bXhivoNl?= =?Windows-1252?Q?M9zIGpATZ673GhUVgo/gCYLkjjRO9pLPZ1FQ9A8htWyUzzMFLDKHyQts?= =?Windows-1252?Q?8k1XU+XMNcL5rXlG0Ehi3uZopYeY07qT3UyTrUfnZdg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;DM5PR1201MB0107;6:CXm1a2zed/naD/+9Ry+7eM8ZlbBLZAPas665r6YeSOuT2a4gUY8en37ZG9fBNVcYUI5RTaYvcvbffJfeOKDYatjtqjs5mOcNnGLoH/48BARxjdwyOms2ppLekPQWAaN2om0j/IHuH8KsMfvneZViPrbjUwpxO1Tkz5bKg+s82s6lG7ojXtpYZCfClkxtE+HsfA7rJTtYyI5w3r3sOd08x/ycFB7p/03wa7hKRGJdiglPcHLf7V8yDk5/gYJGlzr0odkzAeZjKY0DrxBJj88gQYnBtSbJ4hyiuYVOrLiMoNESwYMcu3OkJuuK4JQYuDR+JpDtMQH93jaDXD09Rwopsm5o6EtPD4MRfqhdKYhHBqiXOswnIcz/sFIxBqt9mRU/bgVEABvE6ITkD2mRRyyMX3Qfsm1cRR2MGwUhhJqDfmESWphz32uDvlBw+O5SpePuU8KlYUVrpmPKIpioVmmimMCattVuaMGpxQwFotttI5LflYfLWlblyOdf2uDXNUbAhekl/jjkzFrc83W16px0gG8VkXF84hcxZDO8anJOTDE= X-Microsoft-Exchange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wZB7jEVg==;20:H+7sVnNAlWK4caMv0qplPZQgihdDjpMzUULDz1b3aGByqn7RlcS57WvZ35SpiYVCjoRlH0t0z48aEklYPh3hNToy9dk804U7MSzD2Dp0LGl+FHaUY7TcD8k3tZ9HIOuDSQPNoYkqCadjHetuIy9gfkqsR1mHtBx82RkvlMuJ+gkk4wTsPh3QOns4aAkI0ifAx8zXmvVgKUakbVeef4GnNomDsjfSCZIPXOg+P6I9Blvz7BemVxPNBXXbjf2BkGTY X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2017 20:46:52.0134 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0107 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2141 Lines: 66 Just a reminder. Thanks. On 06/09/2017 05:30 PM, Andrey Grodzovsky wrote: > Problem: > While running IGT kms_atomic_transition test suite i encountered > a hang in drmHandleEvent immidietly follwoing an atomic_commit. > After dumping the atomic state I relized that in this case there was > not even one CRTC attached to the state and only disabled > planes. This probably due to a commit which hadn't changed any property > which would require attaching crtc state. This means drmHandleEvent > will never wake up from read since without CRTC in atomic state > the event fd will not be singnaled. > This point to a bug in IGT but also DRM should gracefully > fail such scenario so no hang on user side will happen. > > Fix: > Explicitly fail by failing atomic_commit early in > drm_mode_atomic_commit where such problem can be identified. > > Signed-off-by: Andrey Grodzovsky > --- > drivers/gpu/drm/drm_atomic.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c > index a567310..32eae1c 100644 > --- a/drivers/gpu/drm/drm_atomic.c > +++ b/drivers/gpu/drm/drm_atomic.c > @@ -1933,7 +1933,7 @@ static int prepare_crtc_signaling(struct drm_device *dev, > { > struct drm_crtc *crtc; > struct drm_crtc_state *crtc_state; > - int i, ret; > + int i, c = 0, ret; > > if (arg->flags & DRM_MODE_ATOMIC_TEST_ONLY) > return 0; > @@ -1994,8 +1994,17 @@ static int prepare_crtc_signaling(struct drm_device *dev, > > crtc_state->event->base.fence = fence; > } > + > + c++; > } > > + /* > + * Having this flag means user mode pends on event which will never > + * reach due to lack of at least one CRTC for signaling > + */ > + if (c == 0 && (arg->flags & DRM_MODE_PAGE_FLIP_EVENT)) > + return -EINVAL; > + > return 0; > } > > @@ -2179,6 +2188,8 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, > drm_mode_object_unreference(obj); > } > > + > + > ret = prepare_crtc_signaling(dev, state, arg, file_priv, &fence_state, > &num_fences); > if (ret)