Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp862495pxb; Sat, 10 Apr 2021 23:18:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7ArqptbuqwRuLdnOkRye1tpeXU6guM/Uw4mI4TyycJlqEhirYSeDV8Ta8boLzqWiT32aX X-Received: by 2002:a17:907:1692:: with SMTP id hc18mr22170207ejc.265.1618121935997; Sat, 10 Apr 2021 23:18:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618121935; cv=none; d=google.com; s=arc-20160816; b=uN5w/lirkNX4aI3yuiUrExcJ4zViqVWXuSr8NWzo5K2m8/iQBXeXsrPftZnmBURt2U QJKzTap6XPcydRZg9TxuWuIg6hbcoQvOfxCzLKOz7AJRp5SAWGYEkMmiLCzM7lJ+juca A2rg7LcFpC69RKxL5brRrQL0RYFMM8I+1oDgkcgwgHeSw+Aomxi58wkJG5lOs4qxt/M3 tkhQOgPM60/ziP+WsUAA96oxkW51wu4Mvzpe77deJ1YQEZ222Lnl5SAvCnFIegRSexTb 97MPL3557e7SsANtoAiyZAOkZ9oK239iQDYVJI7RoVZqUHdw8DtxrSeQNbRQ4p7mZXza OdwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=UrxciUSxRp+Stj89AXVehqMTlfNzTg7im/aou54mxDU=; b=mNIY5hhuL15vUBIkevI9duSKv/wekfvoq0czxdZ7i622FG21DdtTvxiy4AO2gSYymA qon07bUxAdAOWouxX4kZyhZOYgW7TKyrVE2zdmUhnW7t2lhYL8djJQChupHF7uXn0Dug 33+76MXmTPk5kZ2hzZKleEzPywwa5lBJXPN3SLmwuQZUJT5WVALbXht9IomcfGjRGN/f 6iOvLYZElplsVj58jy3NsnLXUueJdcZysIRzMiX6BfTR4/uiHBsU35G5WAabMkMmINMG glYvP11KllTFisivMt3yd1dsWe37u8sksl3K/UUlIGWLEX8EC/Fgt2PA7pIWj8d+o8Bh Frcg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a1si5409686eds.169.2021.04.10.23.18.19; Sat, 10 Apr 2021 23:18:55 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232618AbhDKGRW (ORCPT + 99 others); Sun, 11 Apr 2021 02:17:22 -0400 Received: from mx3.molgen.mpg.de ([141.14.17.11]:48001 "EHLO mx1.molgen.mpg.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229792AbhDKGRV (ORCPT ); Sun, 11 Apr 2021 02:17:21 -0400 Received: from [192.168.178.35] (unknown [94.134.88.216]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: pmenzel) by mx.molgen.mpg.de (Postfix) with ESMTPSA id ED738206473C5; Sun, 11 Apr 2021 08:17:02 +0200 (CEST) Subject: Re: [PATCH] iommu/amd: Fix extended features logging To: Alexander Monakov Cc: Joerg Roedel , Suravee Suthikulpanit , iommu@lists.linux-foundation.org, LKML References: <20210410211152.1938-1-amonakov@ispras.ru> From: Paul Menzel Message-ID: Date: Sun, 11 Apr 2021 08:17:02 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <20210410211152.1938-1-amonakov@ispras.ru> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dear Alexander, Am 10.04.21 um 23:11 schrieb Alexander Monakov: > print_iommu_info prints the EFR register and then the decoded list of > features on a separate line: > > pci 0000:00:00.2: AMD-Vi: Extended features (0x206d73ef22254ade): > PPR X2APIC NX GT IA GA PC GA_vAPIC > > The second line is emitted via 'pr_cont', which causes it to have a > different ('warn') loglevel compared to the previous line ('info'). > > Commit 9a295ff0ffc9 attempted to rectify this by removing the newline > from the pci_info format string, but this doesn't work, as pci_info > calls implicitly append a newline anyway. Hmm, did I really screw that up during my testing? I am sorry about that. I tried to wrap my head around, where the newline is implicitly appended, and only found the definitions below. include/linux/pci.h:#define pci_info(pdev, fmt, arg...) dev_info(&(pdev)->dev, fmt, ##arg) include/linux/dev_printk.h:#define dev_info(dev, fmt, ...) \ include/linux/dev_printk.h: _dev_info(dev, dev_fmt(fmt), ##__VA_ARGS__) include/linux/dev_printk.h:__printf(2, 3) __cold include/linux/dev_printk.h:void _dev_info(const struct device *dev, const char *fmt, ...); include/linux/compiler_attributes.h:#define __printf(a, b) __attribute__((__format__(printf, a, b))) > Restore the newline, and call pr_info with empty format string to set > the loglevel for subsequent pr_cont calls. The same solution is used in > EFI and uvesafb drivers. Thank you for fixing this. > Fixes: 9a295ff0ffc9 ("iommu/amd: Print extended features in one line to fix divergent log levels") > Signed-off-by: Alexander Monakov > Cc: Paul Menzel > Cc: Joerg Roedel > Cc: Suravee Suthikulpanit > Cc: iommu@lists.linux-foundation.org > --- > drivers/iommu/amd/init.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c > index 596d0c413473..a25e241eff1c 100644 > --- a/drivers/iommu/amd/init.c > +++ b/drivers/iommu/amd/init.c > @@ -1929,8 +1929,11 @@ static void print_iommu_info(void) > pci_info(pdev, "Found IOMMU cap 0x%hx\n", iommu->cap_ptr); > > if (iommu->cap & (1 << IOMMU_CAP_EFR)) { > - pci_info(pdev, "Extended features (%#llx):", > + pci_info(pdev, "Extended features (%#llx):\n", > iommu->features); > + > + pr_info(""); > + > for (i = 0; i < ARRAY_SIZE(feat_str); ++i) { > if (iommu_feature(iommu, (1ULL << i))) > pr_cont(" %s", feat_str[i]); > In the discussion *smpboot: CPU numbers printed as warning* [1] John wrote: > It is supported to provide loglevels for CONT messages. The loglevel is > then only used if the append fails: > > pr_cont(KERN_INFO "message part"); > > I don't know if we want to go down that path. But it is supported. Kind regards, Paul [1]: https://lkml.org/lkml/2021/2/16/191