Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp633603pxb; Fri, 8 Jan 2021 14:03:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJzX7wC95hOql1rL7cPpGiO5phZSa74g2jrRmgjz5lWduBMVXtMbjF7B2e2P1PO15wajVlUB X-Received: by 2002:a05:6402:308b:: with SMTP id de11mr6521774edb.205.1610143431127; Fri, 08 Jan 2021 14:03:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610143431; cv=none; d=google.com; s=arc-20160816; b=ZI2vccHSgl7WwrByyLkylPc7mmrqb6BkuwAl23wt9ht8OYDutsScdCYSe7CrgGfFqK SjP5An23pJQzmS54f4VrWzGqsKeeVPOEsTyzCC86JT8SO7J0HTWBQ8pqmzB37TH5lr1S Y49Kx1AqidKpnwsUnXjO7m/KMXpefY5CQQPNhlMuJ5GwGUtYMPTdkyRvZe2NBhe2v7QR xZ4PAPfF6OImimL8a7j+OYJHWYyQ/0DKuPGNCpUTWjJfElIy61LFqwTM75YTG2HutR67 CFQDYWyaigip4FiOKjPh+8l0zY9AzhXEacRqPEz9UpWRfQbxetgTuS5h3jEHuMAQTuPY HN7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=rY5ZPZc+UpoVk06JLNrDEFfoZnlAUfsw6zwHWZ87dfE=; b=VGfiv5cPRDCasPpqEF1VQ8cNb3qUfHXB93IhWqG8THwZ/rWRwG5/s1UX8dPZLqJkmJ w/TNHc+J4gCCFbG4f6lnLHq97jGSFVmSy3PYDEZE41GjylImJGroo5xK+teOndlhCwzu V0d+KbvIb+qugmsGl1LZCsinUTvHQBNPqM45nZx9DMaPpRzyUX48ihNjdsAKLieLfQET j5w+X0CWXX8AMn2kh77+E0zZMiJ3f48tZ1gZlZFnjDUGvUZLExjhnS+BHOtaooADsXkE bieNw+odobSq9KKvprMFvY5CRPc+/T83gMEYaApvr2LPj4j6FF4cP99sKL3BG4LuyUM8 mdfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TFFdqAlX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w2si4855396edi.59.2021.01.08.14.02.59; Fri, 08 Jan 2021 14:03:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TFFdqAlX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726011AbhAHWAY (ORCPT + 99 others); Fri, 8 Jan 2021 17:00:24 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:43718 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725901AbhAHWAY (ORCPT ); Fri, 8 Jan 2021 17:00:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610143138; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=rY5ZPZc+UpoVk06JLNrDEFfoZnlAUfsw6zwHWZ87dfE=; b=TFFdqAlXilUUMJpUosjGVMjVRPa/zh+Atgiv7Ncc7SkAqeBZPIc6USzwCwZakh2E2u0sIh tVXnOnu3P3SgM3nM9sQXbKYzKwnCWhWEwTsF0oKKQWavtXTINZX4K/qZ7rDJvM28VMCMkt m8UNz5OxltWgNzBVXrnwlrmLsXr+2tw= Received: from mail-il1-f197.google.com (mail-il1-f197.google.com [209.85.166.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-460-dZiinM59P2iLT3cnpBJAWQ-1; Fri, 08 Jan 2021 16:58:56 -0500 X-MC-Unique: dZiinM59P2iLT3cnpBJAWQ-1 Received: by mail-il1-f197.google.com with SMTP id f19so11628756ilk.8 for ; Fri, 08 Jan 2021 13:58:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=rY5ZPZc+UpoVk06JLNrDEFfoZnlAUfsw6zwHWZ87dfE=; b=rzmpklJ/+OvH2HfoqPRr0ERt4wkvRU2hVTVrlGA5ou//9KvXGob9QbD1LQcziTRAks xN9HHJnePJ2kpGpyR3+nx1d/2w+7GHgvPa4LsHgaznpopx0Daxp0tYuifbXbhub+eLPW LDewD+JW8+3dQnR1hm/IPg5hH379qA2+sSqN2L9NX5Dga9RXiS4dkgboM3LlgF6xH6Lf oPci/7E0aiD9WKRkqQ5HEfVpWlGfjlQpl4proYDgnaAiMgrij2ouJwIVaAGMlSL/a2/p wPRscWuCfJ2oIjquE8u/OVIgGg5XthWro9RT9fLlWtrvvNBDPlJ1QRBhTj99zffTzgOq v6tQ== X-Gm-Message-State: AOAM5318fp9YkdBg0A6k55lE/JwgpTvnktVFo6VeOgWPZ/WFa/vsCmSp v1bCP8+hEMWlrc7O9ZSTyG4gAhAJ0OnOz906pffkCQiKOSzfv4J36zqtLACCTkxPIIANH+k82De SI6BIvGAjsGpK4f/az1b/LugV X-Received: by 2002:a6b:1454:: with SMTP id 81mr7014763iou.96.1610143135590; Fri, 08 Jan 2021 13:58:55 -0800 (PST) X-Received: by 2002:a6b:1454:: with SMTP id 81mr7014752iou.96.1610143135364; Fri, 08 Jan 2021 13:58:55 -0800 (PST) Received: from dev.jcline.org ([2605:a601:a63a:4d01:c440:5c61:43ba:350c]) by smtp.gmail.com with ESMTPSA id h18sm5961873ioh.30.2021.01.08.13.58.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 13:58:54 -0800 (PST) From: Jeremy Cline To: Harry Wentland , Leo Li Cc: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , David Airlie , Daniel Vetter , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jeremy Cline , Timothy Pearson Subject: [PATCH] amdgpu: Avoid sleeping during FPU critical sections Date: Fri, 8 Jan 2021 16:58:38 -0500 Message-Id: <20210108215838.470637-1-jcline@redhat.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org dcn20_resource_construct() includes a number of kzalloc(GFP_KERNEL) calls which can sleep, but kernel_fpu_begin() disables preemption and sleeping in this context is invalid. The only places the FPU appears to be required is in the init_soc_bounding_box() function and when calculating the {min,max}_fill_clk_mhz. Narrow the scope to just these two parts to avoid sleeping while using the FPU. Fixes: 7a8a3430be15 ("amdgpu: Wrap FPU dependent functions in dc20") Cc: Timothy Pearson Signed-off-by: Jeremy Cline --- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c index e04ecf0fc0db..a4fa5bf016c1 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c @@ -3622,6 +3622,7 @@ static bool init_soc_bounding_box(struct dc *dc, if (bb && ASICREV_IS_NAVI12_P(dc->ctx->asic_id.hw_internal_rev)) { int i; + DC_FP_START(); dcn2_0_nv12_soc.sr_exit_time_us = fixed16_to_double_to_cpu(bb->sr_exit_time_us); dcn2_0_nv12_soc.sr_enter_plus_exit_time_us = @@ -3721,6 +3722,7 @@ static bool init_soc_bounding_box(struct dc *dc, dcn2_0_nv12_soc.clock_limits[i].dram_speed_mts = fixed16_to_double_to_cpu(bb->clock_limits[i].dram_speed_mts); } + DC_FP_END(); } if (pool->base.pp_smu) { @@ -3777,8 +3779,6 @@ static bool dcn20_resource_construct( enum dml_project dml_project_version = get_dml_project_version(ctx->asic_id.hw_internal_rev); - DC_FP_START(); - ctx->dc_bios->regs = &bios_regs; pool->base.funcs = &dcn20_res_pool_funcs; @@ -3959,8 +3959,10 @@ static bool dcn20_resource_construct( ranges.reader_wm_sets[i].wm_inst = i; ranges.reader_wm_sets[i].min_drain_clk_mhz = PP_SMU_WM_SET_RANGE_CLK_UNCONSTRAINED_MIN; ranges.reader_wm_sets[i].max_drain_clk_mhz = PP_SMU_WM_SET_RANGE_CLK_UNCONSTRAINED_MAX; + DC_FP_START(); ranges.reader_wm_sets[i].min_fill_clk_mhz = (i > 0) ? (loaded_bb->clock_limits[i - 1].dram_speed_mts / 16) + 1 : 0; ranges.reader_wm_sets[i].max_fill_clk_mhz = loaded_bb->clock_limits[i].dram_speed_mts / 16; + DC_FP_END(); ranges.num_reader_wm_sets = i + 1; } @@ -4125,12 +4127,10 @@ static bool dcn20_resource_construct( pool->base.oem_device = NULL; } - DC_FP_END(); return true; create_fail: - DC_FP_END(); dcn20_resource_destruct(pool); return false; -- 2.28.0