Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp121109ybg; Mon, 8 Jun 2020 18:11:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjglalX9o/05Fn426ztCdADzltaTUyijCYQFLjVdgdH5kH/3rU6q8ujeCn7YVeaRg045nx X-Received: by 2002:a17:906:4944:: with SMTP id f4mr23307496ejt.3.1591665116779; Mon, 08 Jun 2020 18:11:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591665116; cv=none; d=google.com; s=arc-20160816; b=LonQlXgSiadboHLWqoNWByu7mnfqmebJYT0s350ItyeKVgrnNPO4MZwg8oaqLG1eD2 bJMpZT+emmSD9o6BX2DGWP2bmiqaXzB50hAuaRnV7Q4gsDDDaPKqBtPzD7tMIPG7bBqx sm2uVFgM9dyMIj+ye3MD/ptYnA+SuOB1RWJqx7OO5x7etLxirQp2eAs9d58PuANokl14 4rAxIaH8OyGfAtHUNTInNc9njN+0mxy96+AD+5fPn19mjELqn7kNcjD4wmppCqK/Vt4j 8U0Puy752rLqxeVu3WrWUpfjPXe0Q8N9lljLxpgCVL8UAuR6pRg0k18M0fE9diYiICfu r95Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oX/P7lddg3BHOYoajXAuc7IK9XcKnArVL6QchHr+s0s=; b=0MlNieW46oEUE6WWx/C1YrUu7lQoYwx0t3AYPokVZm9ltVwdCP2V8Nlw3fodYWDqiE 56cF2lERxwfZRQF9QQhbqnYDGUi2UTIjdznNq9tgpHVMTcBvPA/lAYzAGZDWSFQMaUgB U6tNilUOx6qp9/9gzxk4yeLPc6Wzt71JPN+2eEj2wzIqtk4Y8H320eWC68oV5f0Rcx4D O42L+1atQr4zNydJVtENq2WovNlyoTGA5r0QAJfZNer9xtd23KbN1FKqxhq7dLTZjG7S bj1bO6P7fsgduIbrPGbjZ5Li7wY8odSHPt8exXF1iyla4xSt7qmJ4RYDbN9sdp7XblWi cd8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jhnVAD6C; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t9si9446331ejd.172.2020.06.08.18.11.34; Mon, 08 Jun 2020 18:11:56 -0700 (PDT) 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=@kernel.org header.s=default header.b=jhnVAD6C; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726969AbgFHXGX (ORCPT + 99 others); Mon, 8 Jun 2020 19:06:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:49054 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726921AbgFHXGR (ORCPT ); Mon, 8 Jun 2020 19:06:17 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2D02F20812; Mon, 8 Jun 2020 23:06:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657577; bh=EKcNGXPVsXSo798RYkf9ibs72j1OBs1xifDbNicZdtQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jhnVAD6CsmlWxXOjH/NTd2dB+dcBM+KF5x478dLyosgMmjGuSHZ/GE6/aSLCOj8Fd raGXBcjYZkN5/7CWHnatcOBrNZ1R753eyeSkr6Z06ycFYx5RArMnYm2GQK7tFny5cu ZXatgC74TS/k4CMyuo9yr9FDje03ZKU6Mqw+TrC0= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Bingbu Cao , Tomasz Figa , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin , linux-media@vger.kernel.org, devel@driverdev.osuosl.org Subject: [PATCH AUTOSEL 5.7 007/274] media: staging: imgu: do not hold spinlock during freeing mmu page table Date: Mon, 8 Jun 2020 19:01:40 -0400 Message-Id: <20200608230607.3361041-7-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bingbu Cao [ Upstream commit e1ebe9f9c88e5a78fcc4670a9063c9b3cd87dda4 ] ImgU need set the mmu page table in memory as uncached, and set back to write-back when free the page table by set_memory_wb(), set_memory_wb() can not do flushing without interrupt, so the spinlock should not be hold during ImgU page alloc and free, the interrupt should be enabled during memory cache flush. This patch release spinlock before freeing pages table. Signed-off-by: Bingbu Cao Reviewed-by: Tomasz Figa Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/staging/media/ipu3/ipu3-mmu.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/ipu3/ipu3-mmu.c b/drivers/staging/media/ipu3/ipu3-mmu.c index 5f3ff964f3e7..cb9bf5fb29a5 100644 --- a/drivers/staging/media/ipu3/ipu3-mmu.c +++ b/drivers/staging/media/ipu3/ipu3-mmu.c @@ -174,8 +174,10 @@ static u32 *imgu_mmu_get_l2pt(struct imgu_mmu *mmu, u32 l1pt_idx) spin_lock_irqsave(&mmu->lock, flags); l2pt = mmu->l2pts[l1pt_idx]; - if (l2pt) - goto done; + if (l2pt) { + spin_unlock_irqrestore(&mmu->lock, flags); + return l2pt; + } spin_unlock_irqrestore(&mmu->lock, flags); @@ -190,8 +192,9 @@ static u32 *imgu_mmu_get_l2pt(struct imgu_mmu *mmu, u32 l1pt_idx) l2pt = mmu->l2pts[l1pt_idx]; if (l2pt) { + spin_unlock_irqrestore(&mmu->lock, flags); imgu_mmu_free_page_table(new_l2pt); - goto done; + return l2pt; } l2pt = new_l2pt; @@ -200,7 +203,6 @@ static u32 *imgu_mmu_get_l2pt(struct imgu_mmu *mmu, u32 l1pt_idx) pteval = IPU3_ADDR2PTE(virt_to_phys(new_l2pt)); mmu->l1pt[l1pt_idx] = pteval; -done: spin_unlock_irqrestore(&mmu->lock, flags); return l2pt; } -- 2.25.1