Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4603008imm; Mon, 18 Jun 2018 18:51:02 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI+d8ehi1rZ1wUoVNGPJZBnYKgfRE/7Do3/BnHkACp62fcQkQcKTkvB/d0fJHkUfb8Pz65t X-Received: by 2002:a65:5ac9:: with SMTP id d9-v6mr13002606pgt.238.1529373062719; Mon, 18 Jun 2018 18:51:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529373062; cv=none; d=google.com; s=arc-20160816; b=IA92A7hUv7kGcaIp2YYBgAyJY41y/9XdqFTIyU00pGW8WGdpxC08ZaVF0CYYCggta4 o35einG8BhiVQvMoqxrvGkfukB8Hhxfo1bsxPa1RHx/xBDQRFV1ULugHvgptuUVZbg/y Wmn3p4Y0LavB+6ncfjIq858Gi+6SVgEUZj20D6VWYfqPXvH0cfhA2aAOAuXD2STiekq/ EQhxFgHDq5pFx1nxbwbBOnKefJualEFjviXs0wNWPIae/kDidnGo5noT+/uX2IT0txQ6 z3lo4dSdzGfGsxCXiau6ykKGTAFeLYzbCbTMRmkGYraqmtD548biqrU2ciNV5XRcLtab eUOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=0ibjPmdK67/VJOvCzG+NsNGMvU2IPKZSLnyxb4dVOAo=; b=KlYga16zv21t5oNdb/liYXD8+b78SlhOuUoVOpSKz3MZ5r/6h9+Ll9qhAYZP8AHLdL t7civ6suFr1tZCLNenWgRp7dbmW4sE5e97BtgF/8nQHi+YxUr+Gpaxsi+UCjii4f+s+w Z0LOfpUmop1Tg7xKQo9gtzLEN5ONaT0dxgXcew3TeEL+BViE63se+JxICAH/smw/rNdJ MMiYFM4y8I2AGbWqapp9wKgVyENxN/gY6pq9d++yL8wy/Ew8TjqY3KQyIi5DtYGqHSSi TgJCQY9Aah8wiBwViglk5hYRV78YnRIwTtbQ7QwVYfKAsYK5PAASyVdov5/Wzg5e6KDe 6dFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R4Q1P6f9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m62-v6si16619131pfa.45.2018.06.18.18.50.48; Mon, 18 Jun 2018 18:51:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R4Q1P6f9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937057AbeFSBuM (ORCPT + 99 others); Mon, 18 Jun 2018 21:50:12 -0400 Received: from mail-qk0-f194.google.com ([209.85.220.194]:40847 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934880AbeFSBuK (ORCPT ); Mon, 18 Jun 2018 21:50:10 -0400 Received: by mail-qk0-f194.google.com with SMTP id r66-v6so10550498qkr.7 for ; Mon, 18 Jun 2018 18:50:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=0ibjPmdK67/VJOvCzG+NsNGMvU2IPKZSLnyxb4dVOAo=; b=R4Q1P6f9BjQA318v5ryW5hT363XbOdeS6SUxIyi/tkIFBVdlUXcSdGro43Q7Ouja0Y sw4i8cZ271NQObV0x/XcxZqYFj2oEOzjXTibKmb4Zd6s1zywGgQzzJY6vgSJuVSkA9pL SdC3L75qEMr1AguWiqZrHc3OIVROhdK859tpo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=0ibjPmdK67/VJOvCzG+NsNGMvU2IPKZSLnyxb4dVOAo=; b=Z3mjBLbpdIE6BEWK94NjwCxw7aaAdLm/4XOEjxkbKgQRG1V5oqejZAbCyjJbP77+Bh px/5sTQXSE27XQSwR/T3KcBupuQYWwUpkGm/Ifal5mCC3u6VjTW2VrY0E5T7idPFmeh+ Nn1h5cO+nM+anK46RbReVgefX9z4J1sfFwybl4/So17m3G14Vgzn7ZpVSsTn2RYP9TGg J+MLjjpf75GGOO6+IMiXPf7ycm73pDbsnIs7QRKDV912ICDG48VcCOTqDFGRCkPy6muI pG/Xn4d5N6LEiUFRP0nA/qXqzYsPuzvmm4UdRls4deMeiHoNmIVn7S4XKgX0CZZ9tuxa 13NQ== X-Gm-Message-State: APt69E2+ysC7CWv+Aw0c5aUc5qbDRtKqfE/iWy/PlSymXVgn3PLLXcIK 1hrzRi1jw+PEjiXl9AhZFHQciQ== X-Received: by 2002:a37:2e46:: with SMTP id u67-v6mr11713489qkh.106.1529373010310; Mon, 18 Jun 2018 18:50:10 -0700 (PDT) Received: from xanadu.home (modemcable228.104-82-70.mc.videotron.ca. [70.82.104.228]) by smtp.gmail.com with ESMTPSA id k129-v6sm9764134qkd.13.2018.06.18.18.50.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 18:50:09 -0700 (PDT) Date: Mon, 18 Jun 2018 21:50:08 -0400 (EDT) From: Nicolas Pitre To: Andy Shevchenko cc: Greg Kroah-Hartman , Dave Mielke , Samuel Thibault , Linux Kernel Mailing List Subject: Re: [PATCH v2 4/4] vt: coherence validation code for the unicode screen buffer In-Reply-To: Message-ID: References: <20180617190706.14614-1-nicolas.pitre@linaro.org> <20180617190706.14614-5-nicolas.pitre@linaro.org> User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 19 Jun 2018, Andy Shevchenko wrote: > On Sun, Jun 17, 2018 at 10:07 PM, Nicolas Pitre > wrote: > > Make sure the unicode screen buffer matches the video screen content. > > This is provided for debugging convenience and disabled by default. > > > +#define VC_UNI_SCREEN_DEBUG 0 > > > + if (!VC_UNI_SCREEN_DEBUG || !uniscr) > > + return; > > Hmm... Interesting. I would rather go with > #ifdef ..._DEBUG > ... > #else > return; > #endif > > It will relax requirement on how to define _DEBUG. I don't recall I > see something like you proposing in the kernel for the same purpose. Some random examples: include/crypto/scatterwalk.h:106; if (ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE && !PageSlab(page)) include/math-emu/single.h:68: if (!FP_INHIBIT_RESULTS) This form also allows for the compiler to parse and validate the code whether or not the feature is enabled, while still optimizing it away in the end if not enabled. > > + > > + WARN_CONSOLE_UNLOCKED(); > > + > > + /* > > + * Make sure our unicode screen translates into the same glyphs > > + * as the actual screen. This is brutal indeed. > > + */ > > + p = (unsigned short *)vc->vc_origin; > > + mask = vc->vc_hi_font_mask | 0xff; > > + for (y = 0; y < vc->vc_rows; y++) { > > + char32_t *line = uniscr->lines[y]; > > + for (x = 0; x < vc->vc_cols; x++) { > > + u16 glyph = scr_readw(p++) & mask; > > + char32_t uc = line[x]; > > + int tc = conv_uni_to_pc(vc, uc); > > + if (tc == -4) > > + tc = conv_uni_to_pc(vc, 0xfffd); > > + if (tc == -4) > > + tc = conv_uni_to_pc(vc, '?'); > > + if (tc != glyph) > > > + pr_notice("%s: mismatch at %d,%d: " > > + "glyph=%#x tc=%#x\n", __func__, > > + x, y, glyph, tc); > > Don't split format string in printk(). checkpatch will not warn on longer lines. I didn't do it like that for checkpatch but to keep the code readable. I don't particularly care either ways though. Nicolas