From patchwork Thu Mar 21 08:33:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10863119 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 25E1C1575 for ; Thu, 21 Mar 2019 08:34:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08EBE2A04A for ; Thu, 21 Mar 2019 08:34:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE69E2A05E; Thu, 21 Mar 2019 08:34:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 599752A04A for ; Thu, 21 Mar 2019 08:33:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 796CA89E1A; Thu, 21 Mar 2019 08:33:58 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from aserp2130.oracle.com (aserp2130.oracle.com [141.146.126.79]) by gabe.freedesktop.org (Postfix) with ESMTPS id E6B1B89E1A for ; Thu, 21 Mar 2019 08:33:56 +0000 (UTC) Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x2L8OS4v111132; Thu, 21 Mar 2019 08:33:49 GMT Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2r8pneyad7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 21 Mar 2019 08:33:49 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x2L8XmDv012787 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 21 Mar 2019 08:33:48 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x2L8Xl7i014771; Thu, 21 Mar 2019 08:33:47 GMT Received: from kadam (/197.157.0.22) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 21 Mar 2019 01:33:46 -0700 Date: Thu, 21 Mar 2019 11:33:35 +0300 From: Dan Carpenter To: Jani Nikula , Chris Wilson Message-ID: <20190321083335.GA31210@kadam> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9201 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903210062 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2018-07-02; bh=ByjaLFa4dRqUf0kOJ8xV2nSBWEXTOF6KDSlc3x7iY18=; b=WsRPIa3pukMmAXmU1mIblRyw8gX9ONt7fcgqmhN5PGzZxiCi7dffQcZNSkAm5XSZ0YJr wOv8ZKSeiMyJrTucKADse9iNGdZySfG2l03q8APHcVIiy9YaFpPN+g9hxHX261gdz6Uq QtR9WjAJiAkWTvNpkpARpKnGNRD83/bsL51I27yTcKT32mZXDcbGwaWepjpNH6u7muYu pgahN7HPjAlm+8c3aCL1NdJIAZr/JuJIU2vlS4T9ch97sKgbLfchXE7X4GZgdcxMhfek wvKxfRA65j7+DeI6RR9ZO1kyyxhZUNhWQZbyjkUzgroCJgs2R4vKm4XQUuwQ1anRKczP wg== Subject: [Intel-gfx] [PATCH] drm/i915/selftests: fix NULL vs IS_ERR() check in mock_context_barrier() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , intel-gfx@lists.freedesktop.org, kernel-janitors@vger.kernel.org, Matthew Auld Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP The mock_context() function returns NULL on error, it doesn't return error pointers. Fixes: 85fddf0b0027 ("drm/i915: Introduce a context barrier callback") Signed-off-by: Dan Carpenter --- .../gpu/drm/i915/selftests/i915_gem_context.c | 4 +- drivers/staging/erofs/unzip_vle.c | 70 ++++++++++--------- 2 files changed, 38 insertions(+), 36 deletions(-) diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/selftests/i915_gem_context.c index 4399ef9ebf15..a172dbd9cb9e 100644 --- a/drivers/gpu/drm/i915/selftests/i915_gem_context.c +++ b/drivers/gpu/drm/i915/selftests/i915_gem_context.c @@ -1620,8 +1620,8 @@ static int mock_context_barrier(void *arg) mutex_lock(&i915->drm.struct_mutex); ctx = mock_context(i915, "mock"); - if (IS_ERR(ctx)) { - err = PTR_ERR(ctx); + if (!ctx) { + err = -ENOMEM; goto unlock; } diff --git a/drivers/staging/erofs/unzip_vle.c b/drivers/staging/erofs/unzip_vle.c index c7b3b21123c1..a711bf61f60c 100644 --- a/drivers/staging/erofs/unzip_vle.c +++ b/drivers/staging/erofs/unzip_vle.c @@ -844,11 +844,9 @@ static void z_erofs_vle_unzip_kickoff(void *ptr, int bios) static inline void z_erofs_vle_read_endio(struct bio *bio) { const blk_status_t err = bio->bi_status; + struct erofs_sb_info *sbi = NULL; unsigned int i; struct bio_vec *bvec; -#ifdef EROFS_FS_HAS_MANAGED_CACHE - struct address_space *mc = NULL; -#endif struct bvec_iter_all iter_all; bio_for_each_segment_all(bvec, bio, i, iter_all) { @@ -858,20 +856,12 @@ static inline void z_erofs_vle_read_endio(struct bio *bio) DBG_BUGON(PageUptodate(page)); DBG_BUGON(!page->mapping); -#ifdef EROFS_FS_HAS_MANAGED_CACHE - if (unlikely(!mc && !z_erofs_is_stagingpage(page))) { - struct inode *const inode = page->mapping->host; - struct super_block *const sb = inode->i_sb; - - mc = MNGD_MAPPING(EROFS_SB(sb)); - } + if (unlikely(!sbi && !z_erofs_is_stagingpage(page))) + sbi = EROFS_SB(page->mapping->host->i_sb); - /* - * If mc has not gotten, it equals NULL, - * however, page->mapping never be NULL if working properly. - */ - cachemngd = (page->mapping == mc); -#endif + /* sbi should already be gotten if the page is managed */ + if (sbi) + cachemngd = erofs_page_is_managed(sbi, page); if (unlikely(err)) SetPageError(page); @@ -972,6 +962,7 @@ static int z_erofs_vle_unzip(struct super_block *sb, overlapped = false; compressed_pages = grp->compressed_pages; + err = 0; for (i = 0; i < clusterpages; ++i) { unsigned int pagenr; @@ -981,26 +972,37 @@ static int z_erofs_vle_unzip(struct super_block *sb, DBG_BUGON(!page); DBG_BUGON(!page->mapping); - if (z_erofs_is_stagingpage(page)) - continue; -#ifdef EROFS_FS_HAS_MANAGED_CACHE - if (page->mapping == MNGD_MAPPING(sbi)) { - DBG_BUGON(!PageUptodate(page)); - continue; - } -#endif + if (!z_erofs_is_stagingpage(page)) { + if (erofs_page_is_managed(sbi, page)) { + if (unlikely(!PageUptodate(page))) + err = -EIO; + continue; + } + + /* + * only if non-head page can be selected + * for inplace decompression + */ + pagenr = z_erofs_onlinepage_index(page); - /* only non-head page could be reused as a compressed page */ - pagenr = z_erofs_onlinepage_index(page); + DBG_BUGON(pagenr >= nr_pages); + DBG_BUGON(pages[pagenr]); + ++sparsemem_pages; + pages[pagenr] = page; - DBG_BUGON(pagenr >= nr_pages); - DBG_BUGON(pages[pagenr]); - ++sparsemem_pages; - pages[pagenr] = page; + overlapped = true; + } - overlapped = true; + /* PG_error needs checking for inplaced and staging pages */ + if (unlikely(PageError(page))) { + DBG_BUGON(PageUptodate(page)); + err = -EIO; + } } + if (unlikely(err)) + goto out; + llen = (nr_pages << PAGE_SHIFT) - work->pageofs; if (z_erofs_vle_workgrp_fmt(grp) == Z_EROFS_VLE_WORKGRP_FMT_PLAIN) { @@ -1044,10 +1046,9 @@ static int z_erofs_vle_unzip(struct super_block *sb, for (i = 0; i < clusterpages; ++i) { page = compressed_pages[i]; -#ifdef EROFS_FS_HAS_MANAGED_CACHE - if (page->mapping == MNGD_MAPPING(sbi)) + if (erofs_page_is_managed(sbi, page)) continue; -#endif + /* recycle all individual staging pages */ (void)z_erofs_gather_if_stagingpage(page_pool, page); @@ -1198,6 +1199,7 @@ pickup_page_for_submission(struct z_erofs_vle_workgroup *grp, if (page->mapping == mc) { WRITE_ONCE(grp->compressed_pages[nr], page); + ClearPageError(page); if (!PagePrivate(page)) { /* * impossible to be !PagePrivate(page) for