From owner-freebsd-arch@FreeBSD.ORG Sun Dec 4 16:49:09 2011 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 217F0106564A; Sun, 4 Dec 2011 16:49:09 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-pz0-f54.google.com (mail-pz0-f54.google.com [209.85.210.54]) by mx1.freebsd.org (Postfix) with ESMTP id DF9568FC08; Sun, 4 Dec 2011 16:49:08 +0000 (UTC) Received: by dakp5 with SMTP id p5so216616dak.13 for ; Sun, 04 Dec 2011 08:49:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=suMCRAN9R1H+1Q4FHASw4vitAsCqHEJEksr53wZexkQ=; b=nS3b8LZqHoy1kjfzZZCnwHIMRPlTSMfNB727rsjSC5qilAgq9Or20o0NBusszptAy6 czlWAClVy1QRLBVviCtNuPysjv4j6WsPUps4bwYcAzkN+GIAPRnja3SB4KfIZGCafJaI IQoHeWssoerB3DCMYPHQ7BoMT83tEdFN+ebf4= MIME-Version: 1.0 Received: by 10.68.31.200 with SMTP id c8mr15571921pbi.8.1323017348256; Sun, 04 Dec 2011 08:49:08 -0800 (PST) Sender: mdf356@gmail.com Received: by 10.68.56.97 with HTTP; Sun, 4 Dec 2011 08:49:08 -0800 (PST) In-Reply-To: <201111301032.04102.jhb@freebsd.org> References: <20111130154604.B949@besplex.bde.org> <201111301032.04102.jhb@freebsd.org> Date: Sun, 4 Dec 2011 08:49:08 -0800 X-Google-Sender-Auth: 1W6EExx4SoHz_5AXc8BlcPMmvc0 Message-ID: From: mdf@FreeBSD.org To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Zack Kirsch , freebsd-arch@freebsd.org Subject: Re: Use of bool / stdbool.h in kernel X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 16:49:09 -0000 On Wed, Nov 30, 2011 at 7:32 AM, John Baldwin wrote: > On Wednesday, November 30, 2011 12:13:53 am Bruce Evans wrote: >> On Tue, 29 Nov 2011 mdf@freebsd.org wrote: >> >> > At $WORK we have a hack in one of the *.mk files to allow including >> > stdbool.h in the kernel and we use it extensively. =A0This is not >> > allowed by style(9), as far as I can tell, because the file is in >> > include/stdbool.h and those files are not allowed to be included in >> > kernel sources. >> >> Including stdbool.h in the kernel is not a style bug, but unsupported. >> >> > What I want to check on is, would it be acceptable to move stdbool.h >> > from include/stdbool.h to sys/sys/stdbool.h (i.e. like errno.h) and >> > then include it in the kernel as ? =A0That is, is the >> >> Would be a larger style bug, especially if it were actually used. >> Even its spellings of TRUE and FALSE are strange. =A0Even in userland >> stdbool.h is considered so useful that it is never used in src/bin >> and is only used a few times on other src/*bin. =A0src/bin never uses >> TRUE of FALSE either. > > I suspect there is some bias here though due to the fact that there wasn'= t > a standard bool type when most of this code was written. :) =A0I don't th= ink > that means we have to forgo use of the new type now that it is in fact > standardized in C99. =A0I would be happy to have 'bool' available and the > lowercase 'true' and 'false' are fine with me. In further thinking, there's also a style issue of nested headers. FreeBSD expects most types defined in sys/types.h so that it can be included first and other files alphabetically. Using would require any header with a bool parameter, return code, or struct member to include . Alternatively, I could instead put the same guards as stdbool.h uses and define bool, true, and false in sys/types.h, but only for _KERNEL use (however, this also would create issues with any file that is built in both user-space and kernel, and unconditionally defining in sys/types.h could break existing buggy applications). *sigh*, part of the problem is the buggy way in which C99 added the bool type. I suppose code could always use the real reserved keyword _Bool in headers, ugly though it is, and bool in implementation files. I had a brief look, and for comparison Linux has the typedef in linux/include/types.h IIRC but does not guard the definition nor did it define true/false. Thanks, matthew From owner-freebsd-arch@FreeBSD.ORG Sun Dec 4 16:52:19 2011 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E81A91065676; Sun, 4 Dec 2011 16:52:18 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-pz0-f54.google.com (mail-pz0-f54.google.com [209.85.210.54]) by mx1.freebsd.org (Postfix) with ESMTP id AAAB48FC14; Sun, 4 Dec 2011 16:52:18 +0000 (UTC) Received: by dakp5 with SMTP id p5so219162dak.13 for ; Sun, 04 Dec 2011 08:52:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; bh=gizAJgN8WyZ4GhY3bC2CxlsuhleFHt0/P13ea+5+RY8=; b=Gq834IQid1fYWk7/+yDAvM/g/VOwB83RZxq6u3ZnuAmQIdntsEIB6X9EpTTAx2k4VX PAw2b2GN4ge8TFYbCHgM+UUb5bFbMmwzPG3LLfjwGVrKm/2cWJAACpbStN3POQphYK/d /cMCgvMcYLwcjgvj0389TejaPF1jjg9FA0+nI= MIME-Version: 1.0 Received: by 10.68.22.69 with SMTP id b5mr15246855pbf.110.1323017538406; Sun, 04 Dec 2011 08:52:18 -0800 (PST) Sender: mdf356@gmail.com Received: by 10.68.56.97 with HTTP; Sun, 4 Dec 2011 08:52:18 -0800 (PST) In-Reply-To: <20111201014944.GA78010@zim.MIT.EDU> References: <20111130154604.B949@besplex.bde.org> <201111301032.04102.jhb@freebsd.org> <20111201014944.GA78010@zim.MIT.EDU> Date: Sun, 4 Dec 2011 08:52:18 -0800 X-Google-Sender-Auth: 5BLsyFHDWN30ST90W4kszPjFZ0U Message-ID: From: mdf@FreeBSD.org To: John Baldwin , freebsd-arch@freebsd.org, Zack Kirsch , mdf@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Subject: Re: Use of bool / stdbool.h in kernel X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 16:52:19 -0000 On Wed, Nov 30, 2011 at 5:49 PM, David Schultz wrote: > On Wed, Nov 30, 2011, John Baldwin wrote: >> On Wednesday, November 30, 2011 12:13:53 am Bruce Evans wrote: >> > On Tue, 29 Nov 2011 mdf@freebsd.org wrote: >> > >> > > At $WORK we have a hack in one of the *.mk files to allow including >> > > stdbool.h in the kernel and we use it extensively. =A0This is not >> > > allowed by style(9), as far as I can tell, because the file is in >> > > include/stdbool.h and those files are not allowed to be included in >> > > kernel sources. >> > >> > Including stdbool.h in the kernel is not a style bug, but unsupported. >> > >> > > What I want to check on is, would it be acceptable to move stdbool.h >> > > from include/stdbool.h to sys/sys/stdbool.h (i.e. like errno.h) and >> > > then include it in the kernel as ? =A0That is, is the >> > >> > Would be a larger style bug, especially if it were actually used. >> > Even its spellings of TRUE and FALSE are strange. =A0Even in userland >> > stdbool.h is considered so useful that it is never used in src/bin >> > and is only used a few times on other src/*bin. =A0src/bin never uses >> > TRUE of FALSE either. >> >> I suspect there is some bias here though due to the fact that there wasn= 't >> a standard bool type when most of this code was written. :) =A0I don't t= hink >> that means we have to forgo use of the new type now that it is in fact >> standardized in C99. =A0I would be happy to have 'bool' available and th= e >> lowercase 'true' and 'false' are fine with me. > > The lowercase 'true' and 'false' are intended to mimic C++, where > they are keywords. =A0Regardless of how you prefer to capitalize > them, using them instead of 0 and 1 makes the intent much clearer. > This is especially true in the kernel, where non-zero could mean > true, or it could be an error code. > > Unfortunately, the "new type" is mostly useless, aside from > improving readability. =A0Unlike modern languages, C doesn't > consider it a compile-time error to mix up bools and ints. Partly true. In addition to changing the semantics of the ++ and -- operators, _Bool is usually implemented as an 8-bit type and so pointers-to-bool and pointers-to-int are not compatible. Also, C (or at least gcc? I don't know my C99 standard the way I know C89) will apply default promotion and casting rules, so that e.g. an assignment like: int a; bool b; a =3D 2; b =3D a; printf("%d", b); will print 1. Thanks, matthew From owner-freebsd-arch@FreeBSD.ORG Mon Dec 5 12:57:12 2011 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD7F5106564A for ; Mon, 5 Dec 2011 12:57:12 +0000 (UTC) (envelope-from "") Received: from remailer.privacy.at (remailer.privacy.at [212.124.141.99]) by mx1.freebsd.org (Postfix) with ESMTP id 3C7A78FC08 for ; Mon, 5 Dec 2011 12:57:12 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by remailer.privacy.at (Postfix) with ESMTP id 168CC7F69F for ; Mon, 5 Dec 2011 13:12:05 +0100 (CET) From: "Anonymous Remailer (austria)" Comments: This message did not originate from the Sender address above. It was remailed automatically by anonymizing remailer software. Please report problems or inappropriate use to the remailer administrator at . To: freebsd-arch@freebsd.org Message-ID: <57e8899c2df8166f9c975b371886f0d5@remailer.privacy.at> Date: Mon, 5 Dec 2011 13:12:05 +0100 (CET) Subject: Invitation X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 12:57:12 -0000 You are invited to contribute to create a better society. http://www.youtube.com/watch?v=tukt3se9cz4 http://www.youtube.com/watch?v=ZPWH5TlbloU   Let’s change this system that deprive us from all resources, products and services we need to live, and creates money as a barrier in a linear centralized pyramid structure. http://www.youtube.com/watch?v=cpdpMjG5CmY All money is created through debit. The FED print money out of the thin air and loan to the Government and Banks. The Government tax US through IRS to pay the FED. The Banks charge US interest from money create out of the thin air. Also the Private Banks create money out of the thin air by loan and bookkeeping. When people are in debit they submit to work. So debit is slavery. Who creates the money? Private Banks are the owners of the FED that creates money out of the thin air by just printing it. But, private Banks also create money through loans by bookkeeping. And, all money in circulation needs to be repaid to Banks with interest. So there is more debit than money. So, this monetarism economy is a Ponzi scheme. The bankruptcy is inevitable since the debit is higher than the money created/ in circulation. Everything that is produced and exists is traded with money. But money is debit. So we exchange everything we produce and everything we own to debit that must be repaid w ith interest. Even government needs money to work. But the money is created by FED and Private Banks out of the thin air. So, in this monetarism society, everything, even Government’s Policy will be always dictated by Private Banks – the creators of money. In a monetarism economy money replaces everything is produced, but money is only accessible to Government and to the 99% of US through debt and it is created by the top of the pyramid society out of the thin air. In this way, while we let the 1% creates money out of the thin air, and the 99% access money only through debt, while we let this system unchecked we will remain slaves. The true sources of wealth are We The People. Without US money and any other asset has no value. http://www.youtube.com/watch?v=xq3BYw4xjxE Everyday our society give away all its wealth to the money creators at the moment we accept money to trade everything we produce (we trade all we produce by money=debt). The 1% can not slave the 99% unless the 99% are sleeping and taking for granted the structures the 1% created to slave US. We are the true source of wealth, not gold, silver, diamond money or any other thing. The current process of money creation relies on a centralized pyramid structure build to slave US. http://www.youtube.com/watch?v=cPZI74Nk-J8 http://www.youtube.com/watch?v=wK1MOMKZ8BI http://www.youtube.com/watch?v=Ay3NFd9DknU While private Banks keep creating money out of thin air through loans, they will remain in power. While we let the pyramid structures of our society unchecked, the 1% will keep stealing the wealth from US. In Tahrir moment, Egypt did not change the pyramid structures in their society. They only let the Army occupy the empty spaces on the pyramid structures of their society. They should have changed how their society is organized into direct democracy, social network production of goods and services, education through web… and reshape their society from centralized pyramid structures to decentralized social network structures in sphere format. http://www.youtube.com/watch?v=Ovs0fpFgeqw   It was cooperation that allowed life in this Universe. You are invited to look how Nature works and how this Universe works to create the open source tools for humanity to change all the rules we currently take for granted in our industrial age economy and complete our shift into completely different information age dynamics. We have an anthropocentric notion of intelligence. Consider, for a moment, the cells in our body. They communicate, collaborate, share scarce resources, work together to build, maintain and manage extremely complex systems, and each one carries a copy of the agreements (DNA) that they use to cooperate. Cells do all those things better than we do, yet we don't recognize that as intelligence. But what would happen if humanity had a breakthrough in our capacities to do these kinds things together because of the advent of new kinds of "Social DNA?" Social DNA which enables rapid self-organization, organizational adaptation, resource allocation, communication , decision-making and new patterns of collective governance... What if these breakthroughs free US from the inefficiencies of bureaucracy, the inequities of centralized financial instruments and computing architectures, and the ineffectiveness of representational hierarchies? http://www.youtube.com/watch?v=QADMMmU6ab8 http://www.youtube.com/watch?v=hOLAGYmUQV0 http://www.youtube.com/watch?v=DZGINaRUEkU You are invited to build tools to improve direct democracy and several new open platforms to implement abundant production of goods and services, connecting people, knowledge, matter and energy with people’s necessity to change matter into what it is required to provide everything our society needs to live in profusion.   Money is only the blood of this system that has a body in pyramid shape. The 99% creates products, services, distribute water, energy, food and all we need to live, but we traded all that with money created out of the thin air by the 1% in a centralized pyramid way. The 1% also creates money out of the thin air through loans and they influence and dictate all sorts of politics. They deprived us from everything we need to live by creating barriers (law, knowledge access, false scarcity, planned obsolescence, putting us in endless debt). You are invited to bring the pyramid down. You are invited to rebuild our society: since the production of goods, services, energy, matter and direct democracy to all sort of human relationship. You are invited to be part of the change of this pyramid society into a sphere society. http://www.youtube.com/watch?v=R8ODHwaqrWY   To tax Banks with the Robin Hood Tax transaction will turn it into an operation cost absorbed into their current cost, but it will not solve the problem that is the money creation (only private Banks and FED creates money out of the thin air) and the pyramid structures in our society made to concentrate wealth and slave people. You are invited to rethink everything. Let’s everybody create its own money backed by its own labor, bring the pyramid down and reshape our society into a several local decentralized open source network self-sustainable sphere structures. http://www.youtube.com/watch?v=JAWLHA8-07c   http://www.youtube.com/watch?v=qb0GsKFbAIw   http://www.youtube.com/watch?v=N7ws7H00qIs   Let`s bring the pyramid down. The pyramid structure has slaved our society for long time. The goal of any pyramid structure is wealth concentration through scarcity, access denial, exploitation and so on…   http://www.pbs.org/newshour/bb/social_issues/jan-june11/incarceration_04-07.html   http://www.aclu.org/blog/national-security/senators-demand-military-lock-american-citizens-battlefield-they-define-being   http://www.youtube.com/watch?v=couq2HkAdDU   We do not fix a thing that will bring US to the same place in the future. Einstein once said: “Insanity is doing the same thing over and over again but expecting different results.” You are invited to suggest a better society in sphere format that mimics life and nature. You are invited to create an open source decentralized system that can connect matter with people’s need, empowerment knowledge, energy and let each person ask what they need and help local communities to organize themselves to provide each necessity. All in a new sphere system. http://en.wikipedia.org/wiki/Social_network http://www.ted.com/talks/tim_berners_lee_on_the_next_web.html   Figure it out: when a child blows a soap bubble, why it takes the shape of a sphere and not the shape of a pyramid? The sphere is the most popular form in this Universe. So why did we accept the pyramid format in all human structures: social, religion, work, government? As long as the pyramid structures in our society persist, the 1% will keep slaving the 99%. http://en.wikipedia.org/wiki/File:Girl_blowing_bubbles.jpg   Our goal is far larger than occupy money. You are invited to recreate all sort of human structures in this world from a pyramid structure to a sphere structure.  No person, corporation or any other thing should be on top of other human being. We believe cooperation is stronger than competition.     Even if gold was manufactured in a nuclear reactor at low cost as long as it could be a byproduct in a reactor running to provide electricity – even if that occurs it will not solve the problem of money creation and the centralized pyramid structures that keep scarcity and deprive US from true evolution. http://en.wikipedia.org/wiki/Synthesis_of_precious_metals   Even if we nationalize The Federal Reserve it not solves the problem. Even if we end the FED but let private banks creating money through loan out of the thin air we will see the same problem again and again. http://occupymoney.org/ See Europe has nationalized its central banks but private banks continue creating money through loans.  The owners and shareholders of the European Central Bank are the 27 member states of the EU. http://en.wikipedia.org/wiki/European_Central_Bank   See England that has no limit to create money through loans.   The pyramid structure was created to slave people only. http://www.ted.com/talks/yochai_benkler_on_the_new_open_source_economics.html   You are invited to contribute to create a new social infrastructure decentralized, sustainable and Open Source to Occupy Movement. It should be collaborative to connect people with energy and knowledge to change matter to solve each people‘s need. It should be easy to replicate and adaptable to help create communities all across USA that could receive members from all world through the use of these platforms that annihilate time and space. It should be open source in format of sphere, work independently in cycles and not linear centralized pyramids. This new organization format should aim open competition of ideas and collaboration of people to spread the best practices of work, production… and create a better world.   Money is only an idea backed by confidence, backed by US. Without US money or any other asset has no value. It is time to each person create its own money backed by our own work, in decentralized way. There are people unemployed, there is knowledge available, energy, needs and matter. Let`s reorganize USA into a sphere society.   We aim an Open Source Society that changes the competition of people into competition of ideas and collaboration. Everybody can contribute with knowledge, work and ideas locally and globally to solve each need for their society and to the world. It should help each community to make products and services and also do the exchange things with each other replacing money. It is not a barter system. It is a system where each person writes their needs and community organizes itself to provide all their needs in a circular and sustainable way. The best practices, products and service can be replicated and spread across nation.   This open source platform has to be developed and can be inspired by best practices and ideas across the world. For instance see: http://www.innocentive.com/   http://web.mit.edu/mitpsc/whatwedo/ideas-competition/   http://globalchallenge.mit.edu/   http://www.storyofstuff.com/movies-all/story-of-broke/   http://www.altruists.org/   http://regenerosity.com/ http://www.opensourcecurrency.org/ http://servelocally.org/about/ http://volunteermatch.sourceforge.net/ http://metacurrency.org/ https://freenetproject.org/index.html http://www.servalproject.org/ http://en.wikipedia.org/wiki/Darknet_%28file_sharing%29 http://arstechnica.com/open-source/news/2011/11/the-darknet-plan-netroots-activists-dream-of-global-mesh-network.ars http://www.codecademy.com/ It should add the animation style to easy the idea and knowledge transmission. http://comment.rsablogs.org.uk/videos/   And look for as best content as possible. http://ocw.mit.edu/index.htm   The open platform should connect the people’s need with knowledge, energy and matter in a sustainable way to produce products and services to solve each people`s need. http://www.youtube.com/watch?v=d7wJdNShICU   http://www.youtube.com/watch?v=9GorqroigqM   http://www.appropedia.org/Open_Source_Ecology   http://p2pfoundation.net/Open_Source_Ecology   http://diydrones.com/   http://www.openhardware.de/ http://reprap.org/wiki/Main_Page   http://makeprojects.com/Topic/Open_Source_Hardware   http://www.makerbot.com/   http://www.arduino.cc/ http://www.allforgood.org/gettingstarted http://labs.nortd.com/lasersaur/   http://www.willowgarage.com/   http://techshop.ws/   http://www.sparkfun.com/   We ask you donation of time and work. And anybody willing to help can be empowered with open source knowledge. http://www.youtube.com/watch?v=S63Cy64p2lQ   Choose your element and join US. http://www.youtube.com/watch?v=3TAqSBMZDY8   Remember: energy equals matter plus squared speed of light (E = m x c2). Each small group has its problems to be solved. All they need is knowledge, energy and access to raw matter to solve its problems. There is no need of money (money is only an idea backed by confidence with some functions).   There is plenty of decentralized energy from the sun: http://www.spectrolab.com/ http://www.physorg.com/news99904887.html http://www.physorg.com/news119107136.html http://www.tomsguide.com/us/Boy-Solar-Energy-Efficiency,news-12247.html   We can change any matter with knowledge and energy. With knowledge and energy we can solve all our problems: http://group4labs.com/ http://www.geek.com/articles/chips/81ghz-diamond-semiconductor-created-20030827/ http://www.youtube.com/watch?v=PILlP_yDZ2o   Money is nothing but only an idea backed by confidence with some functions. http://www.youtube.com/user/theamericandreamfilm   http://en.wikipedia.org/wiki/Money   http://www.youtube.com/watch?v=v9JSKPxQjMo   http://p2pfoundation.net/OWS_Currency#Features   If all clients of any Bank draw all their money from the Bank, it goes bankrupt. http://www.youtube.com/watch?v=Dc3sKwwAaCU   Even a child knows the sphere is the most basic form in this Universe. Figure it out: when a child blows a soap bubble why it takes the shape of a sphere and not a pyramid? So, why did we accept pyramids in all human structures (social, work, army, religion and all sort of human organizations)? All those pyramid structures create and maintain the 1% exploiting the 99%.   Why a dog doesn't see the chain around its neck? Maybe because it is too close to the eyes. But after it sees/senses the chain, it will only try to get rid of it if it is a free dog (it is not used to wear chains around its neck). All pyramid system are nothing but a structure to slave people.   http://en.wikipedia.org/wiki/File:Girl_blowing_bubbles.jpg   The concepts of divided linear thinking in hierarchies, priorities, competition and segments drive to a pyramid society. In order to one person climb the pyramid other has to fall. This concept is over and does not work anymore. It is crazy to maximize the idea (money) instead of the creator of the idea that is the human being. The human brain does not work like that. http://www.youtube.com/watch?v=lWMZg1YL4A4   http://www.youtube.com/watch?v=G49q6uPcwY8   It is time to change from monetarism economy to a resource based economy http://www.youtube.com/watch?v=4mkRFCtl2MI   http://www.youtube.com/user/OpenSourceEconomy   That new economy should aim to maximize the human quality of life in a sustainable and circular (not linear) way. http://www.youtube.com/user/storyofstuffproject   The real world is not a zero sum economy. http://comment.rsablogs.org.uk/2010/06/28/rsa-animate-crisis-capitalism/   The time is now. http://www.youtube.com/watch?v=OEjWlsUfz8E   We are the change. http://www.youtube.com/watch?v=nwMrXWPaPRI   The key to set US free is with US and none but ourselves can free our minds. http://www.youtube.com/watch?v=o5-pg0i5Iog   We are the true source of wealth and not money, gold or any other metal or rock. Do not be deceived with gold. Gold is only a metal with some peculiar chemicals properties. Even a child knows if all Earth was made of gold, we would not have the current products, development, services... we have. The value of money is backed by US only. We are the true source of wealth and we are the solution for our society.   We can move from a pyramid society to a sphere society all interconnected. http://en.wikipedia.org/wiki/Social_network http://news.yahoo.com/open-source-software-heres-occupy-wall-street-co-182100298.html   Do not expect a hero, a leader or government to help US. Each of US are the leader and we all need is to help each other. http://www.youtube.com/user/theamericandreamfilm http://www.youtube.com/watch?v=NgYE75gkzkM http://www.youtube.com/watch?v=S63Cy64p2lQ   You are invited to contribute to create an open platform, a place to connect people`s needs with knowledge to change matter to solve people`s need.   You are invited to contribute to make an open platform that can replace money with information. When Banks create money, the money goes back to the Bank plus interest. The bottom line is each people will make their own money through providing solutions to other people's need in a circular interconnected way. So, money goes back to the people that create it. Let`s implode the pyramid. It is the end of the linear pyramid structure. Because, if we let the pyramid society unchecked, the top of the pyramid will always print wealth out of the thin air and the 1% would continue to slave the 99%.   We believe all world is suffering from Banks, Investors and Corporations. http://www.youtube.com/watch?v=avH9XoqMa-I   Another world is possible. http://www.youtube.com/watch?v=wK1MOMKZ8BI http://www.youtube.com/watch?v=n7-9IMYG6KI http://www.youtube.com/watch?v=cpdpMjG5CmY   See our fight: USA wanted to change. http://www.youtube.com/watch?v=cOD5cPs01_s   USA wanted the wealth to be spread around. http://www.youtube.com/watch?v=OoqI5PSRcXM   The Congress hijacks the power given to them in every election. http://www.opensecrets.org/lobby/index.php   The Congress only serves Banks, Corporations and Lobbyists. http://www.opensecrets.org/industries/mems.php?party=A&cycle=2012   The Congress has sat still on their hands and does not represent US anymore but only corporations and lobbyist. http://www.youtube.com/watch?v=3EZ5bx9AyI4   http://www.youtube.com/watch?v=I4cJv-D7JPo   http://www.youtube.com/watch?v=H8svbm4WYmU   http://www.youtube.com/watch?v=jrRj83BunNE   We the people choose to change by ourselves. http://www.youtube.com/watch?v=7pmJdjSns4E   A new wave of reason has started. http://www.youtube.com/watch?v=1PT90dAA49Q   We are the change. http://www.youtube.com/watch?v=nrv3hteHglI   http://vimeo.com/30221816   http://vimeo.com/29906321   http://www.youtube.com/watch?v=n52957kl76Y   http://www.youtube.com/watch?v=42qyObZGnWc   http://www.youtube.com/watch?v=E8VcUxpvzxQ   http://vimeo.com/30582085   http://vimeo.com/30216273   http://vimeo.com/30259354   http://www.youtube.com/watch?v=wK1MOMKZ8BI   http://www.youtube.com/watch?v=n7-9IMYG6KI   http://www.youtube.com/watch?v=cpdpMjG5CmY   We the people have just realize we are all connected. And the only way to help US is to help every people on this nation. http://www.youtube.com/watch?v=XGK84Poeynk   We the people have woken up. http://www.youtube.com/watch?v=Su5mXhf1Qpc   http://www.youtube.com/watch?v=cG_TKAJyV6k   http://www.youtube.com/user/RenegadeEconomist   http://www.youtube.com/watch?v=EewGMBOB4Gg   http://www.youtube.com/watch?v=4Z9WVZddH9w   http://vimeo.com/27021881   http://www.youtube.com/watch?v=AqnEGu8VF8Y   http://www.youtube.com/watch?v=YvegNqKcQ-g   We the people choose to change our pyramid society into a social network society all interconnected in sphere format. http://www.youtube.com/watch?v=pLih81Gfom8   http://en.wikipedia.org/wiki/Social_network   http://www.youtube.com/watch?v=kdGi6Q3N9tY   http://www.youtube.com/watch?v=kdGi6Q3N9tY   No people, corporation or any other thing should be on top of other human been. http://www.youtube.com/watch?v=MwWVop-PBAA   http://www.youtube.com/watch?v=i3plwTxdSO4   http://www.youtube.com/watch?v=u6XAPnuFjJc http://www.youtube.com/watch?v=Ovs0fpFgeqw   We believe the social network society all interconnected in sphere format can cure the diseases caused by the pyramid society. We can see the change from human competition to cooperation. The competition should be open competition of ideas which aim to maximize the human quality of life in a sustainable way. No people, corporation or any other thing should be on top of other human been.   http://arxiv.org/pdf/0907.0334   Very complex jobs can be performed leaderless and without a pyramid structure or pyramid society. http://www.youtube.com/watch?v=Z-6jaKuDPQg   http://www.youtube.com/watch?v=oJ2ZLr87lLY   http://www.youtube.com/watch?v=JB7jSFeVz1U   We fight for a better education, free and open to all USA. http://www.youtube.com/watch?v=zDZFcDGpL4U   http://www.youtube.com/watch?v=mCbdS4hSa0s   The 1% call us zombies, pest or rats to kill us without remorse. http://www.brownells.com/aspx/general/zombie.aspx   http://www.youtube.com/watch?v=PlfGYuCMjpQ http://www.hornady.com/ammunition/zombiemax They have been spying on US for too long: http://wikileaks.org/the-spyfiles.html Let’s expose them: http://www.flexispy.com/spyphone-call-interceptor-gps-tracker-symbian.htm   Who we are? We are the 99% of population. http://vimeo.com/29511960 http://www.yesmagazine.org/people-power/ten-ways-the-occupy-movement-changes-everything We are the life force power of this Universe. http://vimeo.com/30476100   And we choose every day to step into the right hemisphere of our brain to understand we are all connected in the deepest way. http://www.ted.com/talks/jill_bolte_taylor_s_powerful_stroke_of_insight.html   http://www.youtube.com/watch?v=XGK84Poeynk   http://comment.rsablogs.org.uk/2010/05/06/rsa-animate-empathic-civilisation/   http://www.youtube.com/watch?v=dFs9WO2B8uI   Every day we do meditation to get in touch with the right hemisphere of our brain. http://www.integrallifework.com/forum/?page_id=322   http://www.youtube.com/watch?v=3IgUV_7p45s   http://www.youtube.com/watch?v=Ilvt1QdU2Dg   http://www.youtube.com/watch?v=3HwND8dYzg4   The deregulation started on Ronald Reagan administration and never stopped.   http://www.youtube.com/watch?v=T389e9StiAc   The deregulation only helped to concentrate wealth to the 1% and left US with poverty in society, environment, health... http://www.youtube.com/watch?v=bAH-o7oEiyY   http://www.youtube.com/watch?v=zq-sO_uNaFw   It made possible to Banks gamble with our money. http://www.youtube.com/watch?v=bx_LWm6_6tA   http://www.youtube.com/watch?v=O3JTPzW3xmg   The banks got broke and asked for Government to print more money to them. http://www.youtube.com/watch?v=PTUY16CkS-k&NR=1   To avoid inflation, Government cuts expenditure with people to give money to the Banks and corporations. http://www.youtube.com/watch?v=T64Loi2FJT8   For years the wealth has been systematically concentrated in the hands of a few people (most Banks and Investors). http://www.youtube.com/watch?v=yipV_pK6HXw   Imagine if all money in the world goes to only one person. Even a child knows if that happens money would lose completely its value. Wealth has been concentrated for years and money is losing its value for years. Money is nothing but only an idea backed by confidence with some functions. http://en.wikipedia.org/wiki/Money   If all clients of any Bank draw all their money from the Bank, it goes bankrupt. http://www.youtube.com/watch?v=Dc3sKwwAaCU   Even a child knows the sphere is a basic form of most stuff in Universe, not a pyramid. So, why did we accept pyramids in all human structures (social, work, army, religion and all sort of human organizations). All those pyramid structures create and maintain the 1% exploiting the 99%. Why a dog doesn't see the chain around its neck? Maybe because it is too close. But after it sees/senses the chain, it will only try to get rid of it if it is a free dog (it is not used to wear chains around its neck). http://en.wikipedia.org/wiki/File:Girl_blowing_bubbles.jpg   The concepts of divided linear thinking in hierarchies, priorities, competition and segments drive to a pyramid society. In order to one person climb the pyramid other has to fall.  This concept is over and does not work anymore.   It is crazy to maximize the idea (money) instead of the creator of the idea that is the human being. The human brain does not work like that.   It is time to change from monetarism economy to a resource based economy that aims to maximize the human quality of life in a sustainable and circular (not linear) way. http://www.youtube.com/watch?v=4mkRFCtl2MI   The real world is not a zero sum economy. http://comment.rsablogs.org.uk/2010/06/28/rsa-animate-crisis-capitalism/       The time (to change) is now. http://www.youtube.com/watch?v=73gtsiWu8g4   http://www.youtube.com/user/OccupyTV?blend=22&ob=5#p/p   http://www.youtube.com/watch?v=GXf1xipEWG4   http://www.youtube.com/watch?v=_tjyT8WLvK0   http://www.youtube.com/watch?v=SjUIEAZr4Yo   http://www.youtube.com/watch?v=rXOGhP2DBjQ   http://www.youtube.com/watch?v=7DGxNna8Q54   http://www.youtube.com/watch?v=QApWKmqUhMU   http://www.youtube.com/watch?v=7tb2fE68UGg   http://www.youtube.com/watch?v=Eb26NhGh_cU   http://www.youtube.com/watch?v=o-1TdemR7_Q   http://www.youtube.com/watch?v=zlfKdbWwruY   http://www.youtube.com/watch?v=lYizXBQ5EQA   http://www.youtube.com/watch?v=BpGA_VRc1Ro From owner-freebsd-arch@FreeBSD.ORG Mon Dec 5 18:16:32 2011 Return-Path: Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8702E1065676; Mon, 5 Dec 2011 18:16:32 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id 491398FC17; Mon, 5 Dec 2011 18:16:32 +0000 (UTC) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.5/8.14.2) with ESMTP id pB5IGVdl007595; Mon, 5 Dec 2011 13:16:31 -0500 (EST) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.5/8.14.2/Submit) id pB5IGV8V007594; Mon, 5 Dec 2011 13:16:31 -0500 (EST) (envelope-from das@FreeBSD.ORG) Date: Mon, 5 Dec 2011 13:16:31 -0500 From: David Schultz To: mdf@FreeBSD.ORG Message-ID: <20111205181631.GA7393@zim.MIT.EDU> Mail-Followup-To: mdf@freebsd.org, John Baldwin , freebsd-arch@freebsd.org, Zack Kirsch References: <20111130154604.B949@besplex.bde.org> <201111301032.04102.jhb@freebsd.org> <20111201014944.GA78010@zim.MIT.EDU> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Cc: Zack Kirsch , John Baldwin , freebsd-arch@FreeBSD.ORG Subject: Re: Use of bool / stdbool.h in kernel X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 18:16:32 -0000 On Sun, Dec 04, 2011, mdf@freebsd.org wrote: > On Wed, Nov 30, 2011 at 5:49 PM, David Schultz wrote: > > Unfortunately, the "new type" is mostly useless, aside from > > improving readability.  Unlike modern languages, C doesn't > > consider it a compile-time error to mix up bools and ints. > > Partly true. In addition to changing the semantics of the ++ and -- > operators, _Bool is usually implemented as an 8-bit type and so > pointers-to-bool and pointers-to-int are not compatible. Also, C (or > at least gcc? I don't know my C99 standard the way I know C89) will > apply default promotion and casting rules, so that e.g. an assignment > like: > > int a; > bool b; > > a = 2; > b = a; > printf("%d", b); > > will print 1. What I meant by "mostly useless" is that programs like the above don't elicit a compile-time error. Static checks to prevent the conflation of boolean and numeric types (unless you explicitly ask for it) would promote correctness. That's the most important benefit of a boolean type, but with C99 you don't get that. Kernighan even conceded as much in a paper advocating C over Pascal. The C99 bool type is still good for something because it documents what the programmer meant, but the semantics are bizarre. For instance, gcc allows the statement 'return 2' in a boolean function, and the result is that the function returns 1. And incidentally, the "modern languages" I mentioned that get it right include ALGOL 60! From owner-freebsd-arch@FreeBSD.ORG Tue Dec 6 15:13:43 2011 Return-Path: Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBD2D106564A; Tue, 6 Dec 2011 15:13:43 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 9953A8FC0A; Tue, 6 Dec 2011 15:13:43 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 2DE676C8B; Tue, 6 Dec 2011 14:55:17 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 12DBC8FB9; Tue, 6 Dec 2011 15:55:17 +0100 (CET) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Rick Macklem References: <1697386241.723355.1322748438341.JavaMail.root@erie.cs.uoguelph.ca> Date: Tue, 06 Dec 2011 15:55:16 +0100 In-Reply-To: <1697386241.723355.1322748438341.JavaMail.root@erie.cs.uoguelph.ca> (Rick Macklem's message of "Thu, 1 Dec 2011 09:07:18 -0500 (EST)") Message-ID: <86borlda23.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: Zack Kirsch , mdf@FreeBSD.ORG, David Schultz , John Baldwin , freebsd-arch@FreeBSD.ORG Subject: Re: Use of bool / stdbool.h in kernel X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 15:13:43 -0000 Rick Macklem writes: > If this is added, would the style gods approve of the following: > > (A) bool test_func(); > > if (test_func()) > ... > > instead of: > > (B) int test_func(); > > if (test_func() !=3D 0) > ... Part of the problem is that the opposite semantics are widely used, i.e. 0 indicates success and non-zero indicates failure, possibly with different non-zero values having different specific meanings. There are also cases (such as open() and socket()) where >=3D 0 indicates success while < 0 indicates failure. Therefore, an explicit comparison is preferred, except for functions like isspace() and the like whose names clearly indicate that they are predicates. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-freebsd-arch@FreeBSD.ORG Tue Dec 6 17:27:17 2011 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5B17106567B; Tue, 6 Dec 2011 17:27:17 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id AB5B48FC19; Tue, 6 Dec 2011 17:27:17 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 5D77646B0C; Tue, 6 Dec 2011 12:27:17 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id E2F53B94F; Tue, 6 Dec 2011 12:27:16 -0500 (EST) From: John Baldwin To: mdf@freebsd.org Date: Tue, 6 Dec 2011 12:27:15 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <201111301032.04102.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201112061227.15438.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 06 Dec 2011 12:27:17 -0500 (EST) Cc: Zack Kirsch , freebsd-arch@freebsd.org Subject: Re: Use of bool / stdbool.h in kernel X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 17:27:17 -0000 On Sunday, December 04, 2011 11:49:08 am mdf@freebsd.org wrote: > On Wed, Nov 30, 2011 at 7:32 AM, John Baldwin wrote: > > On Wednesday, November 30, 2011 12:13:53 am Bruce Evans wrote: > >> On Tue, 29 Nov 2011 mdf@freebsd.org wrote: > >> > >> > At $WORK we have a hack in one of the *.mk files to allow including > >> > stdbool.h in the kernel and we use it extensively. This is not > >> > allowed by style(9), as far as I can tell, because the file is in > >> > include/stdbool.h and those files are not allowed to be included in > >> > kernel sources. > >> > >> Including stdbool.h in the kernel is not a style bug, but unsupported. > >> > >> > What I want to check on is, would it be acceptable to move stdbool.h > >> > from include/stdbool.h to sys/sys/stdbool.h (i.e. like errno.h) and > >> > then include it in the kernel as ? That is, is the > >> > >> Would be a larger style bug, especially if it were actually used. > >> Even its spellings of TRUE and FALSE are strange. Even in userland > >> stdbool.h is considered so useful that it is never used in src/bin > >> and is only used a few times on other src/*bin. src/bin never uses > >> TRUE of FALSE either. > > > > I suspect there is some bias here though due to the fact that there wasn't > > a standard bool type when most of this code was written. :) I don't think > > that means we have to forgo use of the new type now that it is in fact > > standardized in C99. I would be happy to have 'bool' available and the > > lowercase 'true' and 'false' are fine with me. > > In further thinking, there's also a style issue of nested headers. > FreeBSD expects most types defined in sys/types.h so that it can be > included first and other files alphabetically. Using > would require any header with a bool parameter, return code, or struct > member to include . Alternatively, I could instead put > the same guards as stdbool.h uses and define bool, true, and false in > sys/types.h, but only for _KERNEL use (however, this also would create > issues with any file that is built in both user-space and kernel, and > unconditionally defining in sys/types.h could break existing buggy > applications). Userland apps that #define _KERNEL deserve to be broken and deal with the fallout accordingly. :) I think exposing it in the kernel via would be fine. -- John Baldwin From owner-freebsd-arch@FreeBSD.ORG Tue Dec 6 19:01:10 2011 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4361F1065670; Tue, 6 Dec 2011 19:01:10 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-ww0-f42.google.com (mail-ww0-f42.google.com [74.125.82.42]) by mx1.freebsd.org (Postfix) with ESMTP id A39018FC0A; Tue, 6 Dec 2011 19:01:09 +0000 (UTC) Received: by wgbds13 with SMTP id ds13so94111wgb.1 for ; Tue, 06 Dec 2011 11:01:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=xeuEQttgLjz0YONR9uWPoXB3CVT+fIrlAz4OtjnW7tM=; b=E7t+PidNs0Vv+R49xRGpMgS2Jae8VSYj2IuLQtQvlGZcWgV9nKR/RhnSUeNVG4S+X6 K3eKf5Seryo/ZzbeJeRCB0WxAolR5WLS38UCn7XyvrWcVJsI5Pk+9f8ODERcbTg7G1fI t5+nyP2QIOpDXwlv5vK/i4MMHFkrCNkw8QP2c= MIME-Version: 1.0 Received: by 10.216.179.142 with SMTP id h14mr2977070wem.1.1323196452675; Tue, 06 Dec 2011 10:34:12 -0800 (PST) Sender: asmrookie@gmail.com Received: by 10.216.47.211 with HTTP; Tue, 6 Dec 2011 10:34:12 -0800 (PST) In-Reply-To: <20111113083215.GV50300@deviant.kiev.zoral.com.ua> References: <20111113083215.GV50300@deviant.kiev.zoral.com.ua> Date: Tue, 6 Dec 2011 19:34:12 +0100 X-Google-Sender-Auth: wdrMNeKdc6IEYFluySEBMXlRiVI Message-ID: From: Attilio Rao To: Kostik Belousov Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: arch@freebsd.org, current@freebsd.org, avg@freebsd.org Subject: Re: Stop scheduler on panic X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 19:01:10 -0000 2011/11/13 Kostik Belousov : > I was tricked into finishing the work by Andrey Gapon, who developed > the patch to reliably stop other processors on panic. =C2=A0The patch > greatly improves the chances of getting dump on panic on SMP host. > Several people already saw the patchset, and I remember that Andrey > posted it to some lists. > > The change stops other (*) processors early upon the panic. =C2=A0This wa= y, > no parallel manipulation of the kernel memory is performed by CPUs. > In particular, the kernel memory map is static. =C2=A0Patch prevents the > panic thread from blocking and switching out. > > * - in the context of the description, other means not current. > > Since other threads are not run anymore, lock owner cannot release a > lock which is required by panic thread. =C2=A0Due to this, we need to fak= e > a lock acquisition after the panic, which adds minimal overhead to the > locking cost. The patch tries to not add any overhead on the fast path > of the lock acquire. =C2=A0The check for the after-panic condition was > reduced to single memory access, done only when the quick cas lock > attempt failed, and braced with __unlikely compiler hint. > > For now, the new mode of operation is disabled by default, since some > further USB changes are needed to make USB keyboard usable in that > environment. > > With the patch, getting a dump from the machine without debugger > compiled in is much more realistic. =C2=A0Please comment, I will commit t= he > change in 2 weeks unless strong reasons not to are given. > > http://people.freebsd.org/~kib/misc/stop_cpus_on_panic.1.patch Below are reported my notes on the patch: - Just by looking at kern_mutex.c chunk I see that you have added SCHEDULER_STOPPED() checks on very specific places, usually after sanity checks by WITNESS (and similar) and sometimes in odd places (as the chunk involving _mtx_lock_spin_flags). I think that we should just skip all the checks along with the hard locking operation. Ideall we should also skip the fast path, IMHO, but it is impossible (without polluting it), but at least skip the vast majority of operations for the hard one, so that we get, for example: %svn diff -x -p kern/kern_mutex.c | less Index: kern/kern_mutex.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- kern/kern_mutex.c (revision 228308) +++ kern/kern_mutex.c (working copy) @@ -232,6 +232,8 @@ void _mtx_lock_spin_flags(struct mtx *m, int opts, const char *file, int line) { + if (SCHEDULER_STOPPED()) + return; MPASS(curthread !=3D NULL); KASSERT(m->mtx_lock !=3D MTX_DESTROYED, ("mtx_lock_spin() of destroyed mutex @ %s:%d", file, line)); In this optic I'd patch directly the hard functions rather than waiting them to hit the smallest possible common point (which are _mtx_lock_sleep() and _mtx_lock_spin()). That will make the patch more verbose but more precise and more correct too. - This chunk is unneeded now: @@ -577,6 +589,7 @@ retry: m->mtx_recurse++; break; } + lock_profile_obtain_lock_failed(&m->lock_object, &contested, &waittime); /* Give interrupts a chance while we spin. */ - I'm not entirely sure, why we want to disable interrupts at this moment (before to stop other CPUs)?: @@ -547,13 +555,18 @@ panic(const char *fmt, ...) { #ifdef SMP static volatile u_int panic_cpu =3D NOCPU; + cpuset_t other_cpus; #endif struct thread *td =3D curthread; int bootopt, newpanic; va_list ap; static char buf[256]; - critical_enter(); + if (stop_scheduler_on_panic) + spinlock_enter(); + else + critical_enter(); + - In this chunk I don't entirely understand the kdb_active check: @@ -566,11 +579,18 @@ panic(const char *fmt, ...) PCPU_GET(cpuid)) =3D=3D 0) while (panic_cpu !=3D NOCPU) ; /* nothing */ + if (stop_scheduler_on_panic) { + if (panicstr =3D=3D NULL && !kdb_active) { + other_cpus =3D all_cpus; + CPU_CLR(PCPU_GET(cpuid), &other_cpus); + stop_cpus_hard(other_cpus); + } + } #endif bootopt =3D RB_AUTOBOOT; newpanic =3D 0; - if (panicstr) + if (panicstr !=3D NULL) bootopt |=3D RB_NOSYNC; else { bootopt |=3D RB_DUMP; Is it for avoiding to pass an empty mask to stop_cpus() in kdb_trap() (I saw you changed the policy there)? Maybe we can find a better integration among the two. I'd also move the setting of stop_scheduler variable in the "if", it seems a bug to me to have it set otherwise. - The same reservations expressed about the hard path on mutex also applies to rwlock and sxlock. - I'm not sure I like to change the policies on cpu stopping for KDB with this patchset. I think we should discuss this furthermore, in particular in terms of reviewing what accesses points KDB has and if they are all covered. If someone can summary this up (and has already made the analysis) and would please share his findings I'd be happy about it, otherwise we should not commit the stop_cpu approach in kdb_trap() IMHO. Thanks, Attilio From owner-freebsd-arch@FreeBSD.ORG Tue Dec 6 21:29:27 2011 Return-Path: Delivered-To: arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A8D62106566C; Tue, 6 Dec 2011 21:29:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 89D068FC14; Tue, 6 Dec 2011 21:29:26 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id XAA10427; Tue, 06 Dec 2011 23:29:24 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1RY2Zo-000OXZ-H7; Tue, 06 Dec 2011 23:29:24 +0200 Message-ID: <4EDE8931.1080506@FreeBSD.org> Date: Tue, 06 Dec 2011 23:29:21 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20111108 Thunderbird/8.0 MIME-Version: 1.0 To: Attilio Rao References: <20111113083215.GV50300@deviant.kiev.zoral.com.ua> In-Reply-To: X-Enigmail-Version: undefined Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Kostik Belousov , arch@FreeBSD.org, current@FreeBSD.org Subject: Re: Stop scheduler on panic X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 21:29:27 -0000 on 06/12/2011 20:34 Attilio Rao said the following: [snip] > - I'm not entirely sure, why we want to disable interrupts at this > moment (before to stop other CPUs)?: Because I believe that stop_cpus_hard() should run in a context with interrupts and preemption disabled. Also, I believe that the whole panic handling code should run in the same context. So it was only natural for me to enter that context at this point. > @@ -547,13 +555,18 @@ panic(const char *fmt, ...) > { > #ifdef SMP > static volatile u_int panic_cpu = NOCPU; > + cpuset_t other_cpus; > #endif > struct thread *td = curthread; > int bootopt, newpanic; > va_list ap; > static char buf[256]; > > - critical_enter(); > + if (stop_scheduler_on_panic) > + spinlock_enter(); > + else > + critical_enter(); > + > > - In this chunk I don't entirely understand the kdb_active check: > @@ -566,11 +579,18 @@ panic(const char *fmt, ...) > PCPU_GET(cpuid)) == 0) > while (panic_cpu != NOCPU) > ; /* nothing */ > + if (stop_scheduler_on_panic) { > + if (panicstr == NULL && !kdb_active) { > + other_cpus = all_cpus; > + CPU_CLR(PCPU_GET(cpuid), &other_cpus); > + stop_cpus_hard(other_cpus); > + } > + } > #endif > > bootopt = RB_AUTOBOOT; > newpanic = 0; > - if (panicstr) > + if (panicstr != NULL) > bootopt |= RB_NOSYNC; > else { > bootopt |= RB_DUMP; > > Is it for avoiding to pass an empty mask to stop_cpus() in kdb_trap() > (I saw you changed the policy there)? Yes. You know my position about elimination of the cpuset parameter to stop_cpus_* and my intention to do so. This is related to that. Right now that check is not strictly necessary, but it doesn't do any harm either. We know that all other CPUs are already stopped when kdb_active (ditto for panicstr != NULL). > Maybe we can find a better integration among the two. What kind of integration? Right now I have simple model - both stop all other CPUs. > I'd also move the setting of stop_scheduler variable in the "if", it > seems a bug to me to have it set otherwise. Can you please explain what bug do you suspect here? I do not see any. [snip] > - I'm not sure I like to change the policies on cpu stopping for KDB > with this patchset. I am not sure what exactly you mean by change in policies. I do not see any such change, entering kdb always stops all other CPUs, with or without the patch. > I think we should discuss this furthermore, in > particular in terms of reviewing what accesses points KDB has and if > they are all covered. Please review the code and see if anything is left to discuss :-) My review shows that all access points are covered. Essentially there is only one access point - kdb_trap. It's called either directly from a known trap context or indirectly (via a debug trap) using kdb_enter. > If someone can summary this up (and has already made the analysis) and > would please share his findings I'd be happy about it, otherwise we > should not commit the stop_cpu approach in kdb_trap() IMHO. I hope that the above answers somewhat clear your concerns. Just in case, if you can point out any clear specific problems with this approach, then that can block me from committing. A fuzzy feeling that something might be wrong won't do that :-) -- Andriy Gapon From owner-freebsd-arch@FreeBSD.ORG Tue Dec 6 22:11:03 2011 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2DD2A1065670; Tue, 6 Dec 2011 22:11:03 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 480288FC17; Tue, 6 Dec 2011 22:11:02 +0000 (UTC) Received: by lagv3 with SMTP id v3so1472487lag.13 for ; Tue, 06 Dec 2011 14:11:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=mUmXWc+9NHugaaQqyaDh8vjvQTujtts/I1tR4xkS9kI=; b=WQn49LamWh3nUSt3HvCqIk9M0j3CvbZmoKTFIjkSgz0E59aPndUqBUw/p2HTq0xocW bnYe0w3mOU1LReW7TsN6ZsRCEL6IKe8TP7Vqgizmrzwfkg5XmzHSxi1uOQmq01pJaY6z 6BZRe1Pp2dHxAh/y8FT6b/U6Ir954IpfrXRzQ= MIME-Version: 1.0 Received: by 10.152.104.236 with SMTP id gh12mr10236562lab.49.1323209461166; Tue, 06 Dec 2011 14:11:01 -0800 (PST) Sender: asmrookie@gmail.com Received: by 10.152.21.104 with HTTP; Tue, 6 Dec 2011 14:11:01 -0800 (PST) In-Reply-To: <4EDE8931.1080506@FreeBSD.org> References: <20111113083215.GV50300@deviant.kiev.zoral.com.ua> <4EDE8931.1080506@FreeBSD.org> Date: Tue, 6 Dec 2011 23:11:01 +0100 X-Google-Sender-Auth: Qw9LDTbXrPdH4Vh3LLWZ4o-7gio Message-ID: From: Attilio Rao To: Andriy Gapon Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: Kostik Belousov , arch@freebsd.org, current@freebsd.org Subject: Re: Stop scheduler on panic X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 22:11:03 -0000 2011/12/6 Andriy Gapon : > on 06/12/2011 20:34 Attilio Rao said the following: > [snip] >> - I'm not entirely sure, why we want to disable interrupts at this >> moment (before to stop other CPUs)?: > > Because I believe that stop_cpus_hard() should run in a context with inte= rrupts > and preemption disabled. =C2=A0Also, I believe that the whole panic handl= ing =C2=A0code > should run in the same context. =C2=A0So it was only natural for me to en= ter that > context at this point. I'm not against that, I don't see anything wrong with having interrupts disabled at that point. >> @@ -547,13 +555,18 @@ panic(const char *fmt, ...) >> =C2=A0{ >> =C2=A0#ifdef SMP >> =C2=A0 =C2=A0 =C2=A0 static volatile u_int panic_cpu =3D NOCPU; >> + =C2=A0 =C2=A0 cpuset_t other_cpus; >> =C2=A0#endif >> =C2=A0 =C2=A0 =C2=A0 struct thread *td =3D curthread; >> =C2=A0 =C2=A0 =C2=A0 int bootopt, newpanic; >> =C2=A0 =C2=A0 =C2=A0 va_list ap; >> =C2=A0 =C2=A0 =C2=A0 static char buf[256]; >> >> - =C2=A0 =C2=A0 critical_enter(); >> + =C2=A0 =C2=A0 if (stop_scheduler_on_panic) >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 spinlock_enter(); >> + =C2=A0 =C2=A0 else >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 critical_enter(); >> + >> >> - In this chunk I don't entirely understand the kdb_active check: >> @@ -566,11 +579,18 @@ panic(const char *fmt, ...) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 PCPU_GET(= cpuid)) =3D=3D 0) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 while (panic_cpu !=3D NOCPU) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ; /* nothing */ >> + =C2=A0 =C2=A0 if (stop_scheduler_on_panic) { >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (panicstr =3D=3D NULL && = !kdb_active) { >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = other_cpus =3D all_cpus; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = CPU_CLR(PCPU_GET(cpuid), &other_cpus); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = stop_cpus_hard(other_cpus); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } >> + =C2=A0 =C2=A0 } >> =C2=A0#endif >> >> =C2=A0 =C2=A0 =C2=A0 bootopt =3D RB_AUTOBOOT; >> =C2=A0 =C2=A0 =C2=A0 newpanic =3D 0; >> - =C2=A0 =C2=A0 if (panicstr) >> + =C2=A0 =C2=A0 if (panicstr !=3D NULL) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bootopt |=3D RB_NOSYNC; >> =C2=A0 =C2=A0 =C2=A0 else { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bootopt |=3D RB_DUMP; >> >> Is it for avoiding to pass an empty mask to stop_cpus() in kdb_trap() >> (I saw you changed the policy there)? > > Yes. =C2=A0You know my position about elimination of the cpuset parameter= to > stop_cpus_* and my intention to do so. =C2=A0This is related to that. =C2= =A0Right now that > check is not strictly necessary, =C2=A0but it doesn't do any harm either.= =C2=A0We know > that all other CPUs are already stopped when kdb_active (ditto for panics= tr !=3D > NULL). I see there could be races with disabiling interrupts and having 2 different stopping mechanisms that want to stop cpus, even using stop_cpus_hard(), on architectures that don't use a privileged channel (NMI) as mostly of our !x86. They are mostly very rare races (requiring kdb_trap() and panic() to happen in parallel on different CPUs). >> Maybe we can find a better integration among the two. > > What kind of integration? > Right now I have simple model - both stop all other CPUs. Well, there is no synchronization atm between panic stopping cpus and the kdb_trap(). When kdb_trap() stop cpus it has interrupts disabled and if panic already started they will both deadlock because IPI_STOP won't be properly delivered. However, I see all this as a problem with other arches not having/not implementing a real dedicated channel for cpu_stop_hard(), so we should not think about it now. I think we may need some sort of control as panic already does with panic_cpu before to disable interrupts, but don't worry about it now. >> I'd also move the setting of stop_scheduler variable in the "if", it >> seems a bug to me to have it set otherwise. > > Can you please explain what bug do you suspect here? > I do not see any. I just see more natural to move it within the above if (panicstr =3D=3D NULL ...) condition. > [snip] >> - I'm not sure I like to change the policies on cpu stopping for KDB >> with this patchset. > > I am not sure what exactly you mean by change in policies. =C2=A0I do not= see any > such change, entering kdb always stops all other CPUs, with or without th= e patch. Yes, I was confused by older code did just stopped CPUs before kdb_trap() manually, I think what kdb_trap() does now is ok (and you just retain it). I'd just change this check on panicstr: @@ -606,9 +603,13 @@ kdb_trap(int type, int code, struct trapframe *tf) intr =3D intr_disable(); #ifdef SMP - other_cpus =3D all_cpus; - CPU_CLR(PCPU_GET(cpuid), &other_cpus); - stop_cpus_hard(other_cpus); + if (panicstr =3D=3D NULL) { + other_cpus =3D all_cpus; + CPU_CLR(PCPU_GET(cpuid), &other_cpus); + stop_cpus_hard(other_cpus); + did_stop_cpus =3D 1; + } else + did_stop_cpus =3D 0; to be SCHEDULER_STOPPED(). If you agree I can fix the kern_mutex, kern_sx and kern_rwlock parts and it should be done. Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-freebsd-arch@FreeBSD.ORG Wed Dec 7 07:41:37 2011 Return-Path: Delivered-To: arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 467951065673; Wed, 7 Dec 2011 07:41:37 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 302918FC0A; Wed, 7 Dec 2011 07:41:35 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id JAA19088; Wed, 07 Dec 2011 09:41:33 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1RYC8D-0001FM-IM; Wed, 07 Dec 2011 09:41:33 +0200 Message-ID: <4EDF18AA.2070509@FreeBSD.org> Date: Wed, 07 Dec 2011 09:41:30 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20111108 Thunderbird/8.0 MIME-Version: 1.0 To: Attilio Rao References: <20111113083215.GV50300@deviant.kiev.zoral.com.ua> <4EDE8931.1080506@FreeBSD.org> In-Reply-To: X-Enigmail-Version: undefined Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Kostik Belousov , arch@FreeBSD.org, current@FreeBSD.org Subject: Re: Stop scheduler on panic X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 07:41:37 -0000 on 07/12/2011 00:11 Attilio Rao said the following: > I'd just change this check on panicstr: > @@ -606,9 +603,13 @@ kdb_trap(int type, int code, struct trapframe *tf) > intr = intr_disable(); > > #ifdef SMP > - other_cpus = all_cpus; > - CPU_CLR(PCPU_GET(cpuid), &other_cpus); > - stop_cpus_hard(other_cpus); > + if (panicstr == NULL) { > + other_cpus = all_cpus; > + CPU_CLR(PCPU_GET(cpuid), &other_cpus); > + stop_cpus_hard(other_cpus); > + did_stop_cpus = 1; > + } else > + did_stop_cpus = 0; > > to be SCHEDULER_STOPPED(). Makes sense. I will do this. > If you agree I can fix the kern_mutex, kern_sx and kern_rwlock parts > and it should be done. Since I am not very familiar with the details of that code, I can not be against such a proposal :-) What Kostik did seemed quite reasonable to me, but if that can be further improved, then I am all for it. -- Andriy Gapon From owner-freebsd-arch@FreeBSD.ORG Wed Dec 7 17:04:27 2011 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2EBAA1065673; Wed, 7 Dec 2011 17:04:27 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 48A588FC0A; Wed, 7 Dec 2011 17:04:25 +0000 (UTC) Received: by lagv3 with SMTP id v3so435897lag.13 for ; Wed, 07 Dec 2011 09:04:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=E9zrRUEp5DEeTTKf4PwUo6guthOx1ZReH1BD2rtV28k=; b=vQgNUOR1JND5tB8XE/75W1evH/3nYu9EC5o7YYjXZbU9SyfIdJ/RxQpB9mFqyhbpxL 4uzUqas1L6Y09bsFo4E0vioQjETKmTys5BO2rhrZQnfQ7kZCgtF3q/KwAeMHnk975MLE UP2DlmxR1ymO3GX4VEQnjo/dvJnZ12rGsjaE0= MIME-Version: 1.0 Received: by 10.152.146.100 with SMTP id tb4mr12404786lab.0.1323277464964; Wed, 07 Dec 2011 09:04:24 -0800 (PST) Sender: asmrookie@gmail.com Received: by 10.152.21.104 with HTTP; Wed, 7 Dec 2011 09:04:23 -0800 (PST) In-Reply-To: <4EDF18AA.2070509@FreeBSD.org> References: <20111113083215.GV50300@deviant.kiev.zoral.com.ua> <4EDE8931.1080506@FreeBSD.org> <4EDF18AA.2070509@FreeBSD.org> Date: Wed, 7 Dec 2011 18:04:23 +0100 X-Google-Sender-Auth: 3VTSG5NIDt_2dVxzKFjRWiATR7w Message-ID: From: Attilio Rao To: Andriy Gapon Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: Kostik Belousov , arch@freebsd.org, current@freebsd.org Subject: Re: Stop scheduler on panic X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 17:04:27 -0000 2011/12/7 Andriy Gapon : > on 07/12/2011 00:11 Attilio Rao said the following: >> I'd just change this check on panicstr: >> @@ -606,9 +603,13 @@ kdb_trap(int type, int code, struct trapframe *tf) >> =C2=A0 =C2=A0 =C2=A0 intr =3D intr_disable(); >> >> =C2=A0#ifdef SMP >> - =C2=A0 =C2=A0 other_cpus =3D all_cpus; >> - =C2=A0 =C2=A0 CPU_CLR(PCPU_GET(cpuid), &other_cpus); >> - =C2=A0 =C2=A0 stop_cpus_hard(other_cpus); >> + =C2=A0 =C2=A0 if (panicstr =3D=3D NULL) { >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 other_cpus =3D all_cpus; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 CPU_CLR(PCPU_GET(cpuid), &ot= her_cpus); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 stop_cpus_hard(other_cpus); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 did_stop_cpus =3D 1; >> + =C2=A0 =C2=A0 } else >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 did_stop_cpus =3D 0; >> >> to be SCHEDULER_STOPPED(). > > Makes sense. =C2=A0I will do this. > >> If you agree I can fix the kern_mutex, kern_sx and kern_rwlock parts >> and it should be done. > > Since I am not very familiar with the details of that code, I can not be = against > such a proposal :-) =C2=A0What Kostik did seemed quite reasonable to me, = but if that > can be further improved, then I am all for it. The following patch is a further add-on on Kostik's: http://www.freebsd.org/~attilio/scheduler_stopped.patch - Rework of mutex, rwlock and sxlock for a correct dealing of hard and fast paths - Protection of LOCK_PROFILING bits (missed also in my review) - Protection of WITNESS_SAVE/RESTORE because of Giant handling (missed also in my review) - Removal of gratuitous whitelines - Usage of SCHEDULER_STOPPED() in kdb check What do you think about it? I just test-compiled it with several combinations of LOCK_PROFILING and LOCK_DEBUG, but I didn't change the bulk of it thus it should be perfectly fine. If you like it I'd say to go for the commit asap. I wonder if someone tried to simulate a livelock and panic and thus verify that stoppcbs is correctly populated as expected (to be honest, this is one of the best features I'm interested into for this patch). Thanks, Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-freebsd-arch@FreeBSD.ORG Fri Dec 9 09:56:23 2011 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2844E106564A; Fri, 9 Dec 2011 09:56:23 +0000 (UTC) (envelope-from maxim.konovalov@gmail.com) Received: from mp2.macomnet.net (ipv6.irc.int.ru [IPv6:2a02:28:1:2::1b:2]) by mx1.freebsd.org (Postfix) with ESMTP id A34B88FC0C; Fri, 9 Dec 2011 09:56:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mp2.macomnet.net (8.14.5/8.14.5) with ESMTP id pB99uKwu078309; Fri, 9 Dec 2011 13:56:20 +0400 (MSK) (envelope-from maxim.konovalov@gmail.com) Date: Fri, 9 Dec 2011 13:56:20 +0400 (MSK) From: Maxim Konovalov To: Kostik Belousov In-Reply-To: Message-ID: References: <20111122124410.GP50300@deviant.kiev.zoral.com.ua> <20111122154357.GI95664@mdounin.ru> <20111122154935.GR50300@deviant.kiev.zoral.com.ua> <20111124202945.GR50300@deviant.kiev.zoral.com.ua> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: arch@freebsd.org, Maxim Dounin , current@freebsd.org, igor@sysoev.ru Subject: Re: RLIMIT_DATA and malloc(3) use of mmap(2) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 09:56:23 -0000 Hi Kostik, I understand that you are busy with the release. But is there a plan to commit this code somewhere in the near future? On Fri, 25 Nov 2011, 22:21+0400, Maxim Konovalov wrote: > [...] > > Fixed patch is available at > > http://people.freebsd.org/~kib/misc/map_datalimit.2.patch > > > Works as expected without any glitches. > > -- Maxim Konovalov