Received: by 10.223.164.221 with SMTP id h29csp3059798wrb; Wed, 18 Oct 2017 11:25:09 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDMKOOfdWSFH8YwrAOy6goCGk+aAMHSN5f1VnFDiy1L+JItCiVEPhU6BL1UxjAL8arf+rHH X-Received: by 10.99.117.13 with SMTP id q13mr14300014pgc.366.1508351109703; Wed, 18 Oct 2017 11:25:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508351109; cv=none; d=google.com; s=arc-20160816; b=DFBaU3yFdAtEciIevtvllWD3odApXKrMSVrl4knZ0NTepxTgLqlOogsfZcARLb1Huk /kJAaIp+Er9GqsmHdjk0QUa9WnlbWiWcilDtNNUX6DQKYMocHk//kx4G94//UPJT+9sU Do4+fcp4ENtAB96gi1xuqUvtcv7GDah6OnSRGzOKdwfBiPlXyjgARKemDXlXenl7HTcS jHh2px2OztVvI8G+u9rId2JTIQkgncGFU+AELNWUFsVLMnZk7c2vw1FC81CDgj0xUZ2O KWJUOkbKM5FBfzGS0+5j4VG2Glwc57l25QD0pLI+ZV7dG7dFFBWd1KYTWZUavcppRTkM bbjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:dmarc-filter:dkim-signature :dkim-signature:arc-authentication-results; bh=APdN7pIJEQVHKtnlh3aN6B13NyKmRUgQPdnpMA9TR5Q=; b=vGcqfXYu182ibVzwWy/9SyDW+Z/NhlNNYelKtFL6mLWCxwW3eqlosMpzOeVexz4Nzb 0Y53m3fOS2xOSQAvBZCFIsTQuMEvzhXs3NJpwM8rmGWDjp1Hs3YKf0Kkwtn4ikMlpMIU OomSvDh9hPWTUN/v2tjMWQi2/tzZSm5U86Lv4M5LkS7mTAG19yeegokTirceh+zdB+wD x4hLhKobIsIPwet2sGAWHV3gkkj041e//6jYqv45jUUdI93CCw4lW8ohlO1ptCxsqdqQ jUNGpG0l4BUy2H6NGC1EarWx8jZ4yVtmyJeBD5h0MGE2b1g+78A9hxVngj/LTi7Usg3+ k9eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=owZ5QvSL; dkim=pass header.i=@codeaurora.org header.s=default header.b=owZ5QvSL; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f18si7263119pge.357.2017.10.18.11.24.55; Wed, 18 Oct 2017 11:25:09 -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=@codeaurora.org header.s=default header.b=owZ5QvSL; dkim=pass header.i=@codeaurora.org header.s=default header.b=owZ5QvSL; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751462AbdJRSYD (ORCPT + 99 others); Wed, 18 Oct 2017 14:24:03 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:52206 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751038AbdJRSYB (ORCPT ); Wed, 18 Oct 2017 14:24:01 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id C961F600D0; Wed, 18 Oct 2017 18:24:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1508351040; bh=F1m8hdyJk++R7QlJKHMl0H5TmvTBlXOOGZW6tgUluVA=; h=Subject:To:References:From:Date:In-Reply-To:From; b=owZ5QvSLe2YjNd2/W6cxAkrPSlRg1eoFEOYnv4Au7d/iGCG22nADQ6UmYUAvZ+q82 faxd+xeqS+5G5mjGpG9Y7z00XEwRQ8cUosr2hzuBBhvL0iITiVbEI+jbnnPn63/N2u isSIFW0lSljzIkYRU6Sl5nGYkactb1alI32a1zDA= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [10.235.228.144] (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tbaicar@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id AC6BA600D0; Wed, 18 Oct 2017 18:23:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1508351040; bh=F1m8hdyJk++R7QlJKHMl0H5TmvTBlXOOGZW6tgUluVA=; h=Subject:To:References:From:Date:In-Reply-To:From; b=owZ5QvSLe2YjNd2/W6cxAkrPSlRg1eoFEOYnv4Au7d/iGCG22nADQ6UmYUAvZ+q82 faxd+xeqS+5G5mjGpG9Y7z00XEwRQ8cUosr2hzuBBhvL0iITiVbEI+jbnnPn63/N2u isSIFW0lSljzIkYRU6Sl5nGYkactb1alI32a1zDA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org AC6BA600D0 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=tbaicar@codeaurora.org Subject: Re: [PATCH] PCI/AER: update AER status string print to match other AER logs To: David Laight , "bhelgaas@google.com" , "helgaas@kernel.org" , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <1508254922-30925-1-git-send-email-tbaicar@codeaurora.org> <063D6719AE5E284EB5DD2968C1650D6DD0099999@AcuExch.aculab.com> <063D6719AE5E284EB5DD2968C1650D6DD009A8FD@AcuExch.aculab.com> From: Tyler Baicar Message-ID: Date: Wed, 18 Oct 2017 14:23:58 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6DD009A8FD@AcuExch.aculab.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/18/2017 6:14 AM, David Laight wrote: > From: Tyler Baicar [mailto:tbaicar@codeaurora.org] >> Sent: 17 October 2017 18:14 >> On 10/17/2017 12:00 PM, David Laight wrote: >>> From: Tyler Baicar >>>> Sent: 17 October 2017 16:42 >>>> Currently the AER driver uses cper_print_bits() to print the AER status >>>> string. This causes the status string to not include the proper PCI device >>>> name prefix that the other AER prints include. Also, it has a different >>>> print level than all the other AER prints. >>>> >>>> Update the AER driver to print the AER status string with the proper string >>>> prefix and proper print level. >>>> >>>> Previous log example: >>>> >>>> e1000e 0003:01:00.1: aer_status: 0x00000041, aer_mask: 0x00000000 >>>> Receiver Error, Bad TLP >>> ... >>>> New log: >>>> >>>> e1000e 0003:01:00.1: aer_status: 0x00000041, aer_mask: 0x00000000 >>>> e1000e 0003:01:00.1: Receiver Error >>>> e1000e 0003:01:00.1: Bad TLP >>> Wouldn't it be better to manage to print the above all on 1 line? > >> I broke them up into separate lines to simplify the code. If you look at >> cper_print_bits(), >> it is not a clean solution and involves some hard coded values to try to limit >> the lines to 80 characters. > I'm not sure the 80 char limit is needed. > > > How about: > #define MAX_STR 32 > void pr_bits(unsigned int val, const char *strs[], unsigned int num_str) > { > const char *str[MAX_STR] = {}; > unsigned int i, num; > > if (num_str > MAX_STR) > num_str = MAX_STR; > for (i = 0, num = 0; i < num_str; i++) { > if (!(val & (1 << i))) > continue; > str[num++] = strs[i]; > } > printf(" %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s\n" + (MAX_STR - num) * 3, > str[0], str[1], str[2], str[3], > str[4], str[5], str[6], str[7], > str[8], str[9], str[10], str[11], > str[12], str[13], str[14], str[15], > str[16], str[17], str[18], str[19], > str[20], str[21], str[22], str[23], > str[24], str[25], str[26], str[27], > str[28], str[29], str[30], str[31]); > } > > For kernel use you'd probably want to pass in 'dev' and a printf list > and use %pV to put the fixed text on the front of the line. > > All rather begging for a new %p? feature that is passed the value, strings > and separator. Hi David, This seems like a bad approach. This can make the print in the kernel logs and the code both look pretty awful. I would prefer to have each error that occurred have it's own print line in the logs rather than introduce this code for the sole purpose of keeping the list on a single print line. I don't see any real downside to having a few additional print lines in error scenarios. Thanks, Tyler -- Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project. From 1581608515871925178@xxx Wed Oct 18 15:10:20 +0000 2017 X-GM-THRID: 1581559573280236686 X-Gmail-Labels: Inbox,Category Forums